/** * Send an email alert with issues due on the given date * @param string $date * @return bool */ public function sendDueAlert($date = '') { if (!$this->id) { return false; } if (!$date) { $date = date("Y-m-d", \Helper\View::instance()->utc2local()); } $issue = new \Model\Issue(); $issues = $issue->find(array("due_date = ? AND owner_id = ? AND closed_date IS NULL AND deleted_date IS NULL", $date, $this->id), array("order" => "priority DESC")); if ($issues) { $notif = new \Helper\Notification(); return $notif->user_due_issues($this, $issues); } else { return false; } }
/** * Send an email alert with issues due on the given date * @param string $date * @return bool */ public function sendDueAlert($date = '') { if (!$this->id) { return false; } if (!$date) { $date = date("Y-m-d", \Helper\View::instance()->utc2local()); } // Get group owner IDs $ownerIds = array($this->id); $groups = new \Model\User\Group(); foreach ($groups->find(array("user_id = ?", $this->id)) as $r) { $ownerIds[] = $r->group_id; } $ownerStr = implode(",", $ownerIds); // Find issues assigned to user or user's group $issue = new Issue(); $issues = $issue->find(array("due_date = ? AND owner_id IN({$ownerStr}) AND closed_date IS NULL AND deleted_date IS NULL", $date), array("order" => "priority DESC")); if ($issues) { $notif = new \Helper\Notification(); return $notif->user_due_issues($this, $issues); } else { return false; } }