afterupdate.hook.php 678 B

123456789101112131415
  1. <?php
  2. /* 如果状态变更为已取消,需要解除任务关联关系。 */
  3. /* 如果有子任务,需要解除子任务关联关系。*/
  4. if($oldTask->status != 'cancel' && $task->status == 'cancel')
  5. {
  6. $childTasks = array();
  7. if($task->parent == '-1') $childTasks = $this->dao->select('id')->from(TABLE_TASK)->where('parent')->eq($task->id)->fetchPairs('id');
  8. $this->loadExtension('gantt')->unlinkRelation($task->id, $childTasks);
  9. }
  10. /* 如果父任务有关联关系,需要解除父任务关联关系。 */
  11. if(isset($task->parent) && $task->parent > 0 && $task->parent != $oldTask->parent)
  12. {
  13. $this->loadExtension('gantt')->unlinkRelation($task->parent);
  14. }