/**
  * Save this list
  *
  * @param void
  * @return boolean
  */
 function save()
 {
     parent::save();
     $tasks = $this->getTasks();
     if (is_array($tasks)) {
         $task_ids = array();
         foreach ($tasks as $task) {
             $task_ids[] = $task->getId();
         }
         // if
         if (count($task_ids)) {
             ApplicationLogs::setIsPrivateForType($this->isPrivate(), 'ProjectTasks', $task_ids);
         }
         // if
     }
     // if
     return true;
 }
 /**
  * Save this list
  *
  * @param void
  * @return boolean
  */
 function save()
 {
     if (!$this->isNew()) {
         $old_me = ProjectTasks::findById($this->getId(), true);
         if (!$old_me instanceof ProjectTask) {
             return;
         }
         // TODO: check this!!!
         /* This was added cause deleting some tasks was giving an error, couldn't reproduce it again, but this solved it */
     }
     if ($this->isNew() || $this->getAssignedToCompanyId() != $old_me->getAssignedToCompanyId() || $this->getAssignedToUserId() != $old_me->getAssignedToUserId()) {
         $this->setAssignedBy(logged_user());
         $this->setAssignedOn(DateTimeValueLib::now());
     }
     $due_date_changed = false;
     if (!$this->isNew()) {
         $old_due_date = $old_me->getDueDate();
         $due_date = $this->getDueDate();
         if ($due_date instanceof DateTimeValue) {
             if (!$old_due_date instanceof DateTimeValue || $old_due_date->getTimestamp() != $due_date->getTimestamp()) {
                 $due_date_changed = true;
             }
         } else {
             if ($old_due_date instanceof DateTimeValue) {
                 $due_date_changed = true;
             }
         }
     }
     parent::save();
     if ($due_date_changed) {
         $id = $this->getId();
         $sql = "UPDATE `" . TABLE_PREFIX . "object_reminders` SET\n\t\t\t\t`date` = date_sub((SELECT `due_date` FROM `" . TABLE_PREFIX . "project_tasks` WHERE `id` = {$id}),\n\t\t\t\t\tinterval `minutes_before` minute) WHERE\n\t\t\t\t\t`object_manager` = 'ProjectTasks' AND `object_id` = {$id};";
         DB::execute($sql);
     }
     $tasks = $this->getSubTasks();
     if (is_array($tasks)) {
         $task_ids = array();
         foreach ($tasks as $task) {
             $task_ids[] = $task->getId();
         }
         // if
         if (count($task_ids) > 0) {
             ApplicationLogs::setIsPrivateForType($this->isPrivate(), 'ProjectTasks', $task_ids);
         }
         // if
     }
     // if
     return true;
 }