本文整理汇总了PHP中CTask::updateHoursWorked2方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::updateHoursWorked2方法的具体用法?PHP CTask::updateHoursWorked2怎么用?PHP CTask::updateHoursWorked2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::updateHoursWorked2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateHoursWorked
/**
* @deprecated
*/
public static function updateHoursWorked($taskId, $totalHours)
{
trigger_error("CTask::updateHoursWorked() has been deprecated in v3.1 and will be removed by v4.0. Please use CTask->updateHoursWorked2() instead.", E_USER_NOTICE);
$task = new CTask();
$task->updateHoursWorked2($taskId, $totalHours);
}
示例2: updateTaskSummary
/**
* Updates the variable information on the task.
*
* @param int $notUsed not used
* @param int $task_id that task id of task this task log is for
*
* @return void
*
* @access protected
*/
protected function updateTaskSummary($notUsed = null, $task_id)
{
$task = new CTask();
$task->overrideDatabase($this->_query);
$task->load($task_id);
$q = $this->_getQuery();
if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
if ($this->task_log_percent_complete <= 100) {
$q->addQuery('task_log_percent_complete, task_log_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$q->addOrder('task_log_date DESC, task_log_id DESC');
$q->setLimit(1);
$results = $q->loadHash();
$percentComplete = $results['task_log_percent_complete'];
} else {
$percentComplete = 100;
}
$old_end_date = new w2p_Utilities_Date($task->task_end_date);
$new_end_date = new w2p_Utilities_Date($this->task_log_task_end_date);
$new_end_date->setHour($old_end_date->getHour());
$new_end_date->setMinute($old_end_date->getMinute());
$task_end_date = $new_end_date->format(FMT_DATETIME_MYSQL);
/*
* We're using a database update here instead of store() because a
* bunch of other things happen when you call store().. like the
* processing of contacts, departments, etc.
*/
$q = $this->_getQuery();
$q->addTable('tasks');
$q->addUpdate('task_percent_complete', $percentComplete);
$q->addUpdate('task_end_date', $task_end_date);
$q->addWhere('task_id = ' . (int) $task_id);
$success = $q->exec();
if (!$success) {
$this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
}
$task->pushDependencies($task_id, $task_end_date);
}
$q->addQuery('SUM(task_log_hours)');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$totalHours = $q->loadResult();
$task->updateHoursWorked2($task_id, $totalHours);
$task->updateDynamics();
}