Merge branch 'sprint/gantt_upgrade' into 'master'
Sprint/gantt upgrade See merge request easycorp/zentaopms!4835
This commit is contained in:
@@ -245,6 +245,9 @@ $lang->action->desc->linkbug = '$date, <strong>$actor</strong> link bugs <st
|
||||
$lang->action->desc->unlinkstory = '$date, <strong>$actor</strong> remove stories <strong>$extra</strong> from plan.' . "\n";
|
||||
$lang->action->desc->unlinkbug = '$date, <strong>$actor</strong> remove bugs <strong>$extra</strong> from plan.' . "\n";
|
||||
|
||||
/* Used to describe the historical operation records of gantt. */
|
||||
$lang->action->desc->ganttmove = '$date, <strong>$actor</strong> tasks sorted <strong>$extra</strong>.' . "\n";
|
||||
|
||||
/* Used to display dynamic information. */
|
||||
$lang->action->label = new stdclass();
|
||||
$lang->action->label->install = 'install ';
|
||||
|
||||
@@ -245,6 +245,9 @@ $lang->action->desc->linkbug = '$date, <strong>$actor</strong> link bugs <st
|
||||
$lang->action->desc->unlinkstory = '$date, <strong>$actor</strong> remove stories <strong>$extra</strong> from plan.' . "\n";
|
||||
$lang->action->desc->unlinkbug = '$date, <strong>$actor</strong> remove bugs <strong>$extra</strong> from plan.' . "\n";
|
||||
|
||||
/* Used to describe the historical operation records of gantt. */
|
||||
$lang->action->desc->ganttmove = '$date, <strong>$actor</strong> tasks sorted <strong>$extra</strong>.' . "\n";
|
||||
|
||||
/* Used to display dynamic information. */
|
||||
$lang->action->label = new stdclass();
|
||||
$lang->action->label->install = 'install ';
|
||||
|
||||
@@ -245,6 +245,9 @@ $lang->action->desc->linkbug = '$date, <strong>$actor</strong> link bugs <st
|
||||
$lang->action->desc->unlinkstory = '$date, <strong>$actor</strong> remove stories <strong>$extra</strong> from plan.' . "\n";
|
||||
$lang->action->desc->unlinkbug = '$date, <strong>$actor</strong> remove bugs <strong>$extra</strong> from plan.' . "\n";
|
||||
|
||||
/* Used to describe the historical operation records of gantt. */
|
||||
$lang->action->desc->ganttmove = '$date, <strong>$actor</strong> tasks sorted <strong>$extra</strong>.' . "\n";
|
||||
|
||||
/* Used to display dynamic information. */
|
||||
$lang->action->label = new stdclass();
|
||||
$lang->action->label->install = 'install ';
|
||||
|
||||
@@ -245,6 +245,10 @@ $lang->action->desc->linkbug = '$date, 由 <strong>$actor</strong> 关联BUG
|
||||
$lang->action->desc->unlinkstory = '$date, 由 <strong>$actor</strong> 从计划移除需求 <strong>$extra</strong>。' . "\n";
|
||||
$lang->action->desc->unlinkbug = '$date, 由 <strong>$actor</strong> 从计划移除BUG <strong>$extra</strong>。' . "\n";
|
||||
|
||||
/* 用来描述gantt chat相关操作记录。 */
|
||||
$lang->action->desc->ganttdrag = '$date, 由 <strong>$actor</strong> 拖动了任务 <strong>$extra</strong>。' . "\n";
|
||||
$lang->action->desc->ganttmove = '$date, 由 <strong>$actor</strong> 排序了任务 <strong>$extra</strong>。' . "\n";
|
||||
|
||||
/* 用来显示动态信息。*/
|
||||
$lang->action->label = new stdclass();
|
||||
$lang->action->label->install = '安装';
|
||||
@@ -382,6 +386,8 @@ $lang->action->label->unlinkstory = '移除需求从';
|
||||
$lang->action->label->unlinkbug = '移除BUG从';
|
||||
$lang->action->label->tolib = '导入了';
|
||||
$lang->action->label->updatetolib = '更新了';
|
||||
$lang->action->label->ganttdrag = '拖动了';
|
||||
$lang->action->label->ganttmove = '排序了';
|
||||
|
||||
/* 动态信息按照对象分组 */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
|
||||
@@ -252,39 +252,43 @@ class programplan extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Save task drag position.
|
||||
* Response gantt drag event.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSaveTaskDrag()
|
||||
public function ajaxResponseGanttDragEvent()
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
if(!isset($_POST['id']) or empty($_POST['id'])) return $this->send(array('result' => 'fail', 'message' => ''));
|
||||
$objectID = $_POST['id'];
|
||||
|
||||
$this->loadModel('task')->saveTaskDrag($objectID, $_POST['type']);
|
||||
$this->loadModel('task')->updateEsDateByGantt($objectID, $_POST['type']);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
// $this->loadModel('action')->create('task', $objectID, 'ganttDrag', '', $this->app->user->account);
|
||||
return $this->send(array('result' => 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save task drag action.
|
||||
*
|
||||
* @param int $productID
|
||||
* Response gantt move event.
|
||||
*
|
||||
* @access public
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSaveGanttMove($productID = 0)
|
||||
public function ajaxResponseGanttMoveEvent()
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('task')->saveTaskMove($productID);
|
||||
$idList = explode('-', $_POST['id']);
|
||||
$taskID = $idList[1];
|
||||
|
||||
$this->loadModel('task')->updateOrderByGantt();
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
$this->loadModel('action')->create('task', $taskID, 'ganttMove', '', $this->app->user->account);
|
||||
|
||||
return $this->send(array('result' => 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,8 +177,10 @@ class programplanModel extends model
|
||||
{
|
||||
$planIdList[$plan->id] = $plan->id;
|
||||
|
||||
$start = helper::isZeroDate($plan->begin) ? '' : $plan->begin;
|
||||
$end = helper::isZeroDate($plan->end) ? '' : $plan->end;
|
||||
$start = helper::isZeroDate($plan->begin) ? '' : $plan->begin;
|
||||
$end = helper::isZeroDate($plan->end) ? '' : $plan->end;
|
||||
$realBegan = helper::isZeroDate($plan->realBegan) ? '' : $plan->realBegan;
|
||||
$realEnd = helper::isZeroDate($plan->realEnd) ? '' : $plan->realEnd;
|
||||
|
||||
$data = new stdclass();
|
||||
$data->id = $plan->id;
|
||||
@@ -191,12 +193,12 @@ class programplanModel extends model
|
||||
$data->status = $this->processStatus('execution', $plan);
|
||||
$data->begin = $start;
|
||||
$data->deadline = $end;
|
||||
$data->realBegan = helper::isZeroDate($plan->realBegan) ? '' : $plan->realBegan;
|
||||
$data->realEnd = helper::isZeroDate($plan->realEnd) ? '' : $plan->realEnd;
|
||||
$data->realBegan = $realBegan ? substr($realBegan, 0, 10) : '';
|
||||
$data->realEnd = $realEnd ? substr($realEnd, 0, 10) : '';;
|
||||
$data->parent = $plan->grade == 1 ? 0 :$plan->parent;
|
||||
$data->open = true;
|
||||
$data->start_date = $data->realBegan ? $data->realBegan : $data->begin;
|
||||
$data->endDate = $data->realEnd ? $data->realEnd : $data->deadline;
|
||||
$data->start_date = $realBegan ? $realBegan : $start;
|
||||
$data->endDate = $realEnd ? $realEnd : $end;
|
||||
$data->duration = 1;
|
||||
|
||||
if($data->endDate > $data->start_date) $data->duration = helper::diffDate($data->endDate, $data->start_date) + 1;
|
||||
@@ -262,8 +264,8 @@ class programplanModel extends model
|
||||
$data->milestone = '';
|
||||
$data->begin = $start;
|
||||
$data->deadline = $end;
|
||||
$data->realBegan = $realBegan;
|
||||
$data->realEnd = $realEnd;
|
||||
$data->realBegan = $realBegan ? substr($realBegan, 0, 10) : '';
|
||||
$data->realEnd = $realEnd ? substr($realEnd, 0, 10) : '';
|
||||
$data->pri = $task->pri;
|
||||
$data->parent = $task->parent > 0 ? $task->execution . '-' . $task->parent : $task->execution;
|
||||
$data->open = true;
|
||||
@@ -453,8 +455,8 @@ class programplanModel extends model
|
||||
$data->milestone = '';
|
||||
$data->begin = $start;
|
||||
$data->deadline = $end;
|
||||
$data->realBegan = $realBegan;
|
||||
$data->realEnd = $realEnd;
|
||||
$data->realBegan = $realBegan ? substr($realBegan, 0, 10) : '';
|
||||
$data->realEnd = $realEnd ? substr($realEnd, 0, 10) : '';
|
||||
$data->pri = $task->pri;
|
||||
$data->parent = ($task->parent > 0 and $task->assignedTo != '' and !empty($tasksMap[$task->parent]->assignedTo)) ? $task->parent : $groupID;
|
||||
$data->open = true;
|
||||
@@ -488,8 +490,8 @@ class programplanModel extends model
|
||||
}
|
||||
|
||||
/* Calculate group realBegan and realEnd. */
|
||||
if(!empty($realStartDate)) $datas['data'][$groupKey]->realBegan = date('Y-m-d H:i:s', min($realStartDate));
|
||||
if(!empty($realEndDate) and (count($realEndDate) == $totalTask)) $datas['data'][$groupKey]->realEnd = date('Y-m-d H:i:s', max($realEndDate));
|
||||
if(!empty($realStartDate)) $datas['data'][$groupKey]->realBegan = date('Y-m-d', min($realStartDate));
|
||||
if(!empty($realEndDate) and (count($realEndDate) == $totalTask)) $datas['data'][$groupKey]->realEnd = date('Y-m-d', max($realEndDate));
|
||||
}
|
||||
|
||||
/* Calculate the progress of the phase. */
|
||||
|
||||
@@ -427,11 +427,11 @@ function validateResources(id)
|
||||
/* Check data. */
|
||||
var postData = {
|
||||
'id' : type == 'task' ? task.id.split("-")[1] : task.id,
|
||||
'start_date': from.toLocaleDateString('en-CA'),
|
||||
'end_date' : to.toLocaleDateString('en-CA'),
|
||||
'startDate' : from.toLocaleDateString('en-CA'),
|
||||
'endDate' : to.toLocaleDateString('en-CA'),
|
||||
'type' : type
|
||||
};
|
||||
var link = createLink('programplan', 'ajaxSaveTaskDrag');
|
||||
var link = createLink('programplan', 'ajaxResponseGanttDragEvent');
|
||||
/* Sync Close. */
|
||||
$.ajax({
|
||||
url: link,
|
||||
@@ -485,7 +485,7 @@ $(function()
|
||||
|
||||
gantt.config.readonly = canGanttEdit ? false : true;
|
||||
gantt.config.details_on_dblclick = false;
|
||||
gantt.config.order_branch = ganttType == 'assignedTo' ? false : 'marker';
|
||||
gantt.config.order_branch = ganttType == 'assignedTo' ? false : true;
|
||||
gantt.config.drag_progress = false;
|
||||
gantt.config.drag_links = false;
|
||||
gantt.config.drag_move = ganttType == 'assignedTo' ? false : true;
|
||||
@@ -649,8 +649,9 @@ $(function()
|
||||
|
||||
gantt.attachEvent("onBeforeRowDragEnd", function(id, parent, tindex)
|
||||
{
|
||||
var task = gantt.getTask(id);
|
||||
var link = createLink('programplan', 'ajaxSaveGanttMove');
|
||||
var tasks = gantt.getChildren(parent);
|
||||
var task = gantt.getTask(id);
|
||||
var link = createLink('programplan', 'ajaxResponseGanttMoveEvent');
|
||||
|
||||
//prevent moving to another position.
|
||||
if(task.parent != parent || id.indexOf('-') == -1)
|
||||
@@ -662,7 +663,7 @@ $(function()
|
||||
$.ajax({
|
||||
url: link,
|
||||
dataType: "json",
|
||||
data: {id: id, type: task.type, index: tindex},
|
||||
data: {id: id, tasks: tasks},
|
||||
type: "post",
|
||||
success: function(result){}
|
||||
});
|
||||
@@ -671,6 +672,7 @@ $(function()
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
// Make folder can open or close by click
|
||||
$('#ganttView').on('click', '.gantt_close,.gantt_open', function()
|
||||
{
|
||||
|
||||
@@ -353,4 +353,5 @@ $lang->task->report->finishedTasksPerDay->graph->xAxisName = 'Datum';
|
||||
$lang->taskestimate = new stdclass();
|
||||
$lang->taskestimate->consumed = 'Schätzung';
|
||||
|
||||
$lang->task->overTime = 'The %s scheduled time has been exceeded, please modify the %s time first';
|
||||
$lang->task->overEsStartDate = 'The %s schedule start time has exceeded, please modify the %s schedule start time first';
|
||||
$lang->task->overEsEndDate = 'The %s schedule end time has exceeded, please modify the %s schedule end time first';
|
||||
@@ -353,4 +353,5 @@ $lang->task->report->finishedTasksPerDay->graph->xAxisName = 'Date';
|
||||
$lang->taskestimate = new stdclass();
|
||||
$lang->taskestimate->consumed = 'Estimates';
|
||||
|
||||
$lang->task->overTime = 'The %s scheduled time has been exceeded, please modify the %s time first';
|
||||
$lang->task->overEsStartDate = 'The %s schedule start time has exceeded, please modify the %s schedule start time first';
|
||||
$lang->task->overEsEndDate = 'The %s schedule end time has exceeded, please modify the %s schedule end time first';
|
||||
@@ -353,4 +353,5 @@ $lang->task->report->finishedTasksPerDay->graph->xAxisName = 'Date';
|
||||
$lang->taskestimate = new stdclass();
|
||||
$lang->taskestimate->consumed = 'Estimés';
|
||||
|
||||
$lang->task->overTime = 'The %s scheduled time has been exceeded, please modify the %s time first';
|
||||
$lang->task->overEsStartDate = 'The %s schedule start time has exceeded, please modify the %s schedule start time first';
|
||||
$lang->task->overEsEndDate = 'The %s schedule end time has exceeded, please modify the %s schedule end time first';
|
||||
@@ -353,4 +353,5 @@ $lang->task->report->finishedTasksPerDay->graph->xAxisName = '日期';
|
||||
$lang->taskestimate = new stdclass();
|
||||
$lang->taskestimate->consumed = '工时';
|
||||
|
||||
$lang->task->overTime = '已超出%s计划时间,请先修改%s时间';
|
||||
$lang->task->overEsStartDate = '已超出%s计划开始时间,请先修改%s计划开始时间';
|
||||
$lang->task->overEsEndDate = '已超出%s计划结束时间,请先修改%s计划结束时间';
|
||||
+33
-71
@@ -3931,17 +3931,18 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Task Drag.
|
||||
* Update estimate date by gantt.
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function saveTaskDrag($objectID, $objectType)
|
||||
public function updateEsDateByGantt($objectID, $objectType)
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
$post = fixer::input('post')->get();
|
||||
$post->end_date = date('Y-m-d', strtotime('-1 day', strtotime($post->end_date)));
|
||||
$post->endDate = date('Y-m-d', strtotime('-1 day', strtotime($post->endDate)));
|
||||
if($objectType == 'task')
|
||||
{
|
||||
$objectData = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($objectID)->fetch();
|
||||
@@ -3965,15 +3966,21 @@ class taskModel extends model
|
||||
$end = helper::isZeroDate($parentData->deadline) ? '' : $parentData->deadline;
|
||||
}
|
||||
|
||||
if(helper::diffDate($start, $post->start_date) > 0)
|
||||
if(helper::diffDate($start, $post->startDate) > 0)
|
||||
{
|
||||
$arg = !empty($parent) ? $this->lang->task->parent : $this->lang->project->stage;
|
||||
return dao::$errors = sprintf($this->lang->task->overTime, $arg, $arg);
|
||||
return dao::$errors = sprintf($this->lang->task->overEsStartDate, $arg, $arg);
|
||||
}
|
||||
|
||||
if(helper::diffDate($end, $post->endDate) < 0)
|
||||
{
|
||||
$arg = !empty($parent) ? $this->lang->task->parent : $this->lang->project->stage;
|
||||
return dao::$errors = sprintf($this->lang->task->overEsEndDate, $arg, $arg);
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_TASK)
|
||||
->set('estStarted')->eq($post->start_date)
|
||||
->set('deadline')->eq($post->end_date)
|
||||
->set('estStarted')->eq($post->startDate)
|
||||
->set('deadline')->eq($post->endDate)
|
||||
->set('lastEditedBy')->eq($this->app->user->account)
|
||||
->where('id')->eq($objectID)
|
||||
->exec();
|
||||
@@ -3996,15 +4003,21 @@ class taskModel extends model
|
||||
$start = helper::isZeroDate($parentData->begin) ? '' : $parentData->begin;
|
||||
$end = helper::isZeroDate($parentData->end) ? '' : $parentData->end;
|
||||
|
||||
if(helper::diffDate($start, $post->start_date) > 0)
|
||||
if(helper::diffDate($start, $post->startDate) > 0)
|
||||
{
|
||||
$arg = !empty($parent) ? $this->lang->programplan->parent : $this->lang->project->common;
|
||||
return dao::$errors = sprintf($this->lang->task->overTime, $arg, $arg);
|
||||
return dao::$errors = sprintf($this->lang->task->overEsStartDate, $arg, $arg);
|
||||
}
|
||||
|
||||
if(helper::diffDate($end, $post->endDate) < 0)
|
||||
{
|
||||
$arg = !empty($parent) ? $this->lang->programplan->parent : $this->lang->project->common;
|
||||
return dao::$errors = sprintf($this->lang->task->overEsEndDate, $arg, $arg);
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('begin')->eq($post->start_date)
|
||||
->set('end')->eq($post->end_date)
|
||||
->set('begin')->eq($post->startDate)
|
||||
->set('end')->eq($post->endDate)
|
||||
->set('lastEditedBy')->eq($this->app->user->account)
|
||||
->where('id')->eq($objectID)
|
||||
->exec();
|
||||
@@ -4018,73 +4031,22 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Save task order.
|
||||
* Update order by gantt.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveTaskMove($productID = 0)
|
||||
public function updateOrderByGantt()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
$IdList = explode('-', $data->id);
|
||||
$executionID = $IdList[0];
|
||||
$taskID = $IdList[1];
|
||||
$oldTask = $this->loadModel('task')->getByID($taskID);
|
||||
$index = (int)$data->index;
|
||||
$data = fixer::input('post')->get();
|
||||
|
||||
$hasZeroOrder = $this->dao->select('id')->from(TABLE_TASK)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('execution')->eq($executionID)
|
||||
->andWhere('`order`')->eq(0)
|
||||
->beginIF($oldTask->parent <= 0)->andWhere('parent')->le(0)->fi()
|
||||
->beginIF($oldTask->parent > 0)->andWhere('parent')->eq($oldTask->parent)->fi()
|
||||
->limit(1)
|
||||
->fetch('id');
|
||||
|
||||
if($hasZeroOrder)
|
||||
$order = 1;
|
||||
foreach($data->tasks as $task)
|
||||
{
|
||||
$tasks = $this->dao->select('id')->from(TABLE_TASK)
|
||||
->where('execution')->eq($executionID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($oldTask->parent <= 0)->andWhere('parent')->le(0)->fi()
|
||||
->beginIF($oldTask->parent > 0)->andWhere('parent')->eq($oldTask->parent)->fi()
|
||||
->orderBy('order_asc, id_desc')
|
||||
->fetchPairs('id');
|
||||
|
||||
$order = 1;
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$this->dao->update(TABLE_TASK)->set('`order`')->eq($order)->where('id')->eq($task)->exec();
|
||||
$order ++;
|
||||
}
|
||||
|
||||
$oldTask = $this->loadModel('task')->getByID($taskID);
|
||||
$idList = explode('-', $task);
|
||||
$taskID = $idList[1];
|
||||
$this->dao->update(TABLE_TASK)->set('`order`')->eq($order)->where('id')->eq($taskID)->exec();
|
||||
$order ++;
|
||||
}
|
||||
|
||||
$order = ++ $index;
|
||||
$oldOrder = (int)$oldTask->order;
|
||||
if($order > $oldOrder)
|
||||
{
|
||||
$this->dao->update(TABLE_TASK)->set('`order`=`order`-1')
|
||||
->where('execution')->eq($executionID)
|
||||
->andWhere('`order`')->le($order)
|
||||
->andWhere('`order`')->gt($oldOrder)
|
||||
->beginIF($oldTask->parent <= 0)->andWhere('parent')->le(0)->fi()
|
||||
->beginIF($oldTask->parent > 0)->andWhere('parent')->eq($oldTask->parent)->fi()
|
||||
->exec();
|
||||
}
|
||||
else if($order < $oldOrder)
|
||||
{
|
||||
$this->dao->update(TABLE_TASK)->set('`order`=`order`+1')
|
||||
->where('execution')->eq($executionID)
|
||||
->andWhere('`order`')->lt($oldOrder)
|
||||
->andWhere('`order`')->ge($order)
|
||||
->beginIF($oldTask->parent <= 0)->andWhere('parent')->le(0)->fi()
|
||||
->beginIF($oldTask->parent > 0)->andWhere('parent')->eq($oldTask->parent)->fi()
|
||||
->exec();
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_TASK)->set('`order`')->eq($order)->where('id')->eq($taskID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user