/** * Master trigger function, creates a new trigger * @author Kieran Hogg * @param $triggerid string The name of the trigger to fire * @param $paramarray array Extra parameters to pass the trigger * @return bool TRUE if the trigger created successfully, FALSE if not */ function trigger($triggerid, $paramarray = '') { global $sit, $CONFIG, $dbg, $dbTriggers, $triggerarray; global $dbTriggers; // Check that this is a defined trigger if (!array_key_exists($triggerid, $triggerarray)) { trigger_error("Trigger '{$triggerid}' not defined", E_USER_WARNING); return; } plugin_do($triggerid); if ($CONFIG['debug'] && $paramarray != '') { foreach (array_keys($paramarray) as $key) { //parse parameter array $dbg .= "\$paramarray[{$key}] = " . $paramarray[$key] . "\n"; if ($key == "user") { $userid = $paramarray[$key]; } // TODO do we need to check for any 'special' keys here? } } //find relevant triggers $sql = "SELECT * FROM `{$dbTriggers}` WHERE triggerid='{$triggerid}'"; if ($userid) { $sql .= "AND userid={$userid}"; } $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } while ($triggerobj = mysql_fetch_object($result)) { //see if we have any checks first if (!empty($triggerobj->checks)) { if (!trigger_checks($triggerobj->checks, $paramarray)) { $checks = trigger_replace_specials($triggerid, $triggerobj->checks, $paramarray); $eresult = @eval("\$value = {$checks};return TRUE;"); if (!$eresult) { trigger_error("Error in trigger rule for {$triggerid}, check your <a href='triggers.php'>trigger rules</a>.", E_USER_WARNING); } if ($value === FALSE) { continue; } } } //if we have any params from the actual trigger, append to user params if (!empty($triggerobj->parameters)) { $resultparams = explode(",", $triggerobj->parameters); foreach ($resultparams as $assigns) { $values = explode("=", $assigns); $paramarray[$values[0]] = $values[1]; if ($CONFIG['debug']) { $dbg .= "\$paramarray[{$values[0]}] = {$values[1]}\n"; } } } if ($CONFIG['debug']) { $dbg .= "TRIGGER: trigger_action({$triggerobj->userid}, {$triggerid},\n {$triggerobj->action}, {$paramarray}) called \n"; } $return = trigger_action($triggerobj->userid, $triggerid, $triggerobj->action, $paramarray, $triggerobj->template); } return $return; }
} else { if (empty($dapproved)) { // Only allow these types to be modified if ($dtype == HOL_HOLIDAY || $dtype == HOL_WORKING_AWAY || $dtype == HOL_TRAINING) { if ($length == '0') { // Cancel Holiday // FIXME: doesn't check permission or anything $sql = "DELETE FROM `{$dbHolidays}` "; $sql .= "WHERE userid='{$user}' AND `date` = '{$year}-{$month}-{$day}' AND type='{$type}' "; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } $dlength = 0; $dapproved = 0; plugin_do('holiday_cancelled'); } else { // there is an existing booking so alter it $sql = "UPDATE `{$dbHolidays}` SET length='{$length}' "; $sql .= "WHERE userid='{$user}' AND `date` = '{$year}-{$month}-{$day}' AND type='{$type}' AND length='{$dlength}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } $dlength = $length; } } else { // there is no holiday on this day, so make one $sql = "INSERT INTO `{$dbHolidays}` "; $sql .= "SET userid='{$user}', type='{$type}', `date` = '{$year}-{$month}-{$day}', length='{$length}' "; $result = mysql_query($sql);
/** * Draw a month view Holiday planner chart * @author Ivan Lucas * @param string $mode. modes: 'month', 'week', 'day' * @param int $year. Year e.g. 2009 * @param int $month. Month number * @param int $day. Day number * @param int $groupid. * @param int $userid */ function draw_chart($mode, $year, $month = '', $day = '', $groupid = '', $userid = '') { global $plugin_calendar, $sit, $holidaytype, $startofsession; if (empty($day)) { $day = date('d'); } if ($mode == 'month') { $day = 1; $daysinmonth = date('t', mktime(0, 0, 0, $month, $day, $year)); $lastday = $daysinmonth; $daywidth = 1; } elseif ($mode == 'week') { $daysinmonth = 7; $lastday = $day + $daysinmonth - 1; $daywidth = 3; } elseif ($mode == 'day') { $daysinmonth = 1; $lastday = $day; $daywidth = 25; } else { $daysinmonth = date('t', mktime(0, 0, 0, $month, $day, $year)); $lastday = $daysinmonth; $daywidth = 1; } $startdate = mktime(0, 0, 0, $month, $day, $year); $enddate = mktime(23, 59, 59, $month, $lastday, $year); // Get list of user groups $gsql = "SELECT * FROM `{$GLOBALS['dbGroups']}` ORDER BY name"; $gresult = mysql_query($gsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $grouparr[0] = $GLOBALS['strNone']; while ($group = mysql_fetch_object($gresult)) { $grouparr[$group->id] = $group->name; } $numgroups = count($grouparr); $html .= "<table align='center' border='1' cellpadding='0' cellspacing='0' style='border-collapse:collapse; border-color: #AAA; width: 99%;'>"; $usql = "SELECT * FROM `{$GLOBALS['dbUsers']}` WHERE status != " . USERSTATUS_ACCOUNT_DISABLED . " "; if ($groupid == 'allonline') { $usql .= "AND lastseen > {$startofsession} "; } if (is_numeric($groupid)) { $usql .= "AND groupid = {$groupid} "; } elseif ($numgroups > 1) { $usql .= "AND groupid > 0 "; // there is always 1 group (ie. 'none') } if (!empty($user)) { $usql .= "AND id={$user} "; } $usql .= "ORDER BY groupid, realname"; $uresult = mysql_query($usql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $numusers = mysql_num_rows($uresult); $prevgroupid = '000'; if ($numusers > 0) { $hdays = array(); while ($user = mysql_fetch_object($uresult)) { unset($hdays); $hsql = "SELECT *, UNIX_TIMESTAMP(date) AS startdate FROM `{$GLOBALS['dbHolidays']}` WHERE userid={$user->id} AND date BETWEEN '" . date('Y-m-d', $startdate) . "' AND '" . date('Y-m-d', $enddate) . "'"; $hsql .= "AND type != " . HOL_PUBLIC; $hresult = mysql_query($hsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } while ($holiday = mysql_fetch_object($hresult)) { $cday = date('j', mysql2date($holiday->date)); $hdays[$cday] = $holiday->length; $htypes[$cday] = $holiday->type; $happroved[$cday] = $holiday->approved; } // Public holidays $phsql = "SELECT * FROM `{$GLOBALS['dbHolidays']}` WHERE type=" . HOL_PUBLIC . " AND date BETWEEN '" . date('Y-m-d', $startdate) . "' AND '" . date('Y-m-d', $enddate) . "'"; $phresult = mysql_query($phsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } while ($pubhol = mysql_fetch_object($phresult)) { $cday = date('j', mysql2date($pubhol->date)); $pubholdays[$cday] = $pubhol->length; } if ($prevgroupid != $user->groupid) { if ($user->groupid == '') { $user->groupid = 0; } $html .= "<tr>"; $html .= "<td align='left' colspan='2' class='shade2'>{$GLOBALS['strGroup']}: <strong>{$grouparr[$user->groupid]}</strong></td>"; for ($cday = $day; $cday <= $lastday; $cday++) { $shade = 'shade1'; if (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sat') { $shade = 'expired'; $html .= "<td class='{$shade}' style='text-align: center; font-size: 80%; border-left: 1px solid black;'><strong title='Week Number' >wk<br />" . substr(date('W', mktime(0, 0, 0, $month, $cday, $year)) + 1, 0, 1) . "" . substr(date('W', mktime(0, 0, 0, $month, $cday, $year)) + 1, 1, 1) . "</strong></td>"; } elseif (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sun') { $html .= ''; // nothing } else { $html .= "<td align='center' class=\"{$shade}\""; if (mktime(0, 0, 0, $month, $cday, $year) == mktime(0, 0, 0, date('m'), date('d'), date('Y'))) { $html .= " style='background: #FFFF00;' title='Today'"; } $html .= ">"; $html .= substr(ldate('l', gmmktime(0, 0, 0, $month, $cday, $year)), 0, $daywidth) . "<br />"; if ($mode == 'day') { $html .= ldate('dS F Y', gmmktime(0, 0, 0, $month, $cday, $year)); } else { $html .= "<a href='{$_SERVER['PHP_SELF']}?display=day&year={$year}&month={$month}&day={$cday}'>" . date('d', mktime(0, 0, 0, $month, $cday, $year)) . "</a>"; } $html .= "</td>"; } } $html .= "</tr>\n"; } $prevgroupid = $user->groupid; $html .= "<tr><th rowspan='2' style='width: 10%'>{$user->realname}</th>"; // AM $html .= "<td style='width: 2%'>{$GLOBALS['strAM']}</td>"; for ($cday = $day; $cday <= $lastday; $cday++) { $shade = 'shade1'; if (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sat' or date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sun') { // Add day on for a weekend if ($weekend == FALSE) { $displaydays += 1; } $weekend = TRUE; } if (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sat') { $html .= "<td class='expired'> </td>"; } elseif (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sun') { // Do nothing on sundays } else { $weekend = FALSE; if ($hdays[$cday] == 'am' or $hdays[$cday] == 'day') { if ($happroved[$cday] == HOL_APPROVAL_NONE or $happroved[$cday] == HOL_APPROVAL_NONE_ARCHIVED) { $html .= "<td class='review'>"; // Waiting approval } elseif ($htypes[$cday] <= 4 and ($happroved[$cday] == HOL_APPROVAL_GRANTED or $happroved[$cday] == HOL_APPROVAL_GRANTED_ARCHIVED)) { $html .= "<td class='idle'>"; // Approved } elseif ($htypes[$cday] <= 5 and ($happroved[$cday] == HOL_APPROVAL_DENIED or $happroved[$cday] == HOL_APPROVAL_DENIED_ARCHIVED)) { $html .= "<td class='urgent'>"; // Denied } elseif ($htypes[$cday] == HOL_FREE and ($happroved[$cday] == HOL_APPROVAL_GRANTED or $happroved[$cday] == HOL_APPROVAL_GRANTED_ARCHIVED)) { $html .= "<td class='notice'>"; // Approved Free } else { $html .= "<td class='shade2'>"; } if ($user->id == $sit[2]) { $html .= appointment_popup('cancel', $year, $month, $cday, 'am', $group, $user->id); } $html .= "<span title='{$holidaytype[$htypes[$cday]]}'>" . substr($holidaytype[$htypes[$cday]], 0, $daywidth) . "</span>"; // This plugin function takes an optional param with an associative array containing the day $pluginparams = array('plugin_calendar' => $plugin_calendar, 'year' => $year, 'month' => $month, 'day' => $cday, 'useremail' => $user->email); $html .= plugin_do('holiday_chart_day_am', $pluginparams); if ($user->id == $sit[2]) { $html .= "</div>"; } $html .= "</td>"; } else { if ($pubholdays[$cday] == 'am' or $pubholdays[$cday] == 'day') { $html .= "<td class='expired'>PH</td>"; } else { $html .= "<td class='shade2'>"; if ($user->id == $sit[2]) { $html .= appointment_popup('book', $year, $month, $cday, 'am', $group, $user->id); } $html .= ' '; // This plugin function takes an optional param with an associative array containing the day $pluginparams = array('plugin_calendar' => $plugin_calendar, 'year' => $year, 'month' => $month, 'day' => $cday, 'useremail' => $user->email); $html .= plugin_do('holiday_chart_day_am', $pluginparams); if ($user->id == $sit[2]) { $html .= "</div>"; } $html .= "</td>"; } } } } $html .= "</tr>\n"; // PM $html .= "<tr><td>{$GLOBALS['strPM']}</td>"; for ($cday = $day; $cday <= $lastday; $cday++) { $shade = 'shade1'; if (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sat' or date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sun') { // Add day on for a weekend if ($weekend == FALSE) { $displaydays += 1; } $weekend = TRUE; } if (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sat') { $html .= "<td class='expired'> </td>"; } elseif (date('D', mktime(0, 0, 0, $month, $cday, $year)) == 'Sun') { // Do nothing on sundays } else { $weekend = FALSE; if ($hdays[$cday] == 'pm' or $hdays[$cday] == 'day') { if ($happroved[$cday] == HOL_APPROVAL_NONE or $happroved[$cday] == HOL_APPROVAL_NONE_ARCHIVED) { $html .= "<td class='review'>"; // Waiting approval } elseif ($htypes[$cday] <= 4 and ($happroved[$cday] == HOL_APPROVAL_GRANTED or $happroved[$cday] == HOL_APPROVAL_GRANTED_ARCHIVED)) { $html .= "<td class='idle'>"; // Approved } elseif ($htypes[$cday] <= 5 and ($happroved[$cday] == HOL_APPROVAL_DENIED or $happroved[$cday] == HOL_APPROVAL_DENIED_ARCHIVED)) { $html .= "<td class='urgent'>"; // Denied } elseif ($htypes[$cday] == HOL_FREE and ($happroved[$cday] == HOL_APPROVAL_GRANTED or $happroved[$cday] == HOL_APPROVAL_GRANTED_ARCHIVED)) { $html .= "<td class='notice'>"; // Approved Free } else { $html .= "<td class='shade2'>"; } if ($user->id == $sit[2]) { $html .= appointment_popup('cancel', $year, $month, $cday, 'pm', $group, $user->id); } $html .= "<span title='{$holidaytype[$htypes[$cday]]}'>" . substr($holidaytype[$htypes[$cday]], 0, $daywidth) . "</span>"; // This plugin function takes an optional param with an associative array containing the day $pluginparams = array('plugin_calendar' => $plugin_calendar, 'year' => $year, 'month' => $month, 'day' => $cday, 'useremail' => $user->email); $html .= plugin_do('holiday_chart_day_pm', $pluginparams); if ($user->id == $sit[2]) { $html .= "</div>"; } $html .= "</td>"; } else { if ($pubholdays[$cday] == 'pm' or $pubholdays[$cday] == 'day') { $html .= "<td class='expired'>PH</td>"; } else { $html .= "<td class='shade2'>"; if ($user->id == $sit[2]) { $html .= appointment_popup('book', $year, $month, $cday, 'pm', $group, $user->id); } $html .= ' '; // This plugin function takes an optional param with an associative array containing the day $pluginparams = array('plugin_calendar' => $plugin_calendar, 'year' => $year, 'month' => $month, 'day' => $cday, 'useremail' => $user->email); $html .= plugin_do('holiday_chart_day_pm', $pluginparams); if ($user->id == $sit[2]) { $html .= "</div>"; } $html .= "</td>"; } } } } $html .= "</tr>\n"; $html .= "<tr><td colspan='0'></td></tr>\n"; } } else { if ($numgroups < 1) { $html .= "<p class='info'>{$GLOBALS['strNothingToDisplay']}</p>"; } else { $html .= "<p class='info'>{$GLOBALS['strNothingToDisplay']}, {$strCheckUserGroupMembership}.</p>"; } } $html .= "</table>\n\n"; // Legend $html .= "<table align='center'><tr><td><strong>{$GLOBALS['strKey']}</strong>:</td>"; foreach ($GLOBALS['holidaytype'] as $htype) { $html .= "<td>" . utf8_substr($htype, 0, 1) . " = {$htype}</td>"; } $html .= "<td>PH = {$GLOBALS['strPublicHoliday']}</td>"; $html .= "</tr>"; $html .= "<tr><td></td><td class='urgent'>{$GLOBALS['strDeclined']}</td>"; $html .= "<td class='review'>{$GLOBALS['strNotApproved']}</td>"; $html .= "<td class='idle'>{$GLOBALS['strApproved']}</td>"; $html .= "<td class='notice'>{$GLOBALS['strApprovedFree']}</td></tr>"; $html .= "</table>\n\n"; return $html; }
$sql = "INSERT INTO `{$dbKBSoftware}` (docid,softwareid) VALUES ('{$docid}', '{$softwareid}')"; mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } journal(CFG_LOGGING_NORMAL, 'KB Article Added', "KB Article {$docid} was added", CFG_JOURNAL_KB, $docid); } //html_redirect("incident_details.php?id={$id}", TRUE, "Knowledge Base Article {$CONFIG['kb_id_prefix']}{$docid} created"); plugin_do('incident_closing'); echo "<html>"; echo "<head></head>"; echo "<body onload=\"close_page_redirect('incident_details.php?id={$id}');\">"; echo "</body>"; echo "</html>"; } else { plugin_do('incident_closing'); echo "<html>"; echo "<head></head>"; echo "<body onload=\"close_page_redirect('incident_details.php?id={$id}');\">"; echo "</body>"; echo "</html>"; } } else { include APPLICATION_INCPATH . 'incident_html_top.inc.php'; echo $addition_errors_string; include APPLICATION_INCPATH . 'incident_html_bottom.inc.php'; } } else { include APPLICATION_INCPATH . 'incident_html_top.inc.php'; echo $error_string; include APPLICATION_INCPATH . 'incident_html_bottom.inc.php';
$_SESSION['num_update_view'] = $user->num_updates_view; $_SESSION['lang'] = $user->i18n; $_SESSION['utcoffset'] = $user->utc_offset; } if ($result === FALSE) { include APPLICATION_INCPATH . 'htmlheader.inc.php'; trigger_error("!Error while updating users table", E_USER_WARNING); include APPLICATION_INCPATH . 'htmlfooter.inc.php'; exit; } elseif ($result === TRUE) { if ($edituserid == $sit[2]) { $redirecturl = 'index.php'; } else { $redirecturl = 'manage_users.php'; } plugin_do('save_profile_form'); // password was not changed if (isset($confirm_message)) { html_redirect($redirecturl, TRUE, $confirm_message); } else { html_redirect($redirecturl); } exit; } else { $errors++; $error_string .= $result; } } if ($errors > 0) { html_redirect($redirecturl, FALSE, $error_string); }
exit; } // Display planner chart echo "<h2>{$strMonthView}</h2>"; $nextyear = $year; if ($month < 12) { $nextmonth = $month + 1; } else { $nextmonth = 1; $nextyear = $year + 1; } $prevyear = $year; if ($month > 1) { $prevmonth = $month - 1; } else { $prevmonth = 12; $prevyear = $year - 1; } $plugin_calendar = plugin_do('holiday_chart_cal'); echo month_select($month, $year, $gidurl); echo "<p align='center'><a href='{$_SERVER['PHP_SELF']}?month={$prevmonth}&"; echo "year={$prevyear}{$gidurl}' title='Previous Month'><</a> "; echo ldate('F Y', mktime(0, 0, 0, $month, 1, $year)); echo " <a href='{$_SERVER['PHP_SELF']}?month={$nextmonth}&year={$nextyear}{$gidurl}' "; echo "title='Next Month'>></a></p>"; // echo draw_chart('month', $year, $month, $day, '', $user); $numgroups = group_selector($groupid, "display={$display}&year={$year}&month={$month}&day={$day}"); if ($groupid == 'all') { $groupid = ''; } echo draw_chart('month', $year, $month, $day, $groupid, $user);
} // Don't send email when approving 'all' to avoid an error message if ($user != 'all') { $bodytext = "Message from {$CONFIG['application_shortname']}: " . user_realname($sit[2]) . " has "; if ($approve == 'FALSE') { $bodytext .= "rejected"; } else { $bodytext .= "approved"; } $bodytext .= " your request for "; if ($startdate == 'all') { $bodytext .= "all days requested\n\n"; } else { $bodytext .= "the "; $bodytext .= date('l j F Y', mysql2date($startdate)); $bodytext .= "\n"; } $email_from = user_email($sit[2]); $email_to = user_email($user); $email_subject = "Re: {$CONFIG['application_shortname']}: Holiday Approval Request"; $rtnvalue = send_email($email_to, $email_from, $email_subject, $bodytext); // FIXME this should use triggers } //if ($rtnvalue===TRUE) echo "<p align='center'>".user_realname($user)." has been notified of your decision</p>"; //else echo "<p class='error'>There was a problem sending your notification</p>"; plugin_do('holiday_ack'); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } header("Location: holiday_request.php?user={$view}&mode=approval"); exit;
replace_tags(3, $site, $tags); if (isset($licenserx)) { $licenserx = '1'; } else { $licenserx = '0'; } // update site if ($active == 'true') { $activeStr = 'true'; } else { $activeStr = 'false'; } $sql = "UPDATE `{$dbSites}` SET name='{$name}', department='{$department}', address1='{$address1}', address2='{$address2}', city='{$city}', "; $sql .= "county='{$county}', postcode='{$postcode}', country='{$country}', telephone='{$telephone}', fax='{$fax}', email='{$email}', "; $sql .= "websiteurl='{$websiteurl}', notes='{$notes}', typeid='{$typeid}', owner='{$owner}', freesupport='{$incident_quantity}', active='{$activeStr}' WHERE id='{$site}' LIMIT 1"; // licenserx='$licenserx' $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } else { plugin_do('edit_site_save'); journal(CFG_LOGGING_NORMAL, $strSiteEdited, sprintf($strSiteXEdited, $site), CFG_JOURNAL_SITES, $site); html_redirect($_SERVER['PHP_SELF']); exit; } } else { echo $errors_string; } } echo show_edit_site($site, 'external'); include APPLICATION_INCPATH . 'htmlfooter.inc.php';
$billableunits = billable_units_site($siterow['id'], $now - 2678400); // Last 31 days if ($billableunits > 0) { echo "<tr><th>" . sprintf($strUnitsUsedLastXdays, 31) . ":</th><td>{$billableunits}</td></tr>"; // More appropriate label } echo "<tr><th>{$strIncidentPool}:</th><td>" . sprintf($strRemaining, $siterow['freesupport']) . "</td></tr>"; echo "<tr><th>{$strSalesperson}:</th><td>"; if ($siterow['owner'] >= 1) { echo user_realname($siterow['owner'], TRUE); } else { echo $strNotSet; } echo "</td></tr>\n"; } plugin_do('site_details'); mysql_free_result($siteresult); echo "</table>\n"; echo "<p align='center'><a href='site_edit.php?action=edit&site={$id}'>{$strEdit}</a> | "; echo "<a href='site_delete.php?id={$id}'>{$strDelete}</a>"; echo "</p>"; // Display Contacts echo "<h3>{$strContacts}</h3>"; // List Contacts $sql = "SELECT * FROM `{$dbContacts}` WHERE siteid='{$id}' ORDER BY active, surname, forenames"; $contactresult = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $countcontacts = mysql_num_rows($contactresult); if ($countcontacts > 0) {
if (!is_array($hmenu[60])) { $hmenu[60] = array(); } $hmenu[60] = $hmenu[60] + array(10 => array('perm' => 37, 'name' => "{$strMarketingMailshot}", 'url' => "{$CONFIG['application_webpath']}report_marketing.php"), 20 => array('perm' => 37, 'name' => "{$strCustomerExport}", 'url' => "{$CONFIG['application_webpath']}report_customers.php"), 30 => array('perm' => 37, 'name' => "{$strQueryByExample}", 'url' => "{$CONFIG['application_webpath']}report_qbe.php"), 35 => array('perm' => 37, 'name' => "{$strIncidents}", 'url' => "", 'submenu' => '6050'), 60 => array('perm' => 37, 'name' => "{$strSiteProducts}", 'url' => "{$CONFIG['application_webpath']}report_customer_products.php"), 61 => array('perm' => 37, 'name' => "{$strSiteProductsMatrix}", 'url' => "{$CONFIG['application_webpath']}report_customer_products_matrix.php"), 65 => array('perm' => 37, 'name' => "{$strCountContractsByProduct}", 'url' => "{$CONFIG['application_webpath']}report_contracts_by_product.php"), 70 => array('perm' => 37, 'name' => "{$strSiteContracts}", 'url' => "{$CONFIG['application_webpath']}report_customer_contracts.php"), 80 => array('perm' => 37, 'name' => "{$strCustomerFeedback}", 'url' => "{$CONFIG['application_webpath']}report_feedback.php", 'enablevar' => 'feedback_enabled'), 180 => array('perm' => 37, 'name' => "{$strEngineerUtilisation}", 'url' => "{$CONFIG['application_webpath']}report_billable_engineer_utilisation.php")); // Reports: Incidents submenu if (!is_array($hmenu[6050])) { $hmenu[6050] = array(); } $hmenu[6050] = $hmenu[6050] + array(10 => array('perm' => 37, 'name' => "{$strIncidentsBySite}", 'url' => "{$CONFIG['application_webpath']}report_incidents_by_site.php"), 20 => array('perm' => 37, 'name' => "{$strIncidentsByEngineer}", 'url' => "{$CONFIG['application_webpath']}report_incidents_by_engineer.php"), 30 => array('perm' => 37, 'name' => "{$strSiteIncidents}", 'url' => "{$CONFIG['application_webpath']}report_incidents_by_customer.php"), 40 => array('perm' => 37, 'name' => "{$strRecentIncidents}", 'url' => "{$CONFIG['application_webpath']}report_incidents_recent.php"), 50 => array('perm' => 37, 'name' => "{$strIncidentsLoggedOpenClosed}", 'url' => "{$CONFIG['application_webpath']}report_incidents_graph.php"), 60 => array('perm' => 37, 'name' => "{$strAverageIncidentDuration}", 'url' => "{$CONFIG['application_webpath']}report_incidents_average_duration.php"), 70 => array('perm' => 37, 'name' => "{$strIncidentsBySkill}", 'url' => "{$CONFIG['application_webpath']}report_incidents_by_skill.php"), 80 => array('perm' => 37, 'name' => "{$strIncidentsByVendor}", 'url' => "{$CONFIG['application_webpath']}report_incidents_by_vendor.php"), 90 => array('perm' => 37, 'name' => "{$strEscalatedIncidents}", 'url' => "{$CONFIG['application_webpath']}report_incidents_escalated.php"), 100 => array('perm' => 37, 'name' => "{$strBillableIncidents}", 'url' => "{$CONFIG['application_webpath']}report_incidents_billable.php"), 110 => array('perm' => 37, 'name' => "{$strIncidentsDailySummary}", 'url' => "{$CONFIG['application_webpath']}report_incidents_daily_summary.php")); // Help menu if (!is_array($hmenu[70])) { $hmenu[70] = array(); } $hmenu[70] + ($hmenu[70] = array(10 => array('perm' => 0, 'name' => "{$strHelpContents}...", 'url' => "{$CONFIG['application_webpath']}help.php"), 15 => array('perm' => 0, 'name' => "{$strGetHelpOnline}", 'url' => "http://sitracker.org/wiki/Documentation" . strtoupper(substr($_SESSION['lang'], 0, 2))), 20 => array('perm' => 0, 'name' => "{$strTranslate}", 'url' => "{$CONFIG['application_webpath']}translate.php"), 30 => array('perm' => 0, 'name' => "{$strReportBug}", 'url' => $CONFIG['bugtracker_url']), 40 => array('perm' => 0, 'name' => "{$strReleaseNotes}", 'url' => "{$CONFIG['application_webpath']}releasenotes.php"), 50 => array('perm' => 41, 'name' => $strHelpAbout, 'url' => "{$CONFIG['application_webpath']}about.php"))); if ($_SESSION['auth'] == TRUE and function_exists('plugin_do')) { plugin_do('define_menu'); } // Sort the top level menu, so that plugin menus appear in the right place ksort($hmenu[0], SORT_NUMERIC); // // Non specific update types // $updatetypes['actionplan'] = array('icon' => 'actionplan', 'text' => sprintf($strActionPlanBy, 'updateuser')); $updatetypes['auto'] = array('icon' => 'auto', 'text' => sprintf($strUpdatedAutomaticallyBy, 'updateuser')); $updatetypes['closing'] = array('icon' => 'close', 'text' => sprintf($strMarkedforclosureby, 'updateuser')); $updatetypes['editing'] = array('icon' => 'edit', 'text' => sprintf($strEditedBy, 'updateuser')); $updatetypes['email'] = array('icon' => 'emailout', 'text' => sprintf($strEmailsentby, 'updateuser')); $updatetypes['emailin'] = array('icon' => 'emailin', 'text' => sprintf($strEmailreceivedby, 'updateuser')); $updatetypes['emailout'] = array('icon' => 'emailout', 'text' => sprintf($strEmailsentby, 'updateuser')); $updatetypes['externalinfo'] = array('icon' => 'externalinfo', 'text' => sprintf($strExternalInfoAddedBy, 'updateuser')); $updatetypes['probdef'] = array('icon' => 'probdef', 'text' => sprintf($strProblemDefinitionby, 'updateuser'));
echo "<tr><td><a href='edit_user_skills.php'>{$strMySkills}</a></td></tr>"; echo "<tr><td><a href='edit_backup_users.php'>{$strMySubstitutes}</a></td></tr>"; echo "<tr><td><a href='holidays.php'>{$strMyHolidays}</a></td></tr>"; echo "</tbody>\n"; if (user_permission($sit[2], 42)) { echo "<thead><tr><th>{$strTechnicalSupportAdmin}</th></tr></thead>"; echo "<tbody><tr><td><a href='holding_queue.php'>{$strHoldingQueue}</a></td></tr></tbody>"; } if (user_permission($sit[2], 44)) { echo "<thead><tr><th>{$strFiles}</th></tr></thead>"; echo "<tbody><tr><td><a href='ftp_list_files.php'>{$strManageFTPFiles}</a></td></tr></tbody>"; } if (user_permission($sit[2], 50)) { echo "<thead><tr><th>{$strManageUsers}</th></tr></thead>"; echo "<tbody><tr><td><a href='holiday_request.php?user=all&mode=approval'>{$strApproveHolidays}</a></td></tr></tbody>"; } if (user_permission($sit[2], 22)) { echo "<thead><tr><th>{$strAdministratorsOnly}</th></tr></thead>"; echo "<tbody>"; echo "<tr><td><a href='manage_users.php'>{$strManageUsers}</a></td></tr>"; echo "<tr><td><a href='templates.php'>{$strManageEmailTemplates}</a></td></tr>"; echo "<tr><td><a href='journal.php'>{$strBrowse} {$CONFIG['application_shortname']} {$strJournal}</a></td></tr>"; echo "<tr><td><a href='service_levels.php'>{$strServiceLevels}</a></td></tr>"; echo "<tr><td><a href='product_info_add.php?action=showform'>{$strAddProductInformation}</a></td></tr>"; echo "<tr><td><a href='calendar.php?type=10&display=year'>{$strSetPublicHolidays}</a></td></tr>"; echo "<tr><td><a href='contacts_show_orphans.php'>{$strShowOrphandedContacts}</a></td></tr>"; echo "</tbody>"; } plugin_do('cp_menu'); echo "</table>\n"; include APPLICATION_INCPATH . 'htmlfooter.inc.php';
$status = mysql_fetch_object($result); $status = $status->status; $owner = incident_owner($id); $bodytext = $header . $bodytext; $bodytext = mysql_real_escape_string($bodytext); $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp) "; $sql .= "VALUES ('{$id}', '{$sit[2]}', 'editing', '{$owner}', '{$status}', '{$bodytext}', '{$now}')"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } if (!$result) { $addition_errors = 1; $addition_errors_string .= "<p class='error'>Addition of incident update failed</p>\n"; } plugin_do('incident_edited'); } if ($addition_errors == 0) { journal(CFG_LOGGING_NORMAL, 'Incident Edited', "Incident {$id} was edited", CFG_JOURNAL_INCIDENTS, $id); html_redirect("incident_details.php?id={$id}"); } else { include APPLICATION_INCPATH . 'incident_html_top.inc.php'; echo $addition_errors_string; include APPLICATION_INCPATH . 'incident_html_bottom.inc.php'; } } else { include APPLICATION_INCPATH . 'incident_html_top.inc.php'; echo $error_string; include APPLICATION_INCPATH . 'incident_html_bottom.inc.php'; } }
$str .= "<td>{$CONFIG['currency_symbol']}" . number_format($sitetotalawaitingapproval, 2) . "</td><td></td></tr>"; $str .= "</table></form>"; echo "<h3>{$sitename}</h3>"; if ($used) { if ($output == 'html') { echo $str; if ($unapprovable) { echo "<p align='center'>{$strUnapprovableBilledIncidentsDesc}</p>"; } } } else { echo "<p align='center'>{$strNoInicdentsToApprove}</p>"; } } } plugin_do('billing_approve_form'); if ($output == 'html') { echo "<p align='center'><a href='{$_SERVER['HTTP_REFERER']}'>{$strReturnToPreviousPage}</a></p>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; } } elseif ($mode == 'invoicepage') { if ($output == 'html') { include APPLICATION_INCPATH . 'htmlheader.inc.php'; $str .= "<h2>{$strBillableIncidents} - INVOICE</h2>"; $resultsite = mysql_query($sitelistsql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $multipliers = get_all_available_multipliers(); if (mysql_num_rows($resultsite) > 0) { while ($objsite = mysql_fetch_object($resultsite)) {
} } } else { $success = TRUE; } return $success; } // ======================================================================================= $actions = schedule_actions_due(); if ($actions !== FALSE) { foreach ($actions as $action => $params) { $fn = "saction_{$action}"; if ($verbose) { echo "<strong>{$fn}()</strong> "; } // Possibly initiate a trigger here named TRIGGER_SCHED_{$action} ? if (function_exists($fn)) { $success = $fn($params); schedule_action_done($action, $success); } else { schedule_action_done($action, FALSE); } if ($success && $verbose) { echo "TRUE<br />"; } elseif ($verbose) { echo "FALSE<br />"; } } } plugin_do('automata');
echo "<tr><th>{$strSubject}</th><td><input maxlength='255' "; echo "name='subjectfield' id='subjectfield' size='40' value=\"{$subject}\" /></td></tr>\n"; echo "<tr><th>{$strAttachment}"; $file_size = readable_file_size($CONFIG['upload_max_filesize']); echo "(< {$file_size})"; echo "</th><td>"; echo "<input type='hidden' name='MAX_FILE_SIZE' value='{$CONFIG['upload_max_filesize']}' />"; echo "<input type='file' name='attachment' size='40' maxfilesize='{$CONFIG['upload_max_filesize']}' />"; echo "</td></tr>"; echo "<tr><th>{$strMessage}</th><td>"; echo "<textarea name='bodytext' id='bodytext' rows='20' cols='65'>"; echo $body; echo "</textarea>"; echo "<div id='updatestr'><a href='javascript:save_content();'>" . icon('save', 16, $strSaveDraft) . "</a></div>"; echo "</td></tr>"; plugin_do('incident_email_form2'); echo "</table>"; echo "<p align='center'>"; echo "<input name='newincidentstatus' id='newincidentstatus' type='hidden' value='{$newincidentstatus}' />"; echo "<input name='timetonextaction_none' id='timetonextaction_none' type='hidden' value='{$timetonextaction_none}' />"; echo "<input name='timetonextaction_days' id='timetonextaction_days' type='hidden' value='{$timetonextaction_days}' />"; echo "<input name='timetonextaction_hours' id='timetonextaction_hours' type='hidden' value='{$timetonextaction_hours}' />"; echo "<input name='timetonextaction_minutes' id='timetonextaction_minutes' type='hidden' value='{$timetonextaction_minutes}' />"; echo "<input name='chase_customer' id='chase_customer' type='hidden' value='{$chase_customer}' />"; echo "<input name='chase_manager' id='chase_manager' type='hidden' value='{$chase_manager}' />"; echo "<input name='date' id='date' type='hidden' value='{$date}' />"; echo "<input name='timeoffset' id='timeoffset' type='hidden' value='{$timeoffset}' />"; echo "<input name='target' id='target' type='hidden' value='{$target}' />"; echo "<input type='hidden' id='step' name='step' value='3' />"; echo "<input type='hidden' id='emailtype' name='emailtype' value='{$emailtype}' />"; echo "<input type='hidden' id='draftid' name='draftid' value='{$draftid}' />";
/** * @author Paul Heaney */ function give_overview() { global $todayrecent, $mode, $CONFIG; echo "<table align='center'>"; echo "<tr><th>{$GLOBALS['strPeriod']}</th>"; echo "<th>{$GLOBALS['strOpened']}</th><th>{$GLOBALS['strUpdated']}</th>"; echo "<th>{$GLOBALS['strClosed']}</th><th>{$GLOBALS['strHandled']}</th>"; echo "<th>{$GLOBALS['strUpdates']}</th><th>{$GLOBALS['strPerIncident']}</th><th>{$GLOBALS['strSkills']}</th>"; echo "<th>{$GLOBALS['strOwners']}</th><th>{$GLOBALS['strUsers']}</th>"; echo "<th>{$GLOBALS['strPerUser']}</th><th>{$GLOBALS['strIncidentPerOwnerAbbrev']}</th><th>{$GLOBALS['strEmailReceivedAbbrev']}</th>"; echo "<th>{$GLOBALS['strEmailTransmittedAbbrev']}</th><th>{$GLOBALS['strHigherPriority']}</th>"; echo "<th>{$GLOBALS['strActivity']}</th></tr>\n"; echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=0'>{$GLOBALS['strToday']}</a>", mktime(0, 0, 0, date('m'), date('d'), date('Y')), mktime(23, 59, 59, date('m'), date('d'), date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=1'>{$GLOBALS['strYesterday']}</a>", mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 1, date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=2'>" . ldate('l', mktime(0, 0, 0, date('m'), date('d') - 2, date('Y'))) . "</a>", mktime(0, 0, 0, date('m'), date('d') - 2, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 2, date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=3'>" . ldate('l', mktime(0, 0, 0, date('m'), date('d') - 3, date('Y'))) . "</a>", mktime(0, 0, 0, date('m'), date('d') - 3, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 3, date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=4'>" . ldate('l', mktime(0, 0, 0, date('m'), date('d') - 4, date('Y'))) . "</a>", mktime(0, 0, 0, date('m'), date('d') - 4, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 4, date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=5'>" . ldate('l', mktime(0, 0, 0, date('m'), date('d') - 5, date('Y'))) . "</a>", mktime(0, 0, 0, date('m'), date('d') - 5, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 5, date('Y'))); echo stats_period_row("<a href='{$_SERVER['PHP_SELF']}?mode=daybreakdown&offset=6'>" . ldate('l', mktime(0, 0, 0, date('m'), date('d') - 6, date('Y'))) . "</a>", mktime(0, 0, 0, date('m'), date('d') - 6, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 6, date('Y'))); echo "<tr><td colspan='*'></td></tr>"; echo stats_period_row($GLOBALS['strThisWeek'], mktime(0, 0, 0, date('m'), date('d') - 6, date('Y')), mktime(23, 59, 59, date('m'), date('d'), date('Y'))); echo stats_period_row($GLOBALS['strLastWeek'], mktime(0, 0, 0, date('m'), date('d') - 13, date('Y')), mktime(23, 59, 59, date('m'), date('d') - 7, date('Y'))); echo "<tr><td colspan='*'></td></tr>"; if ($mode == 'detail') { echo stats_period_row($GLOBALS['strThisMonth'], mktime(0, 0, 0, date('m'), 1, date('Y')), mktime(23, 59, 59, date('m'), date('d'), date('Y'))); echo stats_period_row($GLOBALS['strLastMonth'], mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')), mktime(23, 59, 59, date('m'), 0, date('Y'))); echo stats_period_row(date('F y', mktime(0, 0, 0, date('m') - 2, 1, date('Y'))), mktime(0, 0, 0, date('m') - 2, date('d'), date('Y')), mktime(23, 59, 59, date('m') - 1, 0, date('Y'))); echo stats_period_row(date('F y', mktime(0, 0, 0, date('m') - 3, 1, date('Y'))), mktime(0, 0, 0, date('m') - 3, date('d'), date('Y')), mktime(23, 59, 59, date('m') - 2, 0, date('Y'))); echo stats_period_row(date('F y', mktime(0, 0, 0, date('m') - 4, 1, date('Y'))), mktime(0, 0, 0, date('m') - 4, date('d'), date('Y')), mktime(23, 59, 59, date('m') - 3, 0, date('Y'))); echo stats_period_row(date('F y', mktime(0, 0, 0, date('m') - 5, 1, date('Y'))), mktime(0, 0, 0, date('m') - 5, date('d'), date('Y')), mktime(23, 59, 59, date('m') - 4, 0, date('Y'))); echo stats_period_row(date('F y', mktime(0, 0, 0, date('m') - 6, 1, date('Y'))), mktime(0, 0, 0, date('m') - 6, date('d'), date('Y')), mktime(23, 59, 59, date('m') - 5, 0, date('Y'))); echo "<tr><td colspan='*'></td></tr>"; echo stats_period_row($GLOBALS['strThisYear'], mktime(0, 0, 0, 1, 1, date('Y')), mktime(23, 59, 59, date('m'), date('d'), date('Y'))); echo stats_period_row($GLOBALS['strLastYear'], mktime(0, 0, 0, 1, 1, date('Y') - 1), mktime(23, 59, 59, 12, 31, date('Y') - 1)); echo stats_period_row(date('Y', mktime(0, 0, 0, 1, 1, date('Y') - 2)), mktime(0, 0, 0, 1, 1, date('Y') - 2), mktime(23, 59, 59, 12, 31, date('Y') - 2)); echo stats_period_row(date('Y', mktime(0, 0, 0, 1, 1, date('Y') - 3)), mktime(0, 0, 0, 1, 1, date('Y') - 3), mktime(23, 59, 59, 12, 31, date('Y') - 3)); echo stats_period_row(date('Y', mktime(0, 0, 0, 1, 1, date('Y') - 4)), mktime(0, 0, 0, 1, 1, date('Y') - 4), mktime(23, 59, 59, 12, 31, date('Y') - 4)); echo stats_period_row(date('Y', mktime(0, 0, 0, 1, 1, date('Y') - 5)), mktime(0, 0, 0, 1, 1, date('Y') - 5), mktime(23, 59, 59, 12, 31, date('Y') - 5)); } echo "</table>\n"; echo "<br />\n"; $sql = "SELECT DISTINCT g.id AS groupid, g.name FROM `{$GLOBALS['dbGroups']}` AS g "; //$sql .= "WHERE (incidents.status != 2 AND incidents.status != 7) AND incidents.owner = users.id AND users.groupid = groups.id ORDER BY groups.id"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) > 1) { echo "<h2>{$GLOBALS['strByGroup']}</h2><table class='vertical' align='center'>"; while ($groups = mysql_fetch_object($result)) { $sqlGroups = "SELECT COUNT(i.id) AS count, istatus.name "; $sqlGroups .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbIncidentStatus']}` AS istatus, `{$GLOBALS['dbUsers']}` AS u, `{$GLOBALS['dbGroups']}` AS g "; $sqlGroups .= "WHERE i.status = istatus.id AND closed = 0 AND i.owner = u.id "; $sqlGroups .= "AND u.groupid = {$groups->groupid} "; $sqlGroups .= "GROUP BY i.status"; $resultGroups = mysql_query($sqlGroups); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } if (mysql_num_rows($resultGroups) > 0) { $openCallsGroup = 0; echo "<td style='vertical-align:top' align='center'><strong>{$groups->name}</strong>"; echo "<table class='vertical' align='center'>"; while ($rowGroup = mysql_fetch_object($resultGroups)) { echo "<tr><th>{$GLOBALS[$rowGroup->name]}</th><td class='shade2' align='left'>"; //FIXME - HACK, no idea why this is needed $amount = round($rowGroup->count / 8); echo "{$amount}</td></tr>"; //if (strpos(strtolower($rowGroup['name']), "clos") === false) //{ $openCallsGroup += $amount; //} } echo "<tr><th>{$GLOBALS['strTotalOpen']}</th>"; echo "<td class='shade2' align='left'><strong>{$openCallsGroup}</strong></td></tr></table></td>"; } } echo "</table>"; } plugin_do('statistics_table_overview'); echo "</table>"; mysql_free_result($result); //count incidents by Vendor /* $sql = "SELECT DISTINCT products.vendorid, vendors.name FROM incidents, products, vendors "; $sql .= "WHERE (status != 2 AND status != 7) AND incidents.product = products.id AND vendors.id = products.vendorid ORDER BY vendorid"; */ $sql = "SELECT DISTINCT s.vendorid, v.name FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbSoftware']}` AS s, `{$GLOBALS['dbVendors']}` AS v "; $sql .= "WHERE (status != 2 AND status != 7) AND i.softwareid = s.id AND v.id = s.vendorid ORDER BY vendorid"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) > 1) { echo "<h2>{$GLOBALS['strByVendor']}</h2><table class='vertical' align='center'>"; while ($vendors = mysql_fetch_array($result)) { // This should use the software and relate to the product and then to the vendor /* $sqlVendor = "SELECT COUNT(incidents.id), incidentstatus.name FROM incidents, incidentstatus, products "; $sqlVendor .= "WHERE incidents.status = incidentstatus.id AND closed = 0 AND incidents.product = products.id "; $sqlVendor .= "AND products.vendorid = ".$vendors['vendorid']." "; $sqlVendor .= "GROUP BY incidents.status"; */ $sqlVendor = "SELECT COUNT(i.id) AS count, istatus.name FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbIncidentStatus']}` AS istatus, `{$GLOBALS['dbSoftware']}` AS s "; $sqlVendor .= "WHERE i.status = istatus.id AND closed = 0 AND i.softwareid = s.id "; $sqlVendor .= "AND s.vendorid = {$vendors['vendorid']} "; $sqlVendor .= "GROUP BY i.status"; $resultVendor = mysql_query($sqlVendor); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } if (mysql_num_rows($resultVendor) > 0) { $openCallsVendor = 0; echo "<td style='vertical-align:top' align='center'><strong>{$vendors['name']}</strong>"; echo "<table class='vertical' align='center'>"; while ($rowVendor = mysql_fetch_object($resultVendor)) { echo "<tr><th>{$GLOBALS[$rowVendor->name]}</th><td class='shade2' align='left'>"; echo "{$rowVendor->count}</td></tr>"; if (strpos(strtolower($rowVendor->name), "clos") === false) { $openCallsVendor += $rowVendor->count; } } echo "<tr><th>{$GLOBALS['strTotalOpen']}</th>"; echo "<td class='shade2' align='left'><strong>{$openCallsVendor}</strong></td></tr></table></td>"; } } echo "</table>"; } // Count incidents logged today $sql = "SELECT id FROM `{$GLOBALS['dbIncidents']}` WHERE opened > '{$todayrecent}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $todaysincidents = mysql_num_rows($result); mysql_free_result($result); $string = "<h4>" . sprintf($GLOBALS['strIncidentsLoggedToday'], $todaysincidents) . "</h4>"; if ($todaysincidents > 0) { $string .= "<table align='center' width='50%'><tr><td colspan='2'>{$GLOBALS['strAssignedAsFollows']}</td></tr>"; $sql = "SELECT COUNT(i.id) AS count, realname, u.id AS owner FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbUsers']}` AS u WHERE opened > '{$todayrecent}' AND i.owner = u.id GROUP BY owner DESC"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } while ($row = mysql_fetch_object($result)) { $sql = "SELECT id, title FROM `{$GLOBALS['dbIncidents']}` WHERE opened > '{$todayrecent}' AND owner = '{$row->owner}'"; $string .= "<tr><th>{$row->count}</th>"; $string .= "<td class='shade2' align='left'>"; $string .= "<a href='incidents.php?user={$row->owner}&queue=1&type=support'>{$row->realname}</a> "; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } while ($irow = mysql_fetch_object($iresult)) { $string .= "<small><a href=\"javascript:incident_details_window('{$irow->id}', 'incident{$irow->id}')\" title='{$irow->title}'>[{$irow->id}]</a></small> "; } $string .= "</td></tr>"; } $string .= "</table>"; } // Count incidents closed today $sql = "SELECT COUNT(id) FROM `{$GLOBALS['dbIncidents']}` WHERE closed > '{$todayrecent}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } list($todaysclosed) = mysql_fetch_row($result); $string .= "<h4>" . sprintf($GLOBALS['strIncidentsClosedToday'], $todaysclosed) . "</h4>"; if ($todaysclosed > 0) { $sql = "SELECT COUNT(i.id) AS count, realname, u.id AS owner FROM `{$GLOBALS['dbIncidents']}` AS i "; $sql .= "LEFT JOIN `{$GLOBALS['dbUsers']}` AS u ON i.owner = u.id WHERE closed > '{$todayrecent}' "; $sql .= "GROUP BY owner"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $string .= "<table align='center' width='50%'>"; $string .= "<tr><th>{$GLOBALS['strID']}</th><th>{$GLOBALS['strTitle']}</th>"; $string .= "<th>{$GLOBALS['strOwner']}</th><th>{$GLOBALS['strClosingStatus']}</th></tr>\n"; while ($row = mysql_fetch_object($result)) { $string .= "<tr><th colspan='4' align='left'>{$row->count} {$GLOBALS['strClosedBy']} {$row->realname}</th></tr>\n"; $sql = "SELECT i.id, i.title, cs.name "; $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbClosingStatus']}` AS cs "; $sql .= "WHERE i.closingstatus = cs.id AND closed > '{$todayrecent}' "; $sql .= "AND i.owner = '{$row->owner}' "; $sql .= "ORDER BY closed"; $iresult = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } while ($irow = mysql_fetch_object($iresult)) { $string .= "<tr><th><a href=\"javascript:incident_details_window('{$irow->id}', 'incident{$irow->id}')\" title='[{$irow->id}] - {$irow->title}'>{$irow->id}</a></th>"; $string .= "<td class='shade2' align='left'>{$irow->title}</td>"; $string .= "<td class='shade2' align='left'>{$row->realname}</td>"; $string .= "<td class='shade2'>{$GLOBALS[$irow->name]}</td></tr>\n"; } } $string .= "</table>\n\n"; } mysql_free_result($result); $totalresult = 0; $numquestions = 0; $qsql = "SELECT * FROM `{$GLOBALS['dbFeedbackQuestions']}` WHERE formid='1' AND type='rating' ORDER BY taborder"; $qresult = mysql_query($qsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($qresult) >= 1) { $string .= "<h2>{$GLOBALS['strCustomerFeedback']}</h2>"; $string .= "<table align='center' class='vertical'>"; while ($qrow = mysql_fetch_object($qresult)) { $numquestions++; $string .= "<tr><th>Q{$qrow->taborder}: {$qrow->question}</th>"; $sql = "SELECT * FROM `{$GLOBALS['dbFeedbackRespondents']}` AS fr, `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbUsers']}` AS u, `{$GLOBALS['dbFeedbackResults']}` AS fres "; $sql .= "WHERE fr.incidentid=i.id "; $sql .= "AND i.owner=u.id "; $sql .= "AND fr.id=fres.respondentid "; $sql .= "AND fres.questionid='{$qrow->id}' "; $sql .= "AND fr.completed = 'yes' \n"; $sql .= "ORDER BY i.owner, i.id"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $numsurveys = mysql_num_rows($result); $numresults = 0; $cumul = 0; $percent = 0; $average = 0; while ($row = mysql_fetch_object($result)) { if (!empty($row->result)) { $cumul += $row->result; $numresults++; } } if ($numresults > 0) { $average = number_format($cumul / $numresults, 2); } $percent = number_format(($average - 1) * (100 / ($CONFIG['feedback_max_score'] - 1)), 0); $totalresult += $average; $string .= "<td>{$average}</td></tr>"; // <strong>({$percent}%)</strong><br />"; } $string .= "</table>\n"; $total_average = number_format($totalresult / $numquestions, 2); $total_percent = number_format(($total_average - 1) * (100 / ($CONFIG['feedback_max_score'] - 1)), 0); if ($total_percent < 0) { $total_percent = 0; } $string .= "<p align='center'>{$GLOBALS['strPositivity']}: {$total_average} <strong>({$total_percent}%)</strong> "; $string .= "From {$numsurveys} results</p>"; $surveys += $numresults; } return $string; }
/** * @author Tom Gerrard */ function generate_row($update) { global $CONFIG, $sit; if (empty($update['fromaddr']) and !empty($update['from'])) { $update['fromaddr'] = $update['from']; } $update['fromaddr'] = strtolower($update['fromaddr']); if (strlen($update['bodytext']) > 1003) { $updatebodytext = substr($update['bodytext'], 0, 1000) . '…'; } else { $updatebodytext = $update['bodytext']; } $search = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<', '>'); $replace = ''; $updatebodytext = htmlspecialchars(str_replace($search, $replace, $updatebodytext)); if ($updatebodytext == '') { $updatebodytext = ' '; } $shade = 'shade1'; if ($update['contactid'] != 0) { $shade = 'idle'; } else { if (!empty($update['fromaddr'])) { // Have a look if we've got a user with this email address $sql = "SELECT COUNT(id) FROM `{$GLOBALS['dbUsers']}` WHERE email LIKE '%{$update['fromaddr']}%'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } list($contactmatches) = mysql_fetch_row($result); if ($contactmatches > 0) { $shade = 'notice'; } } } $pluginshade = plugin_do('holdingqueue_rowshade', $update); $shade = $pluginshade ? $pluginshade : $shade; $html_row = "<tr class='{$shade}'>"; $html_row .= "<td style='text-align: center'>"; if ($update['locked'] == $sit[2] or empty($update['locked'])) { $html_row .= "<input type='checkbox' name='selected[]' value='" . $update['updateid'] . "' />"; } $html_row .= "</td>"; $html_row .= "<td align='center' width='20%'>" . date($CONFIG['dateformat_datetime'], $update['timestamp']) . '</td>'; $html_row .= "<td width='20%'>"; if (!empty($update['contactid']) and $update['fromaddr'] == contact_email($update['contactid'])) { $html_row .= gravatar($update['fromaddr'], 16) . ' '; $contact_realname = contact_realname($update['contactid']); $html_row .= "<a href='contact_details.php?id={$update['contactid']}' class='info'>"; $html_row .= "{$contact_realname}<span>" . htmlentities($update['fromaddr'], ENT_QUOTES, $GLOBALS['i18ncharset']) . "</span></a>"; $html_row .= " of " . contact_site($update['contactid']); if ($update['emailfrom'] != $contact_realname) { $html_row .= "<br />\n"; $html_row .= htmlentities($update['emailfrom'], ENT_QUOTES, $GLOBALS['i18ncharset']); } } else { $html_row .= gravatar($update['fromaddr'], 16) . ' '; $html_row .= "<a href=\"mailto:{$update['fromaddr']}\">{$update['fromaddr']}</a><br />\n"; $html_row .= htmlentities($update['emailfrom'], ENT_QUOTES, $GLOBALS['i18ncharset']); } $html_row .= "</td>"; $html_row .= "<td width='20%'><a href=\"javascript:incident_details_window('{$update['tempid']}','incomingview');\" id='update{$update['id']}' class='info'>"; // $html_row.="<td width='20%'><a href=\"javascript:void(0);\" id='update{$update['id']}' class='info' style='cursor:help;'>"; if (empty($update['subject'])) { $update['subject'] = $GLOBALS['strUntitled']; } $html_row .= htmlentities($update['subject'], ENT_QUOTES, $GLOBALS['i18ncharset']); $html_row .= '<span>' . parse_updatebody($updatebodytext) . '</span></a></td>'; $span = sprintf($GLOBALS['strByX'], user_realname($update['reason_user'])) . "<br />"; $span .= sprintf($GLOBALS['strOnxAtY'], ldate($CONFIG['dateformat_date'], mysql2date($update['reason_time'])), ldate($CONFIG['dateformat_time'], mysql2date($update['reason_time']))); $html_row .= "<td align='center' width='20%'><a class='info'>{$update['reason']}<span>{$span}</span></a></td>"; $html_row .= "<td align='center' width='20%'>"; if ($update['locked'] != $sit[2] && $update['locked'] > 0) { $html_row .= sprintf($strLockedByX, user_realname($update['locked'], TRUE)); } else { if ($update['locked'] == $sit[2]) { $html_row .= "<a href='{$_SERVER['PHP_SELF']}?unlock={$update['tempid']}'"; $html_row .= " title='{$strUnlockThisToBeModifiedByOther}'> {$GLOBALS['strUnlock']}</a> | "; } else { $html_row .= "<a href=\"javascript:incident_details_window('{$update['tempid']}'"; $html_row .= ",'incomingview');\" id='update{$update['id']}' class='info'"; $html_row .= " title='View and lock this held e-mail'>{$GLOBALS['strView']}</a> | "; } if ($update['reason_id'] == 2) { $html_row .= "<a href='incident_reopen.php?id={$update['incident_id']}&updateid={$update['updateid']}'>{$GLOBALS['strReopen']}</a> | "; } $html_row .= "<a href='delete_update.php?updateid=" . $update['id'] . "&tempid=" . $update['tempid'] . "&timestamp=" . $update['timestamp'] . "' title='{$strRemoveThisPermanently}' onclick=\"return confirm_action('{$GLOBALS['strAreYouSureDelete']}');\"> {$GLOBALS['strDelete']}</a>"; } $html_row .= "</td></tr>\n"; return $html_row; }
echo "</td></tr>"; if ($CONFIG['kb_enabled'] == FALSE or $CONFIG['portal_kb_enabled'] == FALSE or $CONFIG['tasks_enabled'] == FALSE or $CONFIG['calendar_enabled'] == FALSE or $CONFIG['holidays_enabled'] == FALSE or $CONFIG['feedback_enabled'] == FALSE or $CONFIG['portal'] == FALSE) { echo "<tr><td class='shade1' colspan='2'>{$strAdditionalInfo}:</td></tr>"; echo "<tr><td class='shade2' colspan='2'>"; if ($CONFIG['portal'] == FALSE) { echo "<p>{$strPortal} - {$strDisabled}</p>"; } if ($CONFIG['kb_enabled'] == FALSE) { echo "<p>{$strKnowledgeBase} - {$strDisabled}</p>"; } if ($CONFIG['portal'] == TRUE and $CONFIG['portal_kb_enabled'] == FALSE) { echo "<p>{$strKnowledgeBase} ({$strPortal}) - {$strDisabled}</p>"; } if ($CONFIG['tasks_enabled'] == FALSE) { echo "<p>{$strTasks} - {$strDisabled}</p>"; } if ($CONFIG['calendar_enabled'] == FALSE) { echo "<p>{$strCalendar} - {$strDisabled}</p>"; } if ($CONFIG['holidays_enabled'] == FALSE) { echo "<p>{$strHolidays} - {$strDisabled}</p>"; } if ($CONFIG['feedback_enabled'] == FALSE) { echo "<p>{$strFeedback} - {$strDisabled}</p>"; } echo "</td></tr>"; } echo "</table>\n"; plugin_do('about'); echo "</div>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php';
/** * Output the html for the edit site form * * @param int $site ID of the site * @param string $mode whether this is internal or external facing, defaults to internal * @return string $html edit site form html * @author Kieran Hogg */ function show_edit_site($site, $mode = 'internal') { global $CONFIG; $sql = "SELECT * FROM `{$GLOBALS['dbSites']}` WHERE id='{$site}' "; $siteresult = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } while ($siterow = mysql_fetch_array($siteresult)) { if ($mode == 'internal') { $html .= "<h2>" . icon('site', 32) . " {$GLOBALS['strEditSite']}: {$site} - "; $html .= site_name($site) . "</h2>"; } else { $html .= "<h2>" . icon('site', 32) . " " . site_name($site) . "</h2>"; } $html .= "<form name='edit_site' action='{$_SERVER['PHP_SELF']}"; $html .= "?action=update' method='post' onsubmit='return "; $html .= "confirm_action(\"{$GLOBALS['strAreYouSureMakeTheseChanges']}\")'>"; $html .= "<table align='center' class='vertical'>"; $html .= "<tr><th>{$GLOBALS['strName']}:</th>"; $html .= "<td><input class='required' maxlength='50' name='name' size='40' value='{$siterow['name']}' />"; $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n"; if ($mode == 'internal') { $html .= "<tr><th>{$GLOBALS['strTags']}:</th><td><textarea rows='2' cols='60' name='tags'>"; $html .= list_tags($site, TAG_SITE, false) . "</textarea>\n"; } $html .= "<tr><th>{$GLOBALS['strDepartment']}:</th>"; $html .= "<td><input maxlength='50' name='department' size='40' value='{$siterow['department']}' />"; $html .= "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strAddress1']}:</th>"; $html .= "<td><input maxlength='50' name='address1'"; $html .= "size='40' value='{$siterow['address1']}' />"; $html .= "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strAddress2']}: </th><td><input maxlength='50' name='address2' size='40' value='{$siterow['address2']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCity']}:</th><td><input maxlength='255' name='city' size='40' value='{$siterow['city']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCounty']}:</th><td><input maxlength='255' name='county' size='40' value='{$siterow['county']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strPostcode']}:</th><td><input maxlength='255' name='postcode' size='40' value='{$siterow['postcode']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCountry']}:</th><td>" . country_drop_down('country', $siterow['country']) . "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strTelephone']}:</th><td>"; $html .= "<input class='required' maxlength='255' name='telephone' size='40' value='{$siterow['telephone']}' />"; $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strFax']}:</th><td>"; $html .= "<input maxlength='255' name='fax' size='40' value='{$siterow['fax']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strEmail']}:</th><td>"; $html .= "<input class='required' maxlength='255' name='email' size='40' value='{$siterow['email']}' />"; $html .= "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strWebsite']}:</th><td>"; $html .= "<input maxlength='255' name='websiteurl' size='40' value='{$siterow['websiteurl']}' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strSiteType']}:</th><td>\n"; $html .= sitetype_drop_down('typeid', $siterow['typeid']); $html .= "</td></tr>\n"; if ($mode == 'internal') { $html .= "<tr><th>{$GLOBALS['strSalesperson']}:</th><td>"; $html .= user_drop_down('owner', $siterow['owner'], $accepting = FALSE, '', '', TRUE); $html .= "</td></tr>\n"; } if ($mode == 'internal') { $html .= "<tr><th>{$GLOBALS['strIncidentPool']}:</th>"; $incident_pools = explode(',', "{$GLOBALS['strNone']},{$CONFIG['incident_pools']}"); if (array_key_exists($siterow['freesupport'], $incident_pools) == FALSE) { array_unshift($incident_pools, $siterow['freesupport']); } $html .= "<td>" . array_drop_down($incident_pools, 'incident_poolid', $siterow['freesupport']) . "</td></tr>"; $html .= "<tr><th>{$GLOBALS['strActive']}:</th><td><input type='checkbox' name='active' "; if ($siterow['active'] == 'true') { $html .= "checked='" . $siterow['active'] . "'"; } $html .= " value='true' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strNotes']}:</th><td>"; $html .= "<textarea rows='5' cols='30' name='notes'>{$siterow['notes']}</textarea>"; $html .= "</td></tr>\n"; } plugin_do('edit_site_form'); $html .= "</table>\n"; $html .= "<input name='site' type='hidden' value='{$site}' />"; $html .= "<p><input name='submit' type='submit' value='{$GLOBALS['strSave']}' /></p>"; $html .= "</form>"; } return $html; }
break; case 'text': $message = $results['Data']; break; default: break; } // Extract Incident ID if (preg_match('/\\[(\\d{1,5})\\]/', $subject, $m)) { if (FALSE !== incident_status($m[1])) { $incidentid = $m[1]; debug_log("Incident ID found in email: '{$incidentid}'"); } } $incident_open = incident_status($incidentid) == STATUS_ACTIVE; plugin_do('email_arrived'); $customer_visible = 'No'; $part = 1; //process attachments if (!empty($incidentid) and $incident_open) { $fa_dir = $CONFIG['attachment_fspath'] . $incidentid . $fsdelim; } else { $fa_dir = $CONFIG['attachment_fspath'] . "updates{$fsdelim}"; } if (!file_exists($fa_dir)) { if (!mkdir($fa_dir, 0775, TRUE)) { trigger_error("Failed to create incident update attachment directory {$fa_dir}", E_USER_WARNING); } } $attachments = array(); if (is_array($results['Attachments']) or is_array($results['Related'])) {
echo "/* ]]> */\n"; echo "</script>"; echo "<script src='{$CONFIG['application_webpath']}calendar/week_planner.js.php?user={$user}' type='text/javascript'></script>\n"; // DOJO to drop the jobs, etc. onto the dates // FIXME dojo is DEPRECATED echo "<script type='text/javascript' src='{$CONFIG['application_webpath']}scripts/dojo/dojo.js' djConfig='parseOnLoad: true'></script>\n"; echo "<script type='text/javascript'>\n\n /* <![CDATA[ */\n\n var activitycount = 0;\n dojo.require ('dojo.dnd.*');\n dojo.require ('dojo.event.*');\n dojo.require ('dojo.lang');\n dojo.declare('salford.dnd.DestDropTarget', dojo.dnd.HtmlDropTarget, {\n onDrop: function(e)\n {\n this.domNode.style.backgroundColor = '#ddf';\n var saveString = '?saveAnItem=true'\n + '&description=' + escape(e.dragObject.domNode.innerHTML)\n + '&name=' + escape(e.dragObject.domNode.id)\n + '&droptarget=' + this.domNode.id\n + '&week=' + dateStartOfWeek.getTime()\n + '&user='******'&newItem=2';\n\n\n var newid;\n newid = new sack();\n newid.requestFile = externalSourceFile_save + saveString;\n newid.onCompletion = function(){ refreshAppointments(); };\n newid.runAJAX();\n },\n\n onDragOver: function(e)\n {\n this.domNode.style.backgroundColor = '#ff0';\n return dojo.dnd.HtmlDropTarget.prototype.onDragOver.apply(this, arguments);\n },\n\n onDragOut: function(e)\n {\n this.domNode.style.backgroundColor = '#ddf';\n return dojo.dnd.HtmlDropTarget.prototype.onDragOut.apply(this, arguments);\n }\n });\n\n\n dojo.event.connect(dojo, 'loaded', 'initialise');\n\n var activityTypes = new Array();\n\n retrievePreviousActivities();\n\n /* ]]> */\n\n </script>\n "; // Build up activity types $activity_files['$strSupport'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_support.inc.php'; $activity_files['$strTravelling'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_travelling.inc.php'; $activity_files['$strResearch'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_research.inc.php'; $activity_files['$strDevelopment'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_development.inc.php'; $activity_files['$PreSales'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_presales.inc.php'; $activity_files['$strTraining'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_training.inc.php'; $activity_files['$strManagement'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'calendar/activity_managerial.inc.php'; plugin_do('activity_types'); foreach ($activity_files as $activity_name => $activity_file) { include $activity_file; } ksort($activity_types); global $approver; if ($approver) { echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?display=timesheet'>"; echo user_drop_down('user', $user, FALSE); echo "<input type='submit' value='{$strSwitchUser}' />"; echo "</form>"; echo "<br/>"; } // Controls Table echo "<div id='rightdiv' style='float: right; border: 1px dashed gray; width: 25%;'>"; echo "<table class='timesheet'>";
} } } if ($showtvar) { echo "<dt><code><a href=\"javascript:insertTemplateVar('{$identifier}');\">{$identifier}</a></code></dt>"; if (!empty($ttvar['description'])) { echo "<dd>{$ttvar['description']}"; } if (!empty($ttvar[0]['description'])) { echo "<dd>{$ttvar[0]['description']}"; } echo "<br />"; } } echo "</dl>"; plugin_do('emailtemplate_list'); echo "</table>\n"; echo "</div>"; echo "<p style='clear:both; margin-top: 2em;' align='center'><a href='{$_SERVER['PHP_SELF']}'>{$strBackToList}</a></p>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; } else { echo user_alert(sprintf($strFieldMustNotBeBlank, "'{$strEmailTemplate}'"), E_USER_ERROR); } } elseif ($action == "delete") { if (empty($id) or is_numeric($id) == FALSE) { // id must be filled and be a number header("Location: {$_SERVER['PHP_SELF']}?action=showform"); exit; } // We only allow user templates to be deleted $sql = "DELETE FROM `{$dbEmailTemplates}` WHERE id='{$id}' AND type='user' LIMIT 1";
echo "<a href='incident_details.php?id={$related->incidentid}' title='{$linktitle}'>{$related->incidentid}</a> "; } else { if ($related->relation == 'child') { $linktitle = 'Parent'; } else { $linktitle = 'Sibling'; } $linktitle .= ": " . incident_title($related->relatedid); echo "<a href='incident_details.php?id={$related->relatedid}' title='{$linktitle}'>{$related->relatedid}</a> "; } echo " "; } echo "</td></tr>"; } echo "</table>"; plugin_do('incident_details'); echo "</div>\n\n"; $offset = cleanvar($_REQUEST['offset']); if (empty($offset)) { $offset = 0; } /** * @author Ivan Lucas */ function count_updates($incidentid) { $count_updates = 0; $sql = "SELECT COUNT(id) FROM `{$GLOBALS['dbUpdates']}` WHERE incidentid='{$incidentid}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
if ($_SESSION['formdata']['add_user']['holiday_entitlement'] != '') { echo "value='{$_SESSION['formdata']['add_user']['holiday_entitlement']}'"; } else { echo "value='{$CONFIG['default_entitlement']}'"; } echo " /> {$strDays}</td></tr>\n"; echo "<tr><th>{$strStartDate} " . help_link('UserStartdate') . "</th>"; echo "<td><input type='text' name='startdate' id='startdate' size='10'"; if ($_SESSION['formdata']['add_user']['startdate'] != '') { echo "value='{$_SESSION['formdata']['add_user']['startdate']}'"; } echo "/> "; echo date_picker('adduser.startdate'); echo "</td></tr>\n"; } plugin_do('add_user_form'); echo "</table>\n"; echo "<p><input name='submit' type='submit' value='{$strAddUser}' /></p>"; echo "</form>\n"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; clear_form_data('add_user'); } else { // External variables $username = mysql_real_escape_string(strtolower(trim(strip_tags($_REQUEST['username'])))); $realname = cleanvar($_REQUEST['realname']); $password = mysql_real_escape_string($_REQUEST['password']); $groupid = cleanvar($_REQUEST['groupid']); $roleid = cleanvar($_REQUEST['roleid']); $jobtitle = cleanvar($_REQUEST['jobtitle']); $email = cleanvar($_REQUEST['email']); $phone = cleanvar($_REQUEST['phone']);
$ttvararray['{salespersonemail}'][] = array('description' => $strSalespersonAssignedToContactsSiteEmail, 'requires' => 'contractid', 'replacement' => 'user_email(db_read_column(\'owner\', $GLOBALS[\'dbSites\'], maintenance_siteid($paramarray[\'contractid\'])));'); $ttvararray['{schedulertask}'] = array('description' => $strScheduledTask, 'replacement' => '$paramarray[\'schedulertask\'];'); $ttvararray['{sendemail}'] = array('description' => $strSendOpeningEmailDesc, 'replacement' => '$paramarray[\'sendemail\'];', 'show' => FALSE); $ttvararray['{serviceremaining}'] = array('description' => $strServiceBalanceInfo, 'requires' => 'contractid', 'replacement' => 'get_service_percentage($paramarray[\'contractid\']);', 'show' => FALSE); $ttvararray['{serviceremainingstring}'] = array('description' => $strServiceBalanceString, 'requires' => 'contractid', 'replacement' => '(get_service_percentage($paramarray[\'contractid\']) * 100)."%";'); $ttvararray['{signature}'] = array('description' => $strCurrentUsersSignature, 'replacement' => 'user_signature($_SESSION[\'userid\']);'); $ttvararray['{siteid}'] = array('description' => $strSiteName, 'requires' => 'siteid', 'replacement' => '$paramarray[\'siteid\'];', 'show' => FALSE); $ttvararray['{sitename}'][] = array('description' => $strSiteName, 'requires' => 'incidentid', 'replacement' => 'contact_site(incident_contact($paramarray[\'incidentid\']));'); $ttvararray['{sitename}'][] = array('description' => $strSiteName, 'requires' => 'contactid', 'replacement' => 'contact_site($paramarray[\'contactid\']);'); $ttvararray['{sitename}'][] = array('description' => $strSiteName, 'requires' => 'contractid', 'replacement' => 'contract_site($paramarray[\'contractid\']);'); $ttvararray['{sitename}'][] = array('description' => $strSiteName, 'requires' => 'siteid', 'replacement' => 'site_name($paramarray[\'siteid\']);'); $ttvararray['{sitesalespersonid}'] = array('description' => 'The ID of the site\'s salesperson', 'replacement' => 'site_salespersonid($paramarray[\'siteid\']);', 'requires' => 'siteid', 'show' => FALSE); $ttvararray['{sitesalesperson}'] = array('description' => $strSalespersonSite, 'replacement' => 'site_salesperson($paramarray[\'siteid\']);', 'requires' => 'siteid'); $ttvararray['{slaid}'] = array('description' => 'ID of the SLA', 'replacement' => 'contract_slaid($paramarray[\'contractid\']);', 'requires' => 'contractid', 'show' => FALSE); $ttvararray['{slatag}'] = array('description' => $strSLA, 'replacement' => 'servicelevel_id2tag(contract_slaid($paramarray[\'contractid\']));', 'requires' => 'contractid'); $ttvararray['{supportemail}'] = array('description' => $strSupportEmailAddress, 'replacement' => '$CONFIG[\'support_email\'];'); $ttvararray['{supportmanageremail}'] = array('description' => $strSupportManagersEmailAddress, 'replacement' => 'user_email($CONFIG[\'support_manager\']);'); $ttvararray['{taskid}'] = array('description' => 'ID of the task', 'replacement' => '$paramarray[\'taskid\']', 'show' => FALSE); $ttvararray['{todaysdate}'] = array('description' => $strCurrentDate, 'replacement' => 'ldate("jS F Y");'); $ttvararray['{townerid}'] = array('description' => 'Incident temp owner ID', 'replacement' => 'incident_towner($paramarray[\'incidentid\']);', 'requires' => 'incidentid', 'show' => FALSE); $ttvararray['{triggersfooter}'] = array('description' => $strTriggersFooter, 'replacement' => '$SYSLANG[\'strTriggerFooter\'];', 'requires' => ''); $ttvararray['{triggeruseremail}'] = array('description' => $strTriggerUserEmail, 'replacement' => 'user_email($paramarray[\'triggeruserid\']);'); $ttvararray['{updateid}'] = array('description' => 'The ID of the update', 'replacement' => 'incoming_email_update_id($paramarray[\'holdingemailid\']);', 'requires' => 'holdingemailid', 'show' => FALSE); $ttvararray['{useraccepting}'] = array('description' => 'Whether the user is accepting or not', 'replacement' => 'user_accepting_status($paramarray[\'userid\']);', 'requires' => 'userid', 'show' => FALSE); $ttvararray['{useremail}'] = array('description' => $strCurrentUserEmailAddress, 'replacement' => 'user_email($paramarray[\'userid\']);'); $ttvararray['{userid}'][] = array('description' => 'UserID the trigger passes', 'replacement' => '$paramarray[\'userid\'];', 'show' => FALSE); $ttvararray['{userid}'][] = array('description' => 'Owner of a task', 'replacement' => 'task_owner($paramarray[\'taskid\']);', 'requires' => 'taskid', 'show' => FALSE); $ttvararray['{userrealname}'] = array('description' => $strFullNameCurrentUser, 'replacement' => 'user_realname($GLOBALS[\'sit\'][2]);'); $ttvararray['{userstatus}'] = array('description' => $strUserStatus, 'replacement' => 'user_status_name($paramarray[\'userid\']);', 'requires' => 'userid'); plugin_do('trigger_variables');
$sql = "INSERT INTO `{$dbLinks}`(linktype, origcolref, linkcolref, direction, userid) "; $sql .= "VALUES(7, '{$incidentid}', '{$inventory}', 'left', '{$sit[2]}')"; mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } } plugin_do('incident_created'); // Decrement free support, where appropriate if ($type == 'free') { decrement_free_incidents(contact_siteid($contactid)); plugin_do('incident_created_site'); } else { // decrement contract incident by incrementing the number of incidents used increment_incidents_used($maintid); plugin_do('incident_created_contract'); } $html .= "<h3>{$strIncident}: {$incidentid}</h3>"; $html .= "<p align='center'>"; $html .= sprintf($strIncidentLoggedEngineer, $incidentid); $html .= "</p>\n"; $suggested_user = suggest_reassign_userid($incidentid); trigger('TRIGGER_INCIDENT_CREATED', array('incidentid' => $incidentid, 'sendemail' => $send_email)); if ($CONFIG['auto_assign_incidents']) { html_redirect("incident_add.php?action=reassign&userid={$suggested_user}&incidentid={$incidentid}"); exit; } else { echo $html; } // List Engineers // We need a user type 'engineer' so we don't just list everybody
$activeStr = 'true'; } else { $activeStr = 'false'; } /* TAGS */ replace_tags(1, $contact, $tags); $sql = "UPDATE `{$dbContacts}` SET courtesytitle='{$courtesytitle}', surname='{$surname}', forenames='{$forenames}', siteid='{$siteid}', email='{$email}', phone='{$phone}', mobile='{$mobile}', fax='{$fax}', "; $sql .= "address1='{$address1}', address2='{$address2}', city='{$city}', county='{$county}', postcode='{$postcode}', "; $sql .= "country='{$country}', dataprotection_email='{$dataprotection_email}', dataprotection_phone='{$dataprotection_phone}', "; $sql .= "notes='{$notes}', dataprotection_address='{$dataprotection_address}' , department='{$department}' , jobtitle='{$jobtitle}', "; $sql .= "notify_contactid='{$notify_contactid}', "; $sql .= "active = '{$activeStr}', "; $sql .= "timestamp_modified={$now} WHERE id='{$contact}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } if (!$result) { trigger_error("Update of contact failed: {$sql}", E_USER_WARNING); } else { plugin_do('save_contact_form'); journal(CFG_LOGGING_NORMAL, 'Contact Edited', "Contact {$contact} was edited", CFG_JOURNAL_CONTACTS, $contact); html_redirect("contact_details.php?id={$contact}"); exit; } } } } include APPLICATION_INCPATH . 'htmlfooter.inc.php';