<?php /* HELPDESK $Id: addedit.php,v 1.65 2005/05/20 16:45:09 zibas Exp $ */ $item_id = dPgetParam($_GET, 'item_id', 0); $allowedCompanies = arrayMerge(array(0 => ''), getAllowedCompanies()); $projects = getAllowedProjectsForJavascript(); //$allowedDepartments = arrayMerge(array(0 => ''), getAllowedDepartments()); $allowedDepartments = getAllowedDepartmentsForJavascript(); // Pull data $sql = "SELECT *\n FROM helpdesk_items\n WHERE item_id = '{$item_id}'"; db_loadHash($sql, $hditem); // Check permissions for this record $perms =& $AppUI->acl(); $canView = $perms->checkModule($m, 'view'); if ($item_id) { // Already existing item $canEdit = $perms->checkModuleItem($m, 'edit', $item_id); } else { $canEdit = $perms->checkModule($m, 'add'); } if (!canView) { $AppUI->redirect("m=public&a=access_denied"); } if (!$canEdit) { $AppUI->redirect("m=public&a=access_denied"); } if (!@$hditem["item_assigned_to"] && $HELPDESK_CONFIG['default_assigned_to_current_user']) { @($hditem["item_assigned_to"] = $AppUI->user_id); @($hditem["item_status"] = 1); } if (!@$hditem["item_company_id"] && $HELPDESK_CONFIG['default_company_current_company']) {
<?php /* HELPDESK $Id: list.php,v 1.78 2005/12/28 20:02:49 theideaman Exp $ */ include_once dPgetConfig('root_dir') . '/modules/helpdesk/helpdesk.functions.php'; include_once "./modules/helpdesk/config.php"; $allowedCompanies = getAllowedCompanies(); $allowedProjects = getAllowedProjects(); $ipr = dPgetSysVal('HelpDeskPriority'); $ist = dPgetSysVal('HelpDeskStatus'); $AppUI->savePlace(); $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); $format = $df . " " . $tf; // check sort order if (isset($_GET['orderby'])) { $AppUI->setState('HelpDeskIdxOrderBy', $_GET['orderby']); } $orderby = $AppUI->getState('HelpDeskIdxOrderBy') ? $AppUI->getState('HelpDeskIdxOrderBy') : 'item_id'; // check sort order way (asc/desc) if (isset($_GET['orderdesc'])) { $AppUI->setState('HelpDeskIdxOrderDesc', $_GET['orderdesc']); } $orderdesc = $AppUI->getState('HelpDeskIdxOrderDesc') ? $AppUI->getState('HelpDeskIdxOrderDesc') : 0; if (isset($_GET['page'])) { $AppUI->setState('HelpDeskListPage', $_GET['page']); } else { // If page isn't mentioned, we need to reset $AppUI->setState('HelpDeskListPage', 0); } $page = $AppUI->getState('HelpDeskListPage') ? $AppUI->getState('HelpDeskListPage') : 0; $tarr = array();
function getCompanyPerms($mod_id_field, $perm_type = NULL, $the_company = NULL) { global $AppUI, $perms, $m; //pull in permitted companies $allowedCompanies = getAllowedCompanies(); //if there are none listed, make sure that sql returns nothing if (!$allowedCompanies) { return "0=1"; } $allowedCompanies = array_keys($allowedCompanies); if (is_numeric($the_company)) { $allowedCompanies[] = $the_company; } return "({$mod_id_field} in (" . implode(",", $allowedCompanies) . "))"; }