Merge branch 'master' into zenops_46
This commit is contained in:
+49
-17
@@ -1805,10 +1805,23 @@ class taskModel extends model
|
||||
|
||||
/* Fix bug#3036. */
|
||||
foreach($record->consumed as $id => $item) $record->consumed[$id] = trim($item);
|
||||
foreach($record->left as $id => $item) $record->left[$id] = trim($item);
|
||||
foreach($record->consumed as $id => $item) if(!is_numeric($item) and !empty($item)) dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->totalNumber;
|
||||
foreach($record->left as $id => $item) if(!is_numeric($item) and !empty($item)) dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->leftNumber;
|
||||
foreach($record->dates as $id => $item) if($item > $today) dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->date;
|
||||
foreach($record->consumed as $id => $item)
|
||||
{
|
||||
if(!is_numeric($item) and !empty($item))
|
||||
{
|
||||
dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->totalNumber;
|
||||
}
|
||||
elseif(is_numeric($item) and $item <= 0)
|
||||
{
|
||||
dao::$errors[] = sprintf($this->lang->error->gt, 'ID #' . $id . ' ' . $this->lang->task->record, '0');
|
||||
}
|
||||
}
|
||||
foreach($record->left as $id => $item)
|
||||
{
|
||||
$record->left[$id] = trim($item);
|
||||
if(!is_numeric($item) and !empty($item)) dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->leftNumber;
|
||||
}
|
||||
foreach($record->dates as $id => $item) if($item > $today) dao::$errors[] = 'ID #' . $id . ' ' . $this->lang->task->error->date;
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$task = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch();;
|
||||
@@ -1837,8 +1850,9 @@ class taskModel extends model
|
||||
|
||||
if(!empty($record->work[$id]) or !empty($record->consumed[$id]))
|
||||
{
|
||||
if(!$record->consumed[$id]) helper::end(js::alert($this->lang->task->error->consumedThisTime));
|
||||
if($record->left[$id] === '') helper::end(js::alert($this->lang->task->error->left));
|
||||
if(helper::isZeroDate($record->dates[$id])) helper::end(js::alert($this->lang->task->error->dateEmpty));
|
||||
if(!$record->consumed[$id]) helper::end(js::alert($this->lang->task->error->consumedThisTime));
|
||||
if($record->left[$id] === '') helper::end(js::alert($this->lang->task->error->left));
|
||||
|
||||
$estimates[$id] = new stdclass();
|
||||
$estimates[$id]->date = $record->dates[$id];
|
||||
@@ -2894,9 +2908,10 @@ class taskModel extends model
|
||||
$estimate = fixer::input('post')->cleanINT('consumed,left')->get();
|
||||
$today = helper::today();
|
||||
|
||||
if($estimate->date > $today) return dao::$errors[] = $this->lang->task->error->date;
|
||||
if($estimate->consumed <= 0) return dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->task->record, '0');
|
||||
if($estimate->left < 0) return dao::$errors[] = sprintf($this->lang->error->ge, $this->lang->task->left, '0');
|
||||
if(helper::isZeroDate($estimate->date)) return dao::$errors[] = $this->lang->task->error->dateEmpty;
|
||||
if($estimate->date > $today) return dao::$errors[] = $this->lang->task->error->date;
|
||||
if($estimate->consumed <= 0) return dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->task->record, '0');
|
||||
if($estimate->left < 0) return dao::$errors[] = sprintf($this->lang->error->ge, $this->lang->task->left, '0');
|
||||
|
||||
$task = $this->getById($oldEstimate->objectID);
|
||||
$this->dao->update(TABLE_EFFORT)->data($estimate)
|
||||
@@ -2904,13 +2919,14 @@ class taskModel extends model
|
||||
->where('id')->eq((int)$estimateID)
|
||||
->exec();
|
||||
|
||||
$consumed = $task->consumed + $estimate->consumed - $oldEstimate->consumed;
|
||||
$left = ($lastEstimate and $estimateID == $lastEstimate->id) ? $estimate->left : $task->left;
|
||||
$lastEstimate = $this->dao->select('*')->from(TABLE_EFFORT)
|
||||
->where('objectID')->eq($task->id)
|
||||
->andWhere('objectType')->eq('task')
|
||||
->orderBy('date_desc,id_desc')->limit(1)->fetch();
|
||||
|
||||
$consumed = $task->consumed + $estimate->consumed - $oldEstimate->consumed;
|
||||
$left = ($lastEstimate and $estimateID == $lastEstimate->id) ? $estimate->left : $task->left;
|
||||
|
||||
$now = helper::now();
|
||||
$data = new stdClass();
|
||||
$data->consumed = $consumed;
|
||||
@@ -3855,6 +3871,7 @@ class taskModel extends model
|
||||
public function printAssignedHtml($task, $users)
|
||||
{
|
||||
$btnTextClass = '';
|
||||
$btnClass = '';
|
||||
$assignedToText = $assignedToTitle = zget($users, $task->assignedTo);
|
||||
if(!empty($task->team) and $task->mode == 'multi' and $task->status != 'closed')
|
||||
{
|
||||
@@ -3876,15 +3893,16 @@ class taskModel extends model
|
||||
}
|
||||
elseif(empty($task->assignedTo))
|
||||
{
|
||||
$btnTextClass = 'text-primary';
|
||||
$btnClass = $btnTextClass = 'assigned-none';
|
||||
$assignedToText = $this->lang->task->noAssigned;
|
||||
}
|
||||
if($task->assignedTo == $this->app->user->account) $btnTextClass = 'text-red';
|
||||
if($task->assignedTo == $this->app->user->account) $btnClass = $btnTextClass = 'assigned-current';
|
||||
if(!empty($task->assignedTo) and $task->assignedTo != $this->app->user->account) $btnClass = $btnTextClass = 'assigned-other';
|
||||
|
||||
$btnClass = $task->assignedTo == 'closed' ? ' disabled' : '';
|
||||
$btnClass = "iframe btn btn-icon-left btn-sm {$btnClass}";
|
||||
$btnClass .= $task->assignedTo == 'closed' ? ' disabled' : '';
|
||||
$btnClass .= ' iframe btn btn-icon-left btn-sm';
|
||||
$assignToLink = $task->assignedTo == 'closed' ? '#' : helper::createLink('task', 'assignTo', "executionID=$task->execution&taskID=$task->id", '', true);
|
||||
$assignToHtml = html::a($assignToLink, "<i class='icon icon-hand-right'></i> <span title='" . $assignedToTitle . "' class='{$btnTextClass}'>{$assignedToText}</span>", '', "class='$btnClass'");
|
||||
$assignToHtml = html::a($assignToLink, "<i class='icon icon-hand-right'></i> <span title='" . $assignedToTitle . "'>{$assignedToText}</span>", '', "class='$btnClass'");
|
||||
|
||||
echo !common::hasPriv('task', 'assignTo', $task) ? "<span style='padding-left: 21px' class='{$btnTextClass}'>{$assignedToText}</span>" : $assignToHtml;
|
||||
}
|
||||
@@ -4131,10 +4149,24 @@ class taskModel extends model
|
||||
$storyChanged = !empty($task->storyStatus) && $task->storyStatus == 'active' && $task->latestStoryVersion > $task->storyVersion && !in_array($task->status, array('cancel', 'closed'));
|
||||
if($storyChanged) return $this->buildMenu('task', 'confirmStoryChange', $params, $task, 'browse', '', 'hiddenwin');
|
||||
|
||||
$canStart = ($task->status != 'pause' and common::hasPriv('task', 'start'));
|
||||
$canRestart = ($task->status == 'pause' and common::hasPriv('task', 'restart'));
|
||||
$canFinish = common::hasPriv('task', 'finish');
|
||||
$canClose = common::hasPriv('task', 'close');
|
||||
$canRecordEstimate = common::hasPriv('task', 'recordEstimate');
|
||||
$canEdit = common::hasPriv('task', 'edit');
|
||||
$canBatchCreate = ($this->config->vision == 'rnd' and common::hasPriv('task', 'batchCreate'));
|
||||
|
||||
if($task->status != 'pause') $menu .= $this->buildMenu('task', 'start', $params, $task, 'browse', '', '', 'iframe', true);
|
||||
if($task->status == 'pause') $menu .= $this->buildMenu('task', 'restart', $params, $task, 'browse', '', '', 'iframe', true);
|
||||
$menu .= $this->buildMenu('task', 'close', $params, $task, 'browse', '', '', 'iframe', true);
|
||||
$menu .= $this->buildMenu('task', 'finish', $params, $task, 'browse', '', '', 'iframe', true);
|
||||
$menu .= $this->buildMenu('task', 'close', $params, $task, 'browse', '', '', 'iframe', true);
|
||||
|
||||
if(($canStart or $canRestart or $canFinish or $canClose) and ($canRecordEstimate or $canEdit or $canBatchCreate))
|
||||
{
|
||||
$menu .= "<div class='dividing-line'></div>";
|
||||
}
|
||||
|
||||
$menu .= $this->buildMenu('task', 'recordEstimate', $params, $task, 'browse', 'time', '', 'iframe', true);
|
||||
$menu .= $this->buildMenu('task', 'edit', $params, $task, 'browse');
|
||||
if($this->config->vision == 'rnd')
|
||||
|
||||
Reference in New Issue
Block a user