Ejemplo n.º 1
0
function notifyNewUser($address, $username, $logname, $logpwd)
{
    global $AppUI, $dPconfig;
    $mail = new Mail();
    if ($mail->ValidEmail($address)) {
        if ($mail->ValidEmail($AppUI->user_email)) {
            $email = $AppUI->user_email;
        } else {
            $email = 'dotproject@' . $AppUI->cfg['site_domain'];
        }
        $name = $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
        $body = $username . ',
		
An access account has been created for you in our dotProject project management system.

You can access it here at ' . $dPconfig['base_url'] . '

Your username is: ' . $logname . '
Your password is: ' . $logpwd . '

This account will allow you to see and interact with projects. If you have any questions please contact us.';
        $mail->From('"' . $name . '" <' . $email . '>');
        $mail->To($address);
        $mail->Subject('New Account Created - dotProject Project Management System');
        $mail->Body($body);
        $mail->Send();
    }
}
Ejemplo n.º 2
0
function notifyNewUser($address, $username, $logname, $logpwd)
{
    global $AppUI, $dPconfig;
    $mail = new Mail();
    if ($mail->ValidEmail($address)) {
        if ($mail->ValidEmail($AppUI->user_email)) {
            $email = $AppUI->user_email;
        } else {
            $email = "dotproject@" . $AppUI->cfg['site_domain'];
        }
        $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>");
        $mail->To($address);
        $mail->Subject('New Account Created - dotProject Project Management System');
        $mail->Body($username . ",\n\n" . "An access account has been created for you in our dotProject project management system.\n\n" . "You can access it here at " . $dPconfig['base_url'] . "\n\n" . "Your username is: " . $logname . "\n" . "Your password is: " . $logpwd . "\n\n" . "This account will allow you to see and interact with projects. If you have any questions please contact us.");
        $mail->Send();
    }
}
Ejemplo n.º 3
0
 /**
  * Called by the Event Queue processor to process a reminder
  * on a task.
  * @access		  public
  * @param		 string		   $module		  Module name (not used)
  * @param		 string		   $type Type of event (not used)
  * @param		 integer		$id ID of task being reminded
  * @param		 integer		$owner		  Originator of event
  * @param		 mixed		  $args event-specific arguments.
  * @return		  mixed		   true, dequeue event, false, event stays in queue.
  -1, event is destroyed.
 */
 function remind($module, $type, $id, $owner, &$args)
 {
     global $locale_char_set, $AppUI;
     $q = new DBQuery();
     $df = $AppUI->getPref('SHDATEFORMAT');
     $tf = $AppUI->getPref('TIMEFORMAT');
     // If we don't have preferences set for these, use ISO defaults.
     if (!$df) {
         $df = '%Y-%m-%d';
     }
     if (!$tf) {
         $tf = '%H:%m';
     }
     $df .= ' ' . $tf;
     // At this stage we won't have an object yet
     if (!$this->load($id)) {
         return -1;
         // No point it trying again later.
     }
     $this->htmlDecode();
     // Only remind on working days.
     $today = new CDate();
     if (!$today->isWorkingDay()) {
         return true;
     }
     // Check if the task is completed
     if ($this->task_percent_complete == 100) {
         return -1;
     }
     // Grab the assignee list
     $q->addTable('user_tasks', 'ut');
     $q->leftJoin('users', 'u', 'u.user_id = ut.user_id');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('ut.task_id = ' . $id);
     $contacts = $q->loadHashList('contact_id');
     $q->clear();
     // Now we also check the owner of the task, as we will need
     // to notify them as well.
     $owner_is_not_assignee = false;
     $q->addTable('users', 'u');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('u.user_id = ' . $this->task_owner);
     if ($q->exec(ADODB_FETCH_NUM)) {
         list($owner_contact, $owner_first_name, $owner_last_name, $owner_email) = $q->fetchRow();
         if (!isset($contacts[$owner_contact])) {
             $owner_is_not_assignee = true;
             $contacts[$owner_contact] = array('contact_id' => $owner_contact, 'contact_first_name' => $owner_first_name, 'contact_last_name' => $owner_last_name, 'contact_email' => $owner_email);
         }
     }
     $q->clear();
     // build the subject line, based on how soon the
     // task will be overdue.
     $starts = new CDate($this->task_start_date);
     $expires = new CDate($this->task_end_date);
     $now = new CDate();
     $diff = $expires->dateDiff($now);
     $prefix = $AppUI->_('Task Due', UI_OUTPUT_RAW);
     if ($diff == 0) {
         $msg = $AppUI->_('TODAY', UI_OUTPUT_RAW);
     } else {
         if ($diff == 1) {
             $msg = $AppUI->_('TOMORROW', UI_OUTPUT_RAW);
         } else {
             if ($diff < 0) {
                 $msg = $AppUI->_(array('OVERDUE', abs($diff), 'DAYS'));
                 $prefix = $AppUI->_('Task', UI_OUTPUT_RAW);
             } else {
                 $msg = $AppUI->_(array($diff, 'DAYS'));
             }
         }
     }
     $q->addTable('projects');
     $q->addQuery('project_name');
     $q->addWhere('project_id = ' . $this->task_project);
     $project_name = htmlspecialchars_decode($q->loadResult());
     $q->clear();
     $subject = $prefix . ' ' . $msg . ' ' . $this->task_name . '::' . $project_name;
     $body = $AppUI->_('Task Due', UI_OUTPUT_RAW) . ': ' . $msg . "\n" . $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $project_name . "\n" . $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n" . $AppUI->_('Start Date', UI_OUTPUT_RAW) . ': ' . $starts->format($df) . "\n" . $AppUI->_('Finish Date', UI_OUTPUT_RAW) . ': ' . $expires->format($df) . "\n" . $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . '&reminded=1' . "\n\n" . $AppUI->_('Resources', UI_OUTPUT_RAW) . ":\n";
     foreach ($contacts as $contact) {
         if ($owner_is_not_assignee || $contact['contact_id'] != $owner_contact) {
             $body .= $contact['contact_first_name'] . ' ' . $contact['contact_last_name'] . ' <' . $contact['contact_email'] . ">\n";
         }
     }
     $body .= "\n" . $AppUI->_('Description', UI_OUTPUT_RAW) . ":\n" . $this->task_description . "\n";
     $mail = new Mail();
     foreach ($contacts as $contact) {
         if ($mail->ValidEmail($contact['contact_email'])) {
             $mail->To($contact['contact_email']);
         }
     }
     $mail->From('"' . $owner_first_name . ' ' . $owner_last_name . '" <' . $owner_email . '>');
     $mail->Subject($subject, $locale_char_set);
     $mail->Body($body, $locale_char_set);
     return $mail->Send();
 }
Ejemplo n.º 4
0
 public function notifyContacts($notifyContacts)
 {
     global $AppUI, $w2Pconfig, $locale_char_set;
     if ($notifyContacts == '1') {
         //if no project specified than we will not do anything
         if ($this->file_project != 0) {
             $this->_project = new CProject();
             $this->_project->load($this->file_project);
             $mail = new Mail();
             if ($this->file_task == 0) {
                 //notify all developers
                 $mail->Subject($AppUI->_('Project') . ': ' . $this->_project->project_name . '::' . $this->file_name, $locale_char_set);
             } else {
                 //notify all assigned users
                 $this->_task = new CTask();
                 $this->_task->load($this->file_task);
                 $mail->Subject($AppUI->_('Project') . ': ' . $this->_project->project_name . '::' . $this->_task->task_name . '::' . $this->file_name, $locale_char_set);
             }
             $body = $AppUI->_('Project') . ': ' . $this->_project->project_name;
             $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/index.php?m=projects&a=view&project_id=' . $this->_project->project_id;
             if (intval($this->_task->task_id) != 0) {
                 $body .= "\n\n" . $AppUI->_('Task') . ':    ' . $this->_task->task_name;
                 $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->_task->task_id;
                 $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->_task->task_description;
                 $q = new DBQuery();
                 $q->addTable('project_contacts', 'pc');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
                 $q->addWhere('pc.project_id = ' . (int) $this->_project->project_id);
                 $sql = '(' . $q->prepare() . ')';
                 $q->clear();
                 $sql .= ' UNION ';
                 $q->addTable('task_contacts', 'tc');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
                 $q->addWhere('tc.task_id = ' . (int) $this->_task->task_id);
                 $sql .= '(' . $q->prepare() . ')';
                 $q->clear();
                 $this->_users = $q->loadList();
             } else {
                 $q = new DBQuery();
                 $q->addTable('project_contacts', 'pc');
                 $q->addQuery('pc.project_id, pc.contact_id');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
                 $q->addWhere('pc.project_id = ' . (int) $this->file_project);
                 $this->_users = $q->loadList();
                 $q->clear();
             }
             $body .= "\n\nFile " . $this->file_name . ' was ' . $this->_message . ' by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
             if ($this->_message != 'deleted') {
                 $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/fileviewer.php?file_id=' . $this->file_id;
                 $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->file_description;
             }
             //send mail
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
             foreach ($this->_users as $row) {
                 if ($mail->ValidEmail($row['contact_email'])) {
                     $mail->To($row['contact_email'], true);
                     $mail->Send();
                 }
             }
             return '';
         }
     }
 }
Ejemplo n.º 5
0
 public function sendWatchMail($debug = false)
 {
     global $AppUI, $debug, $w2Pconfig;
     $subj_prefix = $AppUI->_('forumEmailSubj', UI_OUTPUT_RAW);
     $body_msg = $AppUI->_('forumEmailBody', UI_OUTPUT_RAW);
     // Get the message from details.
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addQuery('contact_email, contact_first_name, contact_last_name');
     $q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner');
     $q->addWhere('user_id = ' . (int) $this->message_author);
     $res = $q->exec();
     if ($row = $q->fetchRow()) {
         $message_from = $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '<' . $row['contact_email'] . '>';
     } else {
         $message_from = 'Unknown user';
     }
     // Get the forum name;
     $q->clear();
     $q->addTable('forums');
     $q->addQuery('forum_name');
     $q->addWhere('forum_id = \'' . $this->message_forum . '\'');
     $res = $q->exec();
     if ($row = $q->fetchRow()) {
         $forum_name = $row['forum_name'];
     } else {
         $forum_name = 'Unknown';
     }
     // SQL-Query to check if the message should be delivered to all users (forced)
     // In positive case there will be a (0,0,0) row in the forum_watch table
     $q->clear();
     $q->addTable('forum_watch');
     $q->addQuery('*');
     $q->addWhere('watch_user = 0 AND watch_forum = 0 AND watch_topic = 0');
     $resAll = $q->exec();
     $AllCount = db_num_rows($resAll);
     $q->clear();
     $q->addTable('users');
     $q->addQuery('DISTINCT contact_email, user_id, contact_first_name, contact_last_name');
     $q->leftJoin('contacts', 'con', 'contact_id = user_contact');
     if ($AllCount < 1) {
         //message is only delivered to users that checked the forum watch
         $q->addTable('forum_watch');
         $q->addWhere('user_id = watch_user AND (watch_forum = ' . (int) $this->message_forum . ' OR watch_topic = ' . (int) $this->message_parent . ')');
     }
     if (!($res = $q->exec(ADODB_FETCH_ASSOC))) {
         $q->clear();
         return;
     }
     if (db_num_rows($res) < 1) {
         return;
     }
     $mail = new Mail();
     $mail->Subject($subj_prefix . ' ' . $this->message_title, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
     $body = $body_msg;
     $body .= "\n\n" . $AppUI->_('Forum', UI_OUTPUT_RAW) . ': ' . $forum_name;
     $body .= "\n" . $AppUI->_('Subject', UI_OUTPUT_RAW) . ': ' . $this->message_title;
     $body .= "\n" . $AppUI->_('Message From', UI_OUTPUT_RAW) . ': ' . $message_from;
     $body .= "\n\n" . W2P_BASE_URL . '/index.php?m=forums&a=viewer&forum_id=' . $this->message_forum;
     $body .= "\n\n" . $this->message_body;
     $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
     while ($row = $q->fetchRow()) {
         if ($mail->ValidEmail($row['contact_email'])) {
             $mail->To($row['contact_email'], true);
             $mail->Send();
         }
     }
     $q->clear();
     return;
 }
Ejemplo n.º 6
0
 function notifyContacts()
 {
     global $AppUI, $dPconfig, $locale_char_set;
     //if no project specified than we will not do anything
     if ($this->file_project != 0) {
         $project = new CProject();
         $project->load($this->file_project);
         $mail = new Mail();
         if (intval($this->file_task) != 0) {
             //notify task contacts
             $task = new CTask();
             $task->load($this->file_task);
             $mail->Subject($project->project_name . '::' . $task->task_name . '::' . $this->file_name, $locale_char_set);
         } else {
             //notify project contacts
             $mail->Subject($project->project_name . '::' . $this->file_name, $locale_char_set);
         }
         $body = $AppUI->_('Project') . ': ' . $project->project_name;
         $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/index.php?m=projects&amp;a=view&amp;project_id=' . $this->file_project;
         $users = array();
         if (intval($this->file_task) != 0) {
             $body .= "\n\n" . $AppUI->_('Task') . ': ' . $task->task_name;
             $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/index.php?m=tasks&amp;a=view&amp;task_id=' . $this->file_task;
             $body .= "\n" . $AppUI->_('Description') . ":\n" . $task->task_description;
             $this->_query->clear();
             $this->_query->addTable('project_contacts', 'pc');
             $this->_query->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
             $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name');
             $this->_query->addWhere('pc.project_id = ' . $this->file_project);
             $pc_users = $this->_query->loadList();
             $this->_query->clear();
             $this->_query->addTable('task_contacts', 'tc');
             $this->_query->addJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
             $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name');
             $this->_query->addWhere('tc.task_id = ' . $this->file_task);
             $tc_users = $this->_query->loadList();
             $this->_query->clear();
             $users = array_merge($pc_users, $tc_users);
         } else {
             $this->_query->addTable('project_contacts', 'pc');
             $this->_query->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
             $this->_query->addQuery('c.contact_email as contact_email' . ', c.contact_first_name as contact_first_name' . ', c.contact_last_name as contact_last_name');
             $this->_query->addWhere('pc.project_id = ' . $this->file_project);
             $users = $this->_query->loadList();
             $this->_query->clear();
         }
         $body .= "\n\nFile " . $this->file_name . ' was ' . $this->_message . ' by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
         if ($this->_message != 'deleted') {
             $body .= "\n" . $AppUI->_('URL') . ': ' . DP_BASE_URL . '/fileviewer.php?file_id=' . $this->file_id;
             $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->file_description;
             if ($this->file_co_reason != '') {
                 $body .= "\n" . $AppUI->_('Checkout Reason') . ':' . "\n" . $this->file_co_reason;
             }
         }
         // send mail
         $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
         $mail->From('"' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>');
         foreach ($users as $row) {
             if ($mail->ValidEmail($row['contact_email'])) {
                 $mail->To($row['contact_email'], true);
                 $mail->Send();
             }
         }
     }
     return '';
 }
Ejemplo n.º 7
0
 function sendWatchMail($debug = false)
 {
     global $AppUI, $debug, $dPconfig;
     $subj_prefix = $AppUI->_('forumEmailSubj', UI_OUTPUT_RAW);
     $body_msg = $AppUI->_('forumEmailBody', UI_OUTPUT_RAW);
     // Get the message from details.
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addQuery('contact_email, contact_first_name, contact_last_name');
     $q->addJoin('contacts', 'con', 'contact_id = user_contact');
     $q->addWhere("user_id = '{$this->message_author}'");
     $res = $q->exec();
     if ($row = db_fetch_assoc($res)) {
         $message_from = "{$row['contact_first_name']} {$row['contact_last_name']} <{$row['contact_email']}>";
     } else {
         $message_from = "Unknown user";
     }
     // Get the forum name;
     $q->clear();
     $q->addTable('forums');
     $q->addQuery('forum_name');
     $q->addWhere("forum_id = '{$this->message_forum}'");
     $res = $q->exec();
     if ($row = db_fetch_assoc($res)) {
         $forum_name = $row['forum_name'];
     } else {
         $forum_name = 'Unknown';
     }
     // SQL-Query to check if the message should be delivered to all users (forced)
     // In positive case there will be a (0,0,0) row in the forum_watch table
     $q->clear();
     $q->addTable('forum_watch');
     $q->addQuery('*');
     $q->addWhere('watch_user = 0 AND watch_forum = 0 AND watch_topic = 0');
     $resAll = $q->exec();
     $AllCount = db_num_rows($resAll);
     $q->clear();
     $q->addTable('users');
     $q->addQuery('DISTINCT contact_email, user_id, contact_first_name, contact_last_name');
     $q->addJoin('contacts', 'con', 'contact_id = user_contact');
     if ($AllCount < 1) {
         $q->addTable('forum_watch');
         $q->addWhere("user_id = watch_user\n\t\t\t\tAND (watch_forum = {$this->message_forum} OR watch_topic = {$this->message_parent})");
     }
     if (!($res = $q->exec())) {
         $q->clear();
         return;
     }
     if (db_num_rows($res) < 1) {
         return;
     }
     $mail = new Mail();
     $mail->Subject("{$subj_prefix} {$this->message_title}", isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
     $body = "{$body_msg}";
     $body .= "\n\n" . $AppUI->_('Forum', UI_OUTPUT_RAW) . ": {$forum_name}";
     $body .= "\n" . $AppUI->_('Subject', UI_OUTPUT_RAW) . ": {$this->message_title}";
     $body .= "\n" . $AppUI->_('Message From', UI_OUTPUT_RAW) . ": {$message_from}";
     $body .= "\n\n" . DP_BASE_URL . '/index.php?m=forums&a=viewer&forum_id=' . $this->message_forum;
     $body .= "\n\n{$this->message_body}";
     $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
     $mail->From($AppUI->_('forumEmailFrom', UI_OUTPUT_RAW));
     $perms =& $AppUI->acl();
     while ($row = db_fetch_assoc($res)) {
         if ($mail->ValidEmail($row['contact_email']) && $perms->checkLogin($row['user_id'])) {
             $mail->To($row['contact_email'], true);
             $mail->Send();
         }
     }
     $q->clear();
     return;
 }
Ejemplo n.º 8
0
 function notify($type, $log_id)
 {
     global $AppUI, $ist, $ict, $isa;
     //    if (!$this->item_notify ||
     //        ($this->item_assigned_to == $AppUI->user_id)) {
     //      return;
     //    }
     // Pull up the email address of everyone on the watch list
     $sql = "SELECT contact_email\n            FROM \n            \thelpdesk_item_watchers\n            \tLEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id\n\t\tLEFT JOIN contacts ON user_contact = contact_id\n            WHERE \n            \thelpdesk_item_watchers.item_id='{$this->item_id}'";
     //if they choose, along with the person who the ticket is assigned to.
     if ($this->item_notify) {
         $sql .= " or users.user_id='{$this->item_assigned_to}'";
     }
     $email_list = db_loadHashList($sql);
     $email_list = array_keys($email_list);
     //echo $sql."\n";
     //print_r($email_list);
     //if there's no one in the list, skip the rest.
     if (count($email_list) <= 0) {
         return;
     }
     if (is_numeric($log_id)) {
         switch ($type) {
             case STATUS_LOG:
                 $sql = "SELECT status_code, status_comment\n                  FROM helpdesk_item_status\n                  WHERE status_id={$log_id}";
                 break;
             case TASK_LOG:
                 $sql = "SELECT task_log_name,task_log_description\n                  FROM task_log\n                  WHERE task_log_id={$log_id}";
                 break;
         }
         db_loadHash($sql, $log);
     }
     foreach ($email_list as $assigned_to_email) {
         $mail = new Mail();
         if ($mail->ValidEmail($assigned_to_email)) {
             $subject = $AppUI->cfg['page_title'] . " " . $AppUI->_('Help Desk Item') . " #{$this->item_id}";
             switch ($type) {
                 case STATUS_LOG:
                     $body = $AppUI->_('Title') . ": {$this->item_title}\n" . $AppUI->_('Call Type') . ": {$ict[$this->item_calltype]}\n" . $AppUI->_('Status') . ": {$ist[$this->item_status]}\n";
                     if ($log['status_code'] == 0) {
                         $mail->Subject("{$subject} " . $AppUI->_('Created'));
                     } else {
                         $mail->Subject("{$subject} " . $AppUI->_('Updated'));
                         $body .= $AppUI->_('Update') . ": {$isa[$log['status_code']]} {$log['status_comment']}\n";
                     }
                     $body .= $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Summary') . ":\n" . $this->item_summary;
                     break;
                 case TASK_LOG:
                     $mail->Subject("{$subject} " . $AppUI->_('Task Log') . " " . $AppUI->_('Update'));
                     $body = $AppUI->_('Summary') . ": " . $log['task_log_name'] . "\n" . $AppUI->_('Link') . ": {$AppUI->cfg['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Comments') . ":\n" . $log['task_log_description'];
                     break;
             }
             $body .= "\n\n-- \n" . $AppUI->_('helpdeskSignature');
             if ($mail->ValidEmail($AppUI->user_email)) {
                 $email = $AppUI->user_email;
             } else {
                 $email = "dotproject@" . $AppUI->cfg['site_domain'];
             }
             $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>");
             $mail->To($assigned_to_email);
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
             $mail->Send();
         }
     }
 }
Ejemplo n.º 9
0
function notify($address, $hditem)
{
    global $AppUI;
    $mail = new Mail();
    if ($mail->ValidEmail($address)) {
        if ($mail->ValidEmail($AppUI->user_email)) {
            $email = $AppUI->user_email;
        } else {
            $email = "dotproject@" . $AppUI->cfg['site_domain'];
        }
        $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>");
        $mail->To($address);
        $mail->Subject($AppUI->_('Help Desk Item') . " #" . $hditem->item_id . " " . $AppUI->_('Updated') . " " . $hditem->item_title);
        $mail->Body("Ticket #" . $hditem->item_id . " " . $AppUI->_('IsNowWatched'));
        $mail->Send();
    }
}
Ejemplo n.º 10
0
 function notifyContacts()
 {
     global $AppUI, $dPconfig, $locale_char_set;
     //if no project specified than we will not do anything
     if ($this->file_project != 0) {
         $this->_project = new CProject();
         $this->_project->load($this->file_project);
         $mail = new Mail();
         if ($this->file_task == 0) {
             //notify all developers
             $mail->Subject($AppUI->_('Project') . ": " . $this->_project->project_name . "::" . $this->file_name, $locale_char_set);
         } else {
             //notify all assigned users
             $this->_task = new CTask();
             $this->_task->load($this->file_task);
             $mail->Subject($AppUI->_('Project') . ": " . $this->_project->project_name . "::" . $this->_task->task_name . "::" . $this->file_name, $locale_char_set);
         }
         $body = $AppUI->_('Project') . ": " . $this->_project->project_name;
         $body .= "\n" . $AppUI->_('URL') . ':     ' . DP_BASE_URL . '/index.php?m=projects&a=view&project_id=' . $this->_project->project_id;
         if (intval($this->_task->task_id) != 0) {
             $body .= "\n\n" . $AppUI->_('Task') . ":    " . $this->_task->task_name;
             $body .= "\n" . $AppUI->_('URL') . ':     ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->_task->task_id;
             $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->_task->task_description;
             $q = new DBQuery();
             $q->addTable('project_contacts', 'pc');
             $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
             $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
             $q->addWhere('pc.project_id = ' . $this->_project->project_id);
             $sql = '(' . $q->prepare() . ')';
             $q->clear();
             //$sql = "(SELECT contacts.contact_last_name, contacts.contact_email, contacts.contact_first_name FROM project_contacts INNER JOIN contacts ON (project_contacts.contact_id = contacts.contact_id) WHERE (project_contacts.project_id = ".$this->_project->project_id.")) ";
             $sql .= " UNION ";
             $q->addTable('task_contacts', 'tc');
             $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
             $q->addJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
             $q->addWhere('tc.task_id = ' . $this->_task->task_id);
             $sql .= '(' . $q->prepare() . ')';
             $q->clear();
             //$sql .= "(SELECT contacts.contact_last_name, contacts.contact_email, contacts.contact_first_name FROM task_contacts INNER JOIN contacts ON (task_contacts.contact_id = contacts.contact_id) WHERE (task_contacts.task_id = ".$this->_task->task_id."));";
             $this->_users = db_loadList($sql);
         } else {
             $q = new DBQuery();
             $q->addTable('project_contacts', 'pc');
             $q->addQuery('pc.project_id, pc.contact_id');
             $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
             $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
             $q->addWhere('pc.project_id = ' . $this->file_project);
             $this->_users = $q->loadList();
             $q->clear();
         }
         $body .= "\n\nFile " . $this->file_name . " was " . $this->_message . " by " . $AppUI->user_first_name . " " . $AppUI->user_last_name;
         if ($this->_message != "deleted") {
             $body .= "\n" . $AppUI->_('URL') . ':     ' . DP_BASE_URL . '/fileviewer.php?file_id=' . $this->file_id;
             $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->file_description;
         }
         //send mail
         $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
         $mail->From('"' . $AppUI->user_first_name . " " . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>');
         foreach ($this->_users as $row) {
             if ($mail->ValidEmail($row['contact_email'])) {
                 $mail->To($row['contact_email'], true);
                 $mail->Send();
             }
         }
         return '';
     }
 }
Ejemplo n.º 11
0
 /**
  * Email the task log to assignees, task contacts, project contacts, and others
  * based upon the information supplied by the user.
 */
 function email_log(&$log, $assignees, $task_contacts, $project_contacts, $others, $extras)
 {
     global $AppUI, $locale_char_set, $dPconfig;
     $mail_recipients = array();
     $q =& new DBQuery();
     if (isset($assignees) && $assignees == 'on') {
         $q->clear();
         $q->addTable('user_tasks', 'ut');
         $q->addWhere('ut.task_id = ' . $this->task_id);
         $q->leftJoin('users', 'ua', 'ua.user_id = ut.user_id');
         $q->leftJoin('contacts', 'c', 'c.contact_id = ua.user_contact');
         $q->addQuery('c.contact_email');
         $q->addQuery('c.contact_first_name');
         $q->addQuery('c.contact_last_name');
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = trim($first) . ' ' . trim($last);
             }
         }
     }
     if (isset($task_contacts) && $task_contacts == 'on') {
         $q->clear();
         $q->addTable('task_contacts', 'tc');
         $q->addWhere('tc.task_id = ' . $this->task_id);
         $q->leftJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
         $q->addQuery('c.contact_email');
         $q->addQuery('c.contact_first_name');
         $q->addQuery('c.contact_last_name');
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $first . ' ' . $last;
             }
         }
     }
     if (isset($project_contacts) && $project_contacts == 'on') {
         $q->clear();
         $q->addTable('project_contacts', 'pc');
         $q->addWhere('pc.project_id = ' . $this->task_project);
         $q->leftJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
         $q->addQuery('c.contact_email');
         $q->addQuery('c.contact_first_name');
         $q->addQuery('c.contact_last_name');
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $first . ' ' . $last;
             }
         }
     }
     if (isset($others)) {
         $others = trim($others, " \r\n\t,");
         // get rid of empty elements.
         if (strlen($others) > 0) {
             $q->clear();
             $q->addTable('contacts', 'c');
             $q->addWhere('c.contact_id in (' . $others . ')');
             $q->addQuery('c.contact_email');
             $q->addQuery('c.contact_first_name');
             $q->addQuery('c.contact_last_name');
             $req =& $q->exec(QUERY_STYLE_NUM);
             for ($req; !$req->EOF; $req->MoveNext()) {
                 list($email, $first, $last) = $req->fields;
                 if (!isset($mail_recipients[$email])) {
                     $mail_recipients[$email] = $first . ' ' . $last;
                 }
             }
         }
     }
     if (isset($extras) && $extras) {
         // Search for semi-colons, commas or spaces and allow any to be separators
         $extra_list = preg_split('/[\\s,;]+/', $extras);
         foreach ($extra_list as $email) {
             if ($email && !isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $email;
             }
         }
     }
     $q->clear();
     // Reset to the default state.
     if (count($mail_recipients) == 0) {
         return false;
     }
     // Build the email and send it out.
     $char_set = isset($locale_char_set) ? $locale_char_set : '';
     $mail = new Mail();
     // Grab the subject from user preferences
     $prefix = $AppUI->getPref('TASKLOGSUBJ');
     $mail->Subject($prefix . ' ' . $log->task_log_name, $char_set);
     $sql = "SELECT project_name FROM projects WHERE project_id={$this->task_project}";
     $projname = db_loadResult($sql);
     $body = $AppUI->_('Project') . ": {$projname}\n";
     if ($this->task_parent != $this->task_id) {
         $q->clear();
         $q->addTable('tasks');
         $q->addQuery('task_name');
         $q->addWhere('task_id = ' . $this->task_parent);
         $req =& $q->exec(QUERY_STYLE_NUM);
         if ($req) {
             $body .= $AppUI->_('Parent Task') . ': ' . $req->fields[0] . "\n";
         }
     }
     $q->clear();
     $body .= $AppUI->_('Task') . ": {$this->task_name}\n";
     $task_types = dPgetSysVal("TaskType");
     $body .= $AppUI->_('Task Type') . ':' . $task_types[$this->task_type] . "\n";
     $body .= $AppUI->_('URL') . ": {$dPconfig['base_url']}/index.php?m=tasks&a=view&task_id={$this->task_id}\n\n";
     $body .= $AppUI->_('Summary') . ": {$log->task_log_name}\n\n";
     $body .= $log->task_log_description;
     // Append the user signature to the email - if it exists.
     $q->addQuery('user_signature');
     $q->addWhere('user_id = ' . $AppUI->user_id);
     $q->addTable('users');
     if ($res = $q->exec()) {
         if ($res->fields['user_signature']) {
             $body .= "\n--\n" . $res->fields['user_signature'];
         }
     }
     $q->clear();
     $mail->Body($body, $char_set);
     $mail->From("{$AppUI->user_first_name} {$AppUI->user_last_name} <{$AppUI->user_email}>");
     $recipient_list = "";
     foreach ($mail_recipients as $email => $name) {
         if ($mail->ValidEmail($email)) {
             $mail->To($email);
             $recipient_list .= "{$email} ({$name})\n";
         } else {
             $recipient_list .= "Invalid email address {$email}, not sent\n";
         }
     }
     $mail->Send();
     // Now update the log
     $save_email = @$AppUI->getPref('TASKLOGNOTE');
     if ($save_email) {
         $log->task_log_description .= "\nEmailed " . date('d/m/Y H:i:s') . " to:\n{$recipient_list}";
         return true;
     }
     return false;
     // No update needed.
 }
Ejemplo n.º 12
0
 public function updateNotify()
 {
     global $AppUI, $w2Pconfig, $locale_char_set;
     $df = $AppUI->getPref('SHDATEFORMAT');
     $df .= ' ' . $AppUI->getPref('TIMEFORMAT');
     $mail = new Mail();
     $mail->Subject('Hello', $locale_char_set);
     if ($this->contact_email) {
         $q = new DBQuery();
         $q->addTable('companies');
         $q->addQuery('company_id, company_name');
         $q->addWhere('company_id = ' . (int) $this->contact_company);
         $contact_company = $q->loadHashList();
         $q->clear();
         $body = "Dear: {$this->contact_title} {$this->contact_first_name} {$this->contact_last_name},";
         $body .= "\n\nIt was very nice to visit you and " . $contact_company[$this->contact_company] . ". Thank you for all the time that you spent with me.";
         $body .= "\n\nI have entered the data from your business card into my contact data base so that we may keep in touch.";
         $body .= "\n\nWe have implemented a system which allows you to view the information that I've recorded and give you the opportunity to correct it or add information as you see fit. Please click on this link to view what I've recorded...";
         $body .= "\n\n" . $AppUI->_('URL') . ":     " . W2P_BASE_URL . "/updatecontact.php?updatekey={$this->contact_updatekey}";
         $body .= "\n\nI assure you that the information will be held in strict confidence and will not be available to anyone other than me. I realize that you may not feel comfortable filling out the entire form so please supply only what you're comfortable with.";
         $body .= "\n\nThank you. I look forward to seeing you again, soon.";
         $body .= "\n\nBest Regards,";
         $body .= "\n\n{$AppUI->user_first_name} {$AppUI->user_last_name}";
         $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
     }
     if ($mail->ValidEmail($this->contact_email)) {
         $mail->To($this->contact_email, true);
         $mail->Send();
     }
     return '';
 }
Ejemplo n.º 13
0
 public function notifyContacts($isNotNew)
 {
     global $AppUI, $w2Pconfig, $locale_char_set;
     $subject = intval($isNotNew) ? "Project Updated: {$this->project_name} " : "Project Submitted: {$this->project_name} ";
     $users = CProject::getContacts($AppUI, $this->project_id);
     if (count($users)) {
         if (intval($isNotNew)) {
             $body = $AppUI->_('Project') . ": {$this->project_name} Has Been Updated Via Project Manager. You can view the Project by clicking: ";
         } else {
             $body = $AppUI->_('Project') . ": {$this->project_name} Has Been Submitted Via Project Manager. You can view the Project by clicking: ";
         }
         $body .= "\n" . $AppUI->_('URL') . ':     ' . w2PgetConfig('base_url') . '/index.php?m=projects&a=view&project_id=' . $this->project_id;
         $body .= "\n\n(You are receiving this message because you are a contact or assignee for this Project)";
         $body .= "\n\n" . $AppUI->_('Description') . ':' . "\n{$this->project_description}";
         if (intval($isNotNew)) {
             $body .= "\n\n" . $AppUI->_('Updater') . ': ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
         } else {
             $body .= "\n\n" . $AppUI->_('Creator') . ': ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
         }
         if ($this->_message == 'deleted') {
             $body .= "\n\nProject " . $this->project_name . ' was ' . $this->_message . ' by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
         }
         foreach ($users as $row) {
             $mail = new Mail();
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
             $mail->Subject($subject, $locale_char_set);
             if ($mail->ValidEmail($row['contact_email'])) {
                 $mail->To($row['contact_email'], true);
                 $mail->Send();
             }
         }
     }
     return '';
 }
Ejemplo n.º 14
0
function notifyHR($address, $username, $uaddress, $uusername, $logname, $logpwd, $userid)
{
    global $AppUI;
    $mail = new Mail();
    if ($mail->ValidEmail($address)) {
        if ($mail->ValidEmail($AppUI->user_email)) {
            $email = $AppUI->user_email;
        } else {
            $email = '*****@*****.**';
        }
        $mail->To($address);
        $mail->Subject('New External User Created');
        $mail->Body('A new user has signed up on ' . w2PgetConfig('company_name') . ". Please go through the user details below:\n" . 'Name:	' . $uusername . "\n" . 'Username:	'******'Email:	' . $uaddress . "\n\n" . 'You may check this account at the following URL: ' . W2P_BASE_URL . '/index.php?m=admin&a=viewuser&user_id=' . $userid . "\n\n" . "Thank you very much.\n\n" . 'The ' . w2PgetConfig('company_name') . " Taskforce.\n\n" . '****PLEASE KEEP THIS EMAIL FOR YOUR RECORDS****');
        $mail->Send();
    }
}
    function notify()
    {
        global $AppUI, $dPconfig, $locale_char_set;
        //if no project specified than we will not do anything
        if ($this->file_project != 0) {
            $this->_project = new CProject();
            $this->_project->load($this->file_project);
            $mail = new Mail();
            if ($this->file_task == 0) {
                //notify all developers
                $mail->Subject($this->_project->project_name . "::" . $this->file_name, $locale_char_set);
            } else {
                //notify all assigned users
                $this->_task = new CTask();
                $this->_task->load($this->file_task);
                $mail->Subject($this->_project->project_name . "::" . $this->_task->task_name . "::" . $this->file_name, $locale_char_set);
            }
            $body = $AppUI->_('Project') . ": " . $this->_project->project_name;
            $body .= "\n" . $AppUI->_('URL') . ":     {$dPconfig['base_url']}/index.php?m=projects&a=view&project_id=" . $this->_project->project_id;
            if (intval($this->_task->task_id) != 0) {
                $body .= "\n\n" . $AppUI->_('Task') . ":    " . $this->_task->task_name;
                $body .= "\n" . $AppUI->_('URL') . ":     {$dPconfig['base_url']}/index.php?m=tasks&a=view&task_id=" . $this->_task->task_id;
                $body .= "\n" . $AppUI->_('Description') . ":" . "\n" . $this->_task->task_description;
                //preparing users array
                $q = new DBQuery();
                $q->addTable('tasks', 't');
                $q->addQuery('t.task_id, cc.contact_email as creator_email, cc.contact_first_name as
						 creator_first_name, cc.contact_last_name as creator_last_name,
						 oc.contact_email as owner_email, oc.contact_first_name as owner_first_name,
						 oc.contact_last_name as owner_last_name, a.user_id as assignee_id, 
						 ac.contact_email as assignee_email, ac.contact_first_name as
						 assignee_first_name, ac.contact_last_name as assignee_last_name');
                $q->addJoin('user_tasks', 'u', 'u.task_id = t.task_id');
                $q->addJoin('users', 'o', 'o.user_id = t.task_owner');
                $q->addJoin('contacts', 'oc', 'o.user_contact = oc.contact_id');
                $q->addJoin('users', 'c', 'c.user_id = t.task_creator');
                $q->addJoin('contacts', 'cc', 'c.user_contact = cc.contact_id');
                $q->addJoin('users', 'a', 'a.user_id = u.user_id');
                $q->addJoin('contacts', 'ac', 'a.user_contact = ac.contact_id');
                $q->addWhere('t.task_id = ' . $this->_task->task_id);
                $this->_users = $q->loadList();
            } else {
                //find project owner and notify him about new or modified file
                $q = new DBQuery();
                $q->addTable('users', 'u');
                $q->addTable('projects', 'p');
                $q->addQuery('u.*');
                $q->addWhere('p.project_owner = u.user_id');
                $q->addWhere('p.project_id = ' . $this->file_project);
                $this->_users = $q->loadList();
            }
            $body .= "\n\nFile " . $this->file_name . " was " . $this->_message . " by " . $AppUI->user_first_name . " " . $AppUI->user_last_name;
            if ($this->_message != "deleted") {
                $body .= "\n" . $AppUI->_('URL') . ":     {$dPconfig['base_url']}/fileviewer.php?file_id=" . $this->file_id;
                $body .= "\n" . $AppUI->_('Description') . ":" . "\n" . $this->file_description;
            }
            //send mail
            $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
            $mail->From('"' . $AppUI->user_first_name . " " . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>');
            if (intval($this->_task->task_id) != 0) {
                foreach ($this->_users as $row) {
                    if ($row['assignee_id'] != $AppUI->user_id) {
                        if ($mail->ValidEmail($row['assignee_email'])) {
                            $mail->To($row['assignee_email'], true);
                            $mail->Send();
                        }
                    }
                }
            } else {
                //sending mail to project owner
                foreach ($this->_users as $row) {
                    //there should be only one row
                    if ($row['user_id'] != $AppUI->user_id) {
                        if ($mail->ValidEmail($row['user_email'])) {
                            $mail->To($row['user_email'], true);
                            $mail->Send();
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 16
0
 function notify($type, $log_id, $newhdi = 0)
 {
     global $AppUI, $ist, $ict, $isa, $dPconfig;
     //    if (!$this->item_notify ||
     //        ($this->item_assigned_to == $AppUI->user_id)) {
     //      return;
     //    }
     // Pull up the email address of everyone on the watch list
     $q = new DBQuery();
     $q->addTable('helpdesk_item_watchers', 'hdw');
     $q->addQuery('c.contact_email');
     $q->addJoin('users', 'u', 'hdw.user_id = u.user_id');
     $q->addJoin('contacts', 'c', 'u.user_contact = c.contact_id');
     $q->addWhere('hdw.item_id=' . $this->item_id . ' AND u.user_id<>' . $this->item_assigned_to);
     /*    $sql = "SELECT contact_email
                 FROM 
                 	helpdesk_item_watchers
                 	LEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id
     		LEFT JOIN contacts ON user_contact = contact_id
                 WHERE 
                 	helpdesk_item_watchers.item_id='{$this->item_id}'";
          //if they choose, along with the person who the ticket is assigned to.
         if($this->item_notify)
          	$sql.=" or users.user_id='{$this->item_assigned_to}'";*/
     $email_list = $q->loadHashList();
     $q->clear();
     $email_list = array_keys($email_list);
     //add the requestor email to the list of mailing people
     $email_list[] = $this->item_requestor_email;
     //add the assigned user email to the list of mailing people
     $assigned_user_email = array();
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addQuery('c.contact_email');
     $q->addJoin('contacts', 'c', 'u.user_contact = c.contact_id');
     $q->addWhere('u.user_id=' . $this->item_assigned_to);
     $assigned_user_email = $q->loadHashList();
     $assigned_user_email = array_keys($assigned_user_email);
     foreach ($assigned_user_email as $user_email) {
         if (trim($user_email)) {
             $email_list[] = $user_email;
         }
     }
     $q->clear();
     //echo $sql."\n";
     //if there's no one in the list, skip the rest.
     if (count($email_list) <= 0) {
         return;
     }
     if (is_numeric($log_id)) {
         switch ($type) {
             case STATUS_LOG:
                 $q = new DBQuery();
                 $q->addTable('helpdesk_item_status', 'hds');
                 $q->addQuery('hds.status_code, hds.status_comment');
                 $q->addWhere('hds.status_id=' . $log_id);
                 /*          $sql = "SELECT status_code, status_comment
                             FROM helpdesk_item_status
                             WHERE status_id=$log_id";*/
                 break;
             case TASK_LOG:
                 $q = new DBQuery();
                 $q->addTable('task_log', 'tl');
                 $q->addQuery('tl.task_log_name, tl.task_log_description');
                 $q->addWhere('tl.task_log_id=' . $log_id);
                 /*          $sql = "SELECT task_log_name,task_log_description
                             FROM task_log
                             WHERE task_log_id=$log_id";*/
                 break;
         }
         $log = $q->loadHash();
     }
     //For Dixon
     /*      switch ($type) {
             case STATUS_LOG:
             	if ($this->item_status <> 2) {
             		if (!$newhdi)
             			return;
             	}
             break;
             case TASK_LOG:
             		return;
             break;
           }*/
     //End Dixon
     foreach ($email_list as $assigned_to_email) {
         $mail = new Mail();
         if ($mail->ValidEmail($assigned_to_email)) {
             $subject = $AppUI->cfg['page_title'] . " " . $AppUI->_('Help Desk Item') . " #{$this->item_id}";
             switch ($type) {
                 case STATUS_LOG:
                     $body = $AppUI->_('Title') . ": {$this->item_title}\n" . $AppUI->_('Call Type') . ": {$ict[$this->item_calltype]}\n" . $AppUI->_('Status') . ": {$ist[$this->item_status]}\n";
                     if ($newhdi) {
                         $mail->Subject("{$subject} " . $AppUI->_('Created'));
                     } else {
                         $mail->Subject("{$subject} " . $AppUI->_('Updated'));
                         $body .= $AppUI->_('Update') . ": {$isa[$log['status_code']]} {$log['status_comment']}\n";
                     }
                     $body .= $AppUI->_('Link') . ": {$dPconfig['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Summary') . ":\n" . $this->item_summary;
                     break;
                 case TASK_LOG:
                     $mail->Subject("{$subject} " . $AppUI->_('Task Log') . " " . $AppUI->_('Update'));
                     $body = $AppUI->_('Summary') . ": " . $log['task_log_name'] . "\n" . $AppUI->_('Link') . ": {$dPconfig['base_url']}/index.php?m=helpdesk&a=view&item_id={$this->item_id}\n" . "\n" . $AppUI->_('Comments') . ":\n" . $log['task_log_description'];
                     break;
             }
             $body .= "\n\n-- \n" . $AppUI->_('helpdeskSignature');
             if ($mail->ValidEmail($AppUI->user_email)) {
                 $email = $AppUI->user_email;
             } else {
                 $email = "dotproject@" . $AppUI->cfg['site_domain'];
             }
             $mail->From("\"{$AppUI->user_first_name} {$AppUI->user_last_name}\" <{$email}>");
             $mail->To($assigned_to_email);
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
             $mail->Send();
         }
     }
 }