echo "<h3 class='error'>" . __('There was a problem deleting ticket') . "</h3>"; no_permission(); } } $massive_number_loop = get_parameter('massive_number_loop', -1); // AJAX (Massive operations) if ($massive_number_loop > -1) { ob_clean(); echo json_encode($massive_number_loop); return; } } if ($action == 'update') { // Number of loop in the massive operations. No received in not massive ones $massive_number_loop = get_parameter('massive_number_loop', -1); $old_incident = get_incident($id); $user = get_parameter('id_user', ''); $grupo = get_parameter('grupo_form', $old_incident['id_grupo']); if ($user == '') { $sql = 'SELECT id_user_default FROM tgrupo WHERE id_grupo = ' . $grupo; $default_user = get_db_value_sql($sql); if ($default_user == '' || !$default_user) { $user = $old_incident['id_usuario']; } else { $user = $default_user; } } $id_author_inc = get_incident_author($id); $titulo = get_parameter('titulo', $old_incident['titulo']); $sla_disabled = (int) get_parameter('sla_disabled', $old_incident['sla_disabled']); //Get SLA given on submit
<?php include_once '../includes/connection.php'; include_once '../includes/functions.php'; // include_once '../pages/index.php'; // $results = get_all_identifications($dbh); $header = get_incident($_GET['id'], $dbh); $detail = get_incident_history($_GET['id'], $dbh); $statuses = get_statuses($dbh); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Routerboard Resources</title> <!-- Bootstrap Core CSS --> <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> <!-- MetisMenu CSS --> <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet"> <!-- Timeline CSS --> <link href="../dist/css/timeline.css" rel="stylesheet">
$options["onclick"] = "openUserInfo(\"{$closer}\")"; $incident_users .= print_image('images/avatars/' . $avatar_closer . '.png', true, $options); } } $incident_users .= '</div>'; $incident_users .= '<span>' . __('Closed by') . ':</span><br>' . $long_name_closer; $incident_users .= "</td>"; $incident_users .= "</tr>"; $incident_users .= "</table>"; $right_side = print_container('incident_users', __('People') . print_help_tip(_('Click on icons for more details'), true), $incident_users); // Quick editor if ($config['enabled_ticket_editor']) { $has_im = give_acl($config['id_user'], $id_grupo, "IM") || $config['id_user'] == $incident['id_creator']; $has_iw = give_acl($config['id_user'], $id_grupo, "IW") || $config['id_user'] == $incident['id_usuario'] || $config['id_user'] == $incident['id_creator']; if ($has_iw) { $incident_data = get_incident($id); $resolution = $incident_data['resolution']; $priority = $incident_data['prioridad']; $owner = $incident_data['id_usuario']; $status = $incident['estado']; $ticket_editor .= "<table style='width: 100%;'>"; $ticket_editor .= "<tr>"; $ticket_editor .= "<td>"; $ticket_editor .= print_select(get_priorities(true), 'priority_editor', $priority, "", '', '', true, false, false, __('Priority'), false, ''); $ticket_editor .= "</td>"; $ticket_editor .= "<td>"; //If IW creator enabled flag is enabled, the user can change the creator if ($has_im || $has_iw && $config['iw_creator_enabled']) { $src_code = print_image('images/group.png', true, false, true); $params_assigned['input_id'] = 'text-owner_editor'; $params_assigned['input_name'] = 'owner_editor';
function incident_details_list($id_incident, $return = false) { $output = ''; $incident = get_incident($id_incident); $output .= '<ul id="incident-details-list" class="sidemenu">'; $output .= ' <strong>' . __('Open at') . '</strong>: ' . human_time_comparation($incident['inicio']); if ($incident['estado'] == 7) { $output .= '<br /> <strong>' . __('Closed at') . '</strong>: ' . human_time_comparation($incident['cierre']); } if ($incident['actualizacion'] != $incident['inicio']) { $output .= '<br /> <strong>' . __('Last update') . '</strong>: ' . human_time_comparation($incident['actualizacion']); } /* Show workunits if there are some */ $workunit_count = get_incident_count_workunits($id_incident); if ($workunit_count) { $work_hours = get_incident_workunit_hours($id_incident); $workunits = get_incident_workunits($id_incident); $workunit_data = get_workunit_data($workunits[0]['id_workunit']); $output .= '<br /> <strong>' . __('Last work at') . '</strong>: ' . human_time_comparation($workunit_data['timestamp']); $output .= '<br /> <strong>' . __('Workunits') . '</strong>: ' . $workunit_count; $output .= '<br /> <strong>' . __('Time used') . '</strong>: ' . $work_hours; $output .= '<br /> <strong>' . _('Done by') . '</strong>: <em>' . $workunit_data['id_user'] . '</em>'; } $output .= '</ul>'; if ($return) { return $output; } echo $output; }
function check_incident_sla_max_response($id_incident) { $incident = get_incident($id_incident); $sla_info = incidents_get_sla_info($incident['id_grupo']); if ($sla_info != false) { $id_sla_type = $sla_info['id_sla_type']; switch ($id_sla_type) { case 0: //NORMAL SLA /* If closed, disable any affected SLA */ if ($incident['estado'] == 6 || $incident['estado'] == 7) { if ($incident['affected_sla_id']) { $sql = sprintf('UPDATE tincidencia SET affected_sla_id = 0 WHERE id_incidencia = %d', $id_incident); process_sql($sql); } return false; } break; case 1: //THIRD PARTY SLA /* If closed, disable any affected SLA */ if ($incident['estado'] != 6) { if ($incident['affected_sla_id']) { $sql = sprintf('UPDATE tincidencia SET affected_sla_id = 0 WHERE id_incidencia = %d', $id_incident); process_sql($sql); } return false; } break; case 2: //NORMAL SLA AND THIRD PARTY SLA if ($incident['estado'] == 7) { if ($incident['affected_sla_id']) { $sql = sprintf('UPDATE tincidencia SET affected_sla_id = 0 WHERE id_incidencia = %d', $id_incident); process_sql($sql); } return false; } break; } } $slas = incidents_get_incident_slas($id_incident, false); $start = strtotime($incident['inicio']); $now = time(); foreach ($slas as $sla) { // Datetime/Time check when exists (version compatibility code), this // was added as a 3.0 post-feature :-) if (isset($sla["five_daysonly"]) || isset($sla["no_holidays"])) { $dow = date("w", time()); $hod = date("G", time()); // Skip if we're on weekend if ($sla["five_daysonly"] == 1 and ($dow == 0 or $dow == 6)) { continue; } //Check if holidays enabled and today is holidays $datecalc = date("Y-m-d", time()) . ' 00:00:00'; if ($sla["no_holidays"] == 1 and is_holidays($datecalc)) { continue; } // Skip if we're out of job time if ($sla["time_from"] != $sla["time_to"]) { if ($sla["time_from"] > $hod or $sla["time_to"] < $hod) { continue; } } } if ($now < $start + $sla['max_response'] * 3600) { continue; } $sql = sprintf('UPDATE tincidencia SET affected_sla_id = %d WHERE id_incidencia = %d', $sla['id'], $id_incident); process_sql($sql); /* SLA has expired */ return $sla['id']; } return false; }
function api_update_incident($return_type, $user, $params) { $id_incident = $params[0]; $values['titulo'] = $params[1]; // Check if user and title is not empty and user exists if (empty($values['titulo'])) { return; } if (!check_user_incident($user, $id_incident)) { return; } $timestamp = print_mysql_timestamp(); $values['descripcion'] = $params[2]; $values['epilog'] = $params[3]; $values['id_grupo'] = $params[4]; $values['prioridad'] = $params[5]; $values['resolution'] = $params[6]; $values['estado'] = $params[7]; $values['id_usuario'] = $params[8]; $id_parent = $params[9]; if ($id_parent != 0 && $id_parent != '') { $values['id_parent'] = $params[9]; } $values['id_incident_type'] = $params[10]; $values['extra_data'] = $params[11]; $values['extra_data2'] = $params[12]; $values['actualizacion'] = $timestamp; if ($values['estado'] == 7) { $values['cierre'] = $timestamp; } $id_incident_type = $values['id_incident_type']; $old_incident = get_incident($id_incident); if (!$old_incident['old_status2']) { $values['old_status'] = $old_incident["old_status"]; $values['old_resolution'] = $old_incident["old_resolution"]; $values['old_status2'] = $values['estado']; $values['old_resolution2'] = $values['resolution']; } else { if ($old_incident['old_status2'] == $values['estado'] && $old_incident['old_resolution2'] == $values['resolution']) { $values['old_status'] = $old_incident["old_status"]; $values['old_resolution'] = $old_incident["old_resolution"]; $values['old_status2'] = $old_incident["old_status2"]; $values['old_resolution2'] = $old_incident["old_resolution2"]; } else { $values['old_status'] = $old_incident["old_status2"]; $values['old_resolution'] = $old_incident["old_resolution2"]; $values['old_status2'] = $values['estado']; $values['old_resolution2'] = $values['resolution']; } } $old_status = api_get_status_incident($id_incident); $values['old_status'] = $old_status; $old_resolution = api_get_resolution_incident($id_incident); $values['old_resolution'] = $old_resolution; $new_status = $values['estado']; $check_status = enterprise_hook("incidents_check_allowed_status", array($old_status, $new_status, false, true, true, $old_resolution)); if ($check_status == ENTERPRISE_NOT_HOOK) { $check_status = true; } if ($values['estado'] == STATUS_CLOSED) { //~ $check_resolution = enterprise_hook("incidents_check_allowed_resolution", array($resolution, $values['estado'], $id_incident, true)); $check_resolution = enterprise_hook("incidents_check_allowed_resolution", array($values['resolution'], $values['estado'], $id_incident, true)); if ($check_resolution == ENTERPRISE_NOT_HOOK) { $check_resolution = true; } } else { $check_resolution = true; //~ $enterprise = enterprise_hook("incidents_check_allowed_resolution", array($resolution, $values['estado'], $id_incident, true)); $enterprise = enterprise_hook("incidents_check_allowed_resolution", array($values['resolution'], $values['estado'], $id_incident, true)); if ($enterprise != ENTERPRISE_NOT_HOOK) { $values['resolution'] = 0; } } if ($check_status && $check_resolution) { $result = process_sql_update('tincidencia', $values, array('id_incidencia' => $id_incident)); //Add traces and statistic information incidents_set_tracking($id_incident, 'update', $values['prioridad'], $values['estado'], $values['resolution'], $user, $values['id_grupo']); //Add only update info incident_tracking($id_incident, INCIDENT_UPDATED); if ($id_incident_type != 0) { //in the massive operations no change id_incident_type $sql_label = "SELECT `label` FROM `tincident_type_field` WHERE id_incident_type = {$id_incident_type}"; $labels = get_db_all_rows_sql($sql_label); if ($labels === false) { $labels = array(); } $num_params = 13; foreach ($labels as $label) { $values_type_field['data'] = $params[$num_params]; $id_incident_field = get_db_value_filter('id', 'tincident_type_field', array('id_incident_type' => $id_incident_type, 'label' => $label['label']), 'AND'); $values_type_field['id_incident_field'] = $id_incident_field; $values_type_field['id_incident'] = $id_incident; $exists_id = get_db_value_filter('id', 'tincident_field_data', array('id_incident' => $id_incident, 'id_incident_field' => $id_incident_field), 'AND'); if ($exists_id) { process_sql_update('tincident_field_data', $values_type_field, array('id_incident_field' => $id_incident_field, 'id_incident' => $id_incident), 'AND'); } else { process_sql_insert('tincident_field_data', $values_type_field); } $num_params++; } } switch ($return_type) { case "xml": echo xml_node($result); break; case "csv": echo $result; break; } } }
$num_gold = get_db_value('gold_medals', 'tincidencia', 'id_incidencia', $id_ticket); $values['gold_medals'] = $num_gold - 1; break; case 3: //Add black medal $num_black = get_db_value('black_medals', 'tincidencia', 'id_incidencia', $id_ticket); $values['black_medals'] = $num_black + 1; break; case 4: //Remove black medal $num_black = get_db_value('black_medals', 'tincidencia', 'id_incidencia', $id_ticket); $values['black_medals'] = $num_black - 1; break; } } $old_incident = get_incident($id_ticket); if (!$old_incident['old_status2']) { $values['old_status'] = $old_incident["old_status"]; $values['old_resolution'] = $old_incident["old_resolution"]; $values['old_status2'] = $values['estado']; $values['old_resolution2'] = $values['resolution']; } else { if ($old_incident['old_status2'] == $values['estado'] && $old_incident['old_resolution2'] == $values['resolution']) { $values['old_status'] = $old_incident["old_status"]; $values['old_resolution'] = $old_incident["old_resolution"]; $values['old_status2'] = $old_incident["old_status2"]; $values['old_resolution2'] = $old_incident["old_resolution2"]; } else { $values['old_status'] = $old_incident["old_status2"]; $values['old_resolution'] = $old_incident["old_resolution2"]; $values['old_status2'] = $values['estado'];
function print_incident() { global $config, $pdf_output, $pdf_filename; $id = (int) get_parameter("id"); $incident = get_incident($id); if (!check_incident_access($id)) { return; } if ($pdf_output) { ob_clean(); $pdf_filename = "incident_{$id}.pdf"; } else { $report_button = print_report_button("index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id={$id}&tab=summary", __('Export')); if ($report_button) { echo "<div style='padding:7px; float:right;'>"; echo $report_button; echo "</div>"; } } echo "<div style='padding-left:7px;'>"; echo "<table style='font: 1em Verdana, Helvetica, Arial, 'Trebuchet MS', Arial, Sans-serif; color:#505050; width:620px; text-align:left;'>"; if ($pdf_output) { echo "\t<tr>"; echo "\t\t<td style='text-align:center; font-size:14px; color:#505050;'>"; echo "\t\t\t<h1>#" . $incident["id_incidencia"] . " " . $incident["titulo"] . "</h1><br><br>"; echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["id_creator"]) { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Creator') . "</b> - " . $incident["id_creator"]; echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["id_usuario"]) { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Owner') . "</b> - " . $incident["id_usuario"]; echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["estado"]) { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Status') . "</b> - " . incidents_get_incident_status_text($incident["id_incidencia"]); echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["inicio"] != "0000-00-00 00:00:00") { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Created on') . "</b> - " . strftime("%e %B %Y (%H:%M)", strtotime($incident["inicio"])); echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["cierre"] != "0000-00-00 00:00:00") { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Closed on') . "</b> - " . strftime("%e %B %Y (%H:%M)", strtotime($incident["cierre"])); echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["descripcion"]) { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Description') . "</b>"; echo "\t\t\t<div style='width:620px; word-wrap:break-word;'>" . $incident["descripcion"] . "</div>"; echo "\t\t</td>"; echo "\t</tr>"; } if ($incident["epilog"]) { echo "\t<tr>"; echo "\t\t<td style='font-size:16px; color:#505050;'>"; echo "\t\t\t<b>" . __('Epilog') . "</b>"; echo "\t\t\t<div style='width:620px; word-wrap:break-word;'>" . $incident["epilog"] . "</div>"; echo "\t\t</td>"; echo "\t</tr>"; } echo "</table>"; echo "</div>"; }
$id_incident = (int) get_parameter('id'); $title = ''; // INFO: The workunits are treated like commits into the tickets sections require_once 'include/functions_workunits.php'; //Check if we have id passed by parameter or by script loading if (!$id_incident) { if ($id) { $id_incident = $id; } else { audit_db($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access to incident #" . $id_incident); include "general/noaccess.php"; return; } } // Obtain group of this incident $incident = get_incident($id_incident); $result_msg = ''; //user with IR and incident creator see the information $check_acl = enterprise_hook("incidents_check_incident_acl", array($incident)); $external_check = enterprise_hook("manage_external", array($incident)); if ($check_acl !== ENTERPRISE_NOT_HOOK && !$check_acl || $external_check !== ENTERPRISE_NOT_HOOK && !$external_check) { audit_db($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access to incident #" . $id_incident); include "general/noaccess.php"; exit; } // Workunit ADD $insert_workunit = (bool) get_parameter('insert_workunit'); if ($insert_workunit) { $timestamp = print_mysql_timestamp(); $nota = get_parameter("nota"); $timeused = (double) get_parameter('duration');
function incidents_set_tracking($id_ticket, $action, $priority, $status, $resolution, $user, $group) { switch ($action) { case 'update': $old_incident = get_incident($id_ticket); //Add traces and statistic information $tracked = false; if ($old_incident['prioridad'] != $priority) { incident_tracking($id_ticket, INCIDENT_PRIORITY_CHANGED, $priority); $tracked = true; } if ($old_incident['estado'] != $status) { incident_tracking($id_ticket, INCIDENT_STATUS_CHANGED, $status); $tracked = true; } if ($old_incident['resolution'] != $resolution) { incident_tracking($id_ticket, INCIDENT_RESOLUTION_CHANGED, $resolution); $tracked = true; } if ($old_incident['id_usuario'] != $user) { incident_tracking($id_ticket, INCIDENT_USER_CHANGED, $user); $tracked = true; } if ($old_incident["id_grupo"] != $group) { incident_tracking($id_ticket, INCIDENT_GROUP_CHANGED, $group); $tracked = true; } if ($tracked == false) { incident_tracking($id_ticket, INCIDENT_UPDATED); } break; case 'create': incident_tracking($id_ticket, INCIDENT_CREATED); //Add traces and statistic information incident_tracking($id_ticket, INCIDENT_PRIORITY_CHANGED, $priority); incident_tracking($id_ticket, INCIDENT_STATUS_CHANGED, $status); incident_tracking($id_ticket, INCIDENT_RESOLUTION_CHANGED, $resolution); incident_tracking($id_ticket, INCIDENT_USER_CHANGED, $user); incident_tracking($id_ticket, INCIDENT_GROUP_CHANGED, $group); break; } return; }
$error = "Missing or incorrect huh ID."; include '../errors/error.php'; } else { $technicians = get_technicians_with_count(); include 'technician_select.php'; } } else { if ($action == 'incident_assign') { $incidentID = filter_input(INPUT_POST, 'incidentID'); $techID = filter_input(INPUT_POST, 'techID'); $techfullname = filter_input(INPUT_POST, 'techfullname'); if ($incidentID == NULL || $incidentID == FALSE || $techID == NULL || $techID == FALSE || $techfullname == NULL || $techfullname == FALSE) { $error = "Missing or incorrect huh ID."; include '../errors/error.php'; } else { $incident = get_incident($incidentID); $custid = $incident['customerID']; $cust = get_customer($custid); $custfullname = $cust['firstName'] . " " . $cust['lastName']; include 'incident_assign.php'; } } else { if ($action == 'assign') { $incidentID = filter_input(INPUT_POST, 'incidentID'); $techID = filter_input(INPUT_POST, 'techID'); if ($incidentID == NULL || $incidentID == FALSE || $techID == NULL || $techID == FALSE) { $error = "Missing or incorrect huh ID."; include '../errors/error.php'; } else { //assign_incident($incidentID,$techID); $message = "This incident was assigned to a technician";