Ejemplo n.º 1
0
function getCompanyInfo($company_id)
{
    global $AppUI;
    $q = new DBQuery();
    $q->addTable('companies', 'c');
    $q->addJoin('users', 'u', 'u.user_id = c.company_owner');
    $q->addJoin('contacts', 'co', 'u.user_contact = co.contact_id');
    $q->addQuery('c.*, CONCAT(contact_first_name, " ", contact_last_name) AS contact_name');
    $q->addWhere('c.company_id = ' . $company_id);
    $company = $q->loadHash();
    if (!$company) {
        $AppUI->setMsg('Missing company ID', UI_MSG_ERROR);
        echo $AppUI->getMsg();
        return;
    }
    include 'modules/public/resources.info.php';
}
Ejemplo n.º 2
0
    $first_task = current($tasks);
    $actual_project_id = 0;
    $first_task = true;
    $task_log = array();
    echo "<table class='tbl' width='80%' summary='task log'>";
    echo "<tr><th>" . $AppUI->_("Task name") . "</th><th>" . $AppUI->_("T.Owner") . "</th><th>" . $AppUI->_("H.Alloc.") . "</th><th>" . $AppUI->_("Task end date") . "</th><th>" . $AppUI->_("Last activity date") . "</th><th>" . $AppUI->_("Done") . "?</th></tr>";
    $hrs = $AppUI->_("hrs");
    // To avoid calling $AppUI each row
    foreach ($tasks as $task) {
        if ($actual_project_id != $task["task_project"]) {
            echo "<tr><td colspan='6'><b>" . $task["project_name"] . "</b></td>";
            $actual_project_id = $task["task_project"];
        }
        if (!$q instanceof DBQuery) {
            //only create if wasn't already present as it may have been created above
            $q = new DBQuery();
        }
        $q->addTable('task_log');
        $q->addQuery('*');
        $q->addWhere('task_log_task = ' . $task['task_id']);
        $q->addOrder('task_log_date desc');
        $q->setLimit('1');
        $task_log = $q->loadHash();
        $done_img = $task["task_percent_complete"] == 100 ? "Yes" : "No";
        echo "<tr><td>&nbsp;&nbsp;&nbsp;" . $task["task_name"] . "</td><td>" . $task["user_username"] . "</td><td>" . $task["task_duration"] * $task["task_duration_type"] . " {$hrs}</td><td>" . $task["task_end_date"] . "</td><td>" . $task_log["task_log_date"] . "</td><td align='center'>{$done_img}</td></tr>";
    }
}
?>
		

Ejemplo n.º 3
0
    $q->addTable('contacts', 'con');
    $q->addQuery('con.*, company_id, company_name, dept_name');
    $q->addJoin('companies', 'com', 'contact_company = company_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    $q->addWhere('con.contact_id = ' . (int) $contact_id);
} else {
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.*');
    $q->addQuery('con.*, company_id, company_name, dept_name');
    $q->addJoin('contacts', 'con', 'user_contact = contact_id', 'inner');
    $q->addJoin('companies', 'com', 'contact_company = company_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    $q->addWhere('u.user_id = ' . (int) $user_id);
}
$user = $q->loadHash();
$q->clear();
if (!$user && $user_id > 0) {
    $titleBlock = new CTitleBlock('Invalid User ID', 'helix-setup-user.png', $m, $m . '.' . $a);
    $titleBlock->addCrumb('?m=admin', 'users list');
    $titleBlock->show();
} else {
    if ($user_id == 0 && !$contact_id) {
        $user['contact_id'] = 0;
    }
    // pull companies
    $company = new CCompany();
    $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
    $companies = arrayMerge(array('0' => ''), $companies);
    // setup the title block
    $ttl = $user_id > 0 ? 'Edit User' : 'Add User';
Ejemplo n.º 4
0
 public function notify($assignees, $update = false, $clash = false)
 {
     global $AppUI, $locale_char_set, $w2Pconfig;
     $mail_owner = $AppUI->getPref('MAILALL');
     $assignee_list = explode(',', $assignees);
     $owner_is_assigned = in_array($this->event_owner, $assignee_list);
     if ($mail_owner && !$owner_is_assigned && $this->event_owner) {
         array_push($assignee_list, $this->event_owner);
     }
     // Remove any empty elements otherwise implode has a problem
     foreach ($assignee_list as $key => $x) {
         if (!$x) {
             unset($assignee_list[$key]);
         }
     }
     if (!count($assignee_list)) {
         return;
     }
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addTable('contacts', 'con');
     $q->addQuery('user_id, contact_first_name,contact_last_name, contact_email');
     $q->addWhere('u.user_contact = con.contact_id');
     $q->addWhere('user_id in (' . implode(',', $assignee_list) . ')');
     $users = $q->loadHashList('user_id');
     $date_format = $AppUI->getPref('SHDATEFORMAT');
     $time_format = $AppUI->getPref('TIMEFORMAT');
     $fmt = $date_format . ' ' . $time_format;
     $start_date = new CDate($this->event_start_date);
     $end_date = new CDate($this->event_end_date);
     $mail = new Mail();
     $type = $update ? $AppUI->_('Updated') : $AppUI->_('New');
     if ($clash) {
         $mail->Subject($AppUI->_('Requested Event') . ': ' . $this->event_title, $locale_char_set);
     } else {
         $mail->Subject($type . ' ' . $AppUI->_('Event') . ': ' . $this->event_title, $locale_char_set);
     }
     $body = '';
     if ($clash) {
         $body .= "You have been invited to an event by {$AppUI->user_first_name} {$AppUI->user_last_name}\n";
         $body .= "However, either you or another intended invitee has a competing event\n";
         $body .= "{$AppUI->user_first_name} {$AppUI->user_last_name} has requested that you reply to this message\n";
         $body .= "and confirm if you can or can not make the requested time.\n\n";
     }
     $body .= $AppUI->_('Event') . ":\t" . $this->event_title . "\n";
     if (!$clash) {
         $body .= $AppUI->_('URL') . ":\t" . w2PgetConfig('base_url') . "/index.php?m=calendar&a=view&event_id=" . $this->event_id . "\n";
     }
     $body .= $AppUI->_('Starts') . ":\t" . $start_date->format($fmt) . "\n";
     $body .= $AppUI->_('Ends') . ":\t" . $end_date->format($fmt) . "\n";
     // Find the project name.
     if ($this->event_project) {
         $prj = array();
         $q = new DBQuery();
         $q->addTable('projects', 'p');
         $q->addQuery('project_name');
         $q->addWhere('p.project_id =' . $this->event_project);
         if ($prj = $q->loadHash()) {
             $body .= $AppUI->_('Project') . ":\t" . $prj['project_name'] . "\n";
         }
         $q->clear();
     }
     $types = w2PgetSysVal('EventType');
     $body .= $AppUI->_('Type') . ":\t" . $AppUI->_($types[$this->event_type]) . "\n";
     $body .= $AppUI->_('Attendees') . ":\t";
     $body_attend = '';
     foreach ($users as $user) {
         $body_attend .= ($body_attend ? ', ' : '') . $user['contact_first_name'] . ' ' . $user['contact_last_name'];
     }
     $body .= $body_attend . "\n\n" . $this->event_description . "\n";
     $mail->Body($body, $locale_char_set);
     foreach ($users as $user) {
         if (!$mail_owner && $user['user_id'] == $this->event_owner) {
             continue;
         }
         $mail->To($user['contact_email'], true);
         $mail->Send();
     }
 }
Ejemplo n.º 5
0
if ($denyEdit) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
require_once $AppUI->getSystemClass('date');
require_once $AppUI->getModuleClass('projects');
$df = $AppUI->getPref('SHDATEFORMAT');
$tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
$q = new DBQuery();
$task = array();
if ($tid > 0) {
    $q->addTable('task_log', 'tl');
    $q->addQuery('tl.*,t.task_project');
    $q->addJoin('tasks', 't', 'tl.task_log_task = t.task_id');
    $q->addWhere('task_log_id = ' . $tid);
    $task = $q->loadHash();
    $task_project = $task['task_project'];
    $creator = isset($task['task_log_creator']) ? $task['task_log_creator'] : 0;
} else {
    $creator = $AppUI->user_id;
}
$AppUI->savePlace();
if (isset($task['task_log_date'])) {
    $date = new CDate($task['task_log_date']);
} else {
    if (isset($_GET['date'])) {
        $date = new CDate($_GET['date']);
    } else {
        $date = new CDate();
    }
}
Ejemplo n.º 6
0
foreach ($avail_modules as $avail_module) {
    $modules[$avail_module['value']] = $avail_module['value'];
}
$modules = array(0 => 'All Modules') + $modules;
$actions = array(0 => 'All Actions', 'access' => 'access', 'add' => 'add', 'delete' => 'delete', 'edit' => 'edit', 'view' => 'view');
$table = '<table class="tbl" width="100%" cellspacing="1" cellpadding="2" border="0">';
$table .= '<tr><th colspan="9"><b>Permission Result Table</b></th></tr>';
$table .= '<tr><th>UserID</th><th>User</th><th>User Name</th><th>Module</th><th>Item</th><th>Item Name</th><th>Action</th><th>Allow</th><th>ACL_ID</th></tr>';
foreach ($permissions as $permission) {
    $item = '';
    if ($permission['item_id']) {
        $q = new DBQuery();
        $q->addTable('modules');
        $q->addQuery('permissions_item_field,permissions_item_label');
        $q->addWhere('mod_directory = \'' . $permission['module'] . '\'');
        $field = $q->loadHash();
        $q = new DBQuery();
        $q->addTable($permission['module']);
        $q->addQuery($field['permissions_item_label']);
        $q->addWhere($field['permissions_item_field'] . ' = \'' . $permission['item_id'] . '\'');
        $item = $q->loadResult();
    }
    if (!($permission['item_id'] && !$permission['acl_id'])) {
        $table .= '<tr>' . '<td style="text-align:right;">' . $permission['user_id'] . '</td>' . '<td>' . $permission['user_name'] . '</td>' . '<td>' . $users[$permission['user_id']] . '</td>' . '<td>' . $permission['module'] . '</td>' . '<td style="text-align:right;">' . ($permission['item_id'] ? $permission['item_id'] : '') . '</td>' . '<td>' . ($item ? $item : 'ALL') . '</td>' . '<td>' . $permission['action'] . '</td>' . '<td ' . (!$permission['access'] ? 'style="text-align:right;background-color:red"' : 'style="text-align:right;background-color:green"') . '>' . $permission['access'] . '</td>' . '<td ' . ($permission['acl_id'] ? '' : 'style="background-color:gray"') . '>' . ($permission['acl_id'] ? $permission['acl_id'] : 'soft-denial') . '</td>' . '</tr>';
    }
}
$table .= '</table>';
$users = array('' => '(' . $AppUI->_('Select User') . ')') + $users;
$user = isset($_POST['user']) && $_POST['user'] != '' ? $_POST['user'] : $AppUI->user_id;
$user_selector = arraySelect($users, 'user', 'class="text" onchange="javascript:document.pickUser.submit()"', $user);
$module = isset($_POST['module']) && $_POST['module'] != '' ? $_POST['module'] : '';
Ejemplo n.º 7
0
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not call this file directly.');
}
$AppUI->savePlace();
$sort = w2PgetParam($_REQUEST, 'sort', 'asc');
$forum_id = w2PgetParam($_REQUEST, 'forum_id', 0);
$message_id = w2PgetParam($_REQUEST, 'message_id', 0);
$perms =& $AppUI->acl();
$q = new DBQuery();
$q->addQuery('f.forum_name, p.project_name');
$q->addTable('forums', 'f');
$q->addJoin('projects', 'p', 'p.project_id = f.forum_project', 'inner');
$q->addWhere('f.forum_id = ' . (int) $forum_id);
$forum = $q->loadHash();
if (!$perms->checkModuleItem('forums', 'view', $message_id)) {
    $AppUI->redirect('m=public&a=access_denied');
}
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('forum_messages');
$q->addQuery('forum_messages.*,	contact_first_name, contact_last_name, contact_email, user_username, forum_moderated, visit_user');
$q->addJoin('forum_visits', 'v', 'visit_user = '******' AND visit_forum = ' . (int) $forum_id . ' AND visit_message = forum_messages.message_id');
$q->addJoin('users', 'u', 'message_author = u.user_id', 'inner');
$q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner');
$q->addWhere('forum_id = message_forum AND (message_id = ' . (int) $message_id . ' OR message_parent = ' . (int) $message_id . ')');
if (w2PgetConfig('forum_descendent_order') || w2PgetParam($_REQUEST, 'sort', 0)) {
    $q->addOrder('message_date ' . $sort);
}
$messages = $q->loadList();
Ejemplo n.º 8
0
 /**
  * This gets tricky and is there mainly for the compatibility layer
  * for getDeny functions.
  * If we get an ACL ID, and we get allow = false, then the item is
  * actively denied.	Any other combination is a soft-deny (i.e. not
  * strictly allowed, but not actively denied.
  */
 function checkModuleItemDenied($module, $op, $item, $user_id = null)
 {
     if (!$user_id) {
         $user_id = $GLOBALS['AppUI']->user_id;
     }
     $q = new DBQuery();
     $q->addQuery('allow');
     $q->addTable('dotpermissions');
     $q->addWhere("permission='{$op}' AND axo='{$item}' AND user_id='{$user_id}' and section='{$module}'");
     $q->addOrder('priority ASC, acl_id DESC');
     $q->setLimit(1);
     $arr = $q->loadHash();
     if ($arr && !$arr['allow']) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 9
0
 function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     $q->addWhere('dept_id = ' . (int) $this->contact_department);
     return $q->loadHash();
 }
Ejemplo n.º 10
0
 public function install()
 {
     $q = new DBQuery();
     $q->addTable('modules');
     $q->addQuery('mod_directory');
     $q->addWhere('mod_directory = \'' . $this->mod_directory . '\'');
     if ($temp = $q->loadHash()) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     // This arbitrarily places it at the end of the list.
     $this->mod_ui_order = 100;
     $this->store();
     $this->_compactModuleUIOrder();
     $perms =& $GLOBALS['AppUI']->acl();
     $perms->addModule($this->mod_directory, $this->mod_name);
     // Determine if it is an admin module or not, then add it to the correct set
     if (!isset($this->mod_admin)) {
         $this->mod_admin = 0;
     }
     if ($this->mod_admin) {
         $perms->addGroupItem($this->mod_directory, "admin");
     } else {
         $perms->addGroupItem($this->mod_directory, "non_admin");
     }
     if (isset($this->permissions_item_table) && $this->permissions_item_table) {
         $perms->addModuleSection($this->permissions_item_table);
     }
     return true;
 }
Ejemplo n.º 11
0
 public function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     if ($this->is_alpha($this->contact_department)) {
         $q->addWhere('dept_name = ' . $q->quote($this->contact_department));
     } else {
         $q->addWhere('dept_id = ' . (int) $this->contact_department);
     }
     return $q->loadHash();
 }
Ejemplo n.º 12
0
Archivo: file.php Proyecto: n2i/xvnkb
function getfile()
{
    global $root;
    $q = new DBQuery();
    $q->addTable('files');
    $q->addWhere('file_real_filename = "' . $_GET['file'] . '"');
    $q->addWhere('file_project = ' . $_GET['project']);
    $q->addWhere('file_task = ' . $_GET['task']);
    $q->addOrder('file_name');
    $data = $q->loadHash();
    $file = $root . '/' . $_GET['project'] . '/' . $_GET['task'] . '/' . $_GET['file'];
    if ($data['file_type'] == '') {
        $data['file_type'] = 'application/octet-stream';
    }
    header('MIME-Version: 1.0');
    header('Pragma: ');
    header('Cache-Control: public');
    header('Content-length: ' . $data['file_size']);
    header('Content-type: ' . $data['file_type']);
    header('Content-transfer-encoding: 8bit');
    header('Content-disposition: inline; filename="' . $data['file_name'] . '"');
    $fd = fopen($file, 'rb');
    if ($fd) {
        while (!feof($fd)) {
            print fread($fd, 8192);
        }
        fclose($fd);
    }
}
Ejemplo n.º 13
0
 function install()
 {
     $q = new DBQuery();
     $q->addQuery('mod_directory');
     $q->addTable('modules');
     $q->addWhere("mod_directory = '{$this->mod_directory}'");
     if ($q->loadHash()) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     $q->clear();
     $q->addQuery('max(mod_ui_order)');
     $q->addTable('modules');
     // We need to account for "pre-installed" modules that are "UI Inaccessible"
     // in order to make sure we get the "correct" initial value for .
     // mod_ui_order values of "UI Inaccessible" modules are irrelevant
     // and should probably be set to 0 so as not to interfere.
     $q->addWhere(" mod_name NOT LIKE 'Public'");
     $this->mod_ui_order = $q->loadResult() + 1;
     $perms =& $GLOBALS['AppUI']->acl();
     $perms->addModule($this->mod_directory, $this->mod_name);
     // Determine if it is an admin module or not, then add it to the correct set
     if (!isset($this->mod_admin)) {
         $this->mod_admin = 0;
     }
     if ($this->mod_admin) {
         $perms->addGroupItem($this->mod_directory, "admin");
     } else {
         $perms->addGroupItem($this->mod_directory, "non_admin");
     }
     if (isset($this->permissions_item_table) && $this->permissions_item_table) {
         $perms->addModuleSection($this->permissions_item_table);
     }
     $this->store();
     return true;
 }
Ejemplo n.º 14
0
        $selection_string = 'Department';
        $dataId = $dept_id;
        $deptList = CDepartment::getDepartmentList($AppUI, $company_id, null);
        foreach ($deptList as $dept) {
            $select_list[$dept['dept_id']] = $dept['dept_name'];
        }
        break;
}
$select_list = array('0' => '') + $select_list;
$myId = (int) w2PgetParam($_POST, $id_field, 0);
if ($myId) {
    $q = new DBQuery();
    $q->addTable($table_name);
    $q->addQuery('*');
    $q->addWhere($id_field . '=' . $myId);
    $r_data = $q->loadHash();
    $q->clear();
    $data_update_script = '';
    $update_address = isset($_POST['overwrite_address']);
    if ($table_name == 'companies') {
        $update_fields = array();
        if ($update_address) {
            $update_fields = array('company_address1' => 'contact_address1', 'company_address2' => 'contact_address2', 'company_city' => 'contact_city', 'company_state' => 'contact_state', 'company_zip' => 'contact_zip', 'company_phone1' => 'contact_phone', 'company_phone2' => 'contact_phone2', 'company_fax' => 'contact_fax');
        }
        if ($myId > 0) {
            $data_update_script = "opener.setCompany({$myId} , '" . db_escape($r_data[$name_field]) . "');";
        } else {
            $data_update_script = "opener.setCompany({$myId}, '');";
        }
    } else {
        if ($table_name == 'departments') {
Ejemplo n.º 15
0
 public function w2Pacl_nuclear($userid, $module, $item, $mod_class = array())
 {
     global $AppUI;
     //This is a sensitive function so if the minimum permission request arguments are not provided don't permit anything to this item
     if (!$userid || !$module || !$item) {
         return array();
     }
     /*echo('<pre>');
     		print_r(debug_backtrace());
     		echo('</pre>');*/
     if (!count($mod_class)) {
         $q = new DBQuery();
         $q->addTable('modules');
         $q->addQuery('mod_main_class, permissions_item_table, permissions_item_field, permissions_item_label, mod_directory');
         $q->addWhere('mod_directory = \'' . $module . '\'');
         $q->addWhere('mod_active = 1');
         $mod_class = $q->loadHash();
     }
     /*print_r($mod_class);
     		print_r('user:'******'module:'.$module.'Item:'.$item);*/
     //If we don't know what is the module we are dealing with lets deny
     if (!$mod_class['mod_directory']) {
         dprint(__FILE__, __LINE__, 2, 'user:'******'module:' . $module . 'Item:' . $item . $AppUI->getModuleClass($mod_class['mod_directory']));
         return array();
     }
     $obj = new $mod_class['mod_main_class']();
     $allowedRecords = array();
     if ($module == 'projects') {
         $allowedRecords = $obj->getAllowedRecords($userid, $mod_class['permissions_item_table'] . '.' . $mod_class['permissions_item_field'] . ',' . $mod_class['permissions_item_label'], '', null, null, 'projects');
     } else {
         $allowedRecords = $obj->getAllowedRecords($userid, $mod_class['permissions_item_table'] . '.' . $mod_class['permissions_item_field'] . ',' . $mod_class['permissions_item_label']);
     }
     /*print_r($allowedRecords[(int)$item]);
     		print_r(intval(isset($allowedRecords[(int)$item])));
     		print_r('Result:'.$item.'>count='.count($allowedRecords));die;*/
     if (count($allowedRecords)) {
         if (isset($allowedRecords[(int) $item])) {
             return array('access' => 1, 'acl_id' => 'checked');
         } else {
             return array();
         }
     } else {
         return array();
     }
 }
Ejemplo n.º 16
0
        if ($action == 'add') {
            $q->clear();
        }
        $q->addTable('history');
        $q->addUpdate('history_item = history_id');
        $q->addWhere('history_table = \'history\'');
        $okMsg = 'History deleted';
    }
    $q->clear();
    $AppUI->redirect();
}
// pull the history
$q->addTable('history');
$q->addQuery('*');
$q->addWhere('history_id =' . $history_id);
$history = $q->loadHash();
$q->clear();
$titleBlock = new CTitleBlock($history_id ? 'Edit history' : 'New history', 'stock_book_blue_48.png', 'history', 'history.' . $a);
if ($canDelete) {
    $titleBlock->addCrumbDelete('delete history', $canDelete, $msg);
}
$titleBlock->show();
?>

<script>
	function delIt() {
		document.AddEdit.action.value = 'del';
		document.AddEdit.submit();
	}	
</script>
Ejemplo n.º 17
0
 public function getProject()
 {
     $q = new DBQuery();
     $q->addTable('projects');
     $q->addQuery('project_name, project_short_name, project_color_identifier');
     $q->addWhere('project_id = ' . (int) $this->task_project);
     $projects = $q->loadHash();
     $q->clear();
     return $projects;
 }
Ejemplo n.º 18
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();
         }
     }
 }