if (GET('close') == _('Close selected')) { foreach ($_GET as $k => $cst_inc_id) { if (preg_match("/^ticket\\d+/", $k) && $cst_inc_id != '') { list($cst_incident) = Incident::search($conn, array('incident_id' => $cst_inc_id)); if (is_object($cst_incident) && !empty($cst_incident)) { //Incident is not already closed $cst_prev_status = $cst_incident->get_status(); if ($cst_prev_status != 'Closed' && Incident::user_incident_perms($conn, $cst_inc_id, 'closed')) { $cst_status = 'Closed'; $cst_priority = $cst_incident->get_priority(); $cst_user = Session::get_session_user(); $cst_description = sprintf(_('Ticket automatically closed by %s'), $cst_user); $cst_action = sprintf(_('Change ticket status from %s to Closed'), ucfirst($cst_incident->get_status())); $cst_transferred = NULL; $cst_tags = $cst_incident->get_tags(); Incident_ticket::insert($conn, $cst_inc_id, $cst_status, $cst_priority, $cst_user, $cst_description, $cst_action, $cst_transferred, $cst_tags); } } } } } $criteria = array('ref' => $ref, 'type' => $type, 'title' => $title, 'submitter' => $submitter, 'in_charge' => $in_charge, 'with_text' => $with_text, 'status' => $status, 'priority_str' => $priority, 'attach_name' => $attachment, 'related_to_user' => $related_to_user, 'tag' => $tag); ?> <!-- filter --> <form name="filter" id="filter" method="GET" action="<?php echo $_SERVER["SCRIPT_NAME"]; ?> "> <input type="hidden" name="page" id="page" value=""/> <?php
$page = 1; } // First time we visit this page, show by default only Open incidents // when GET() returns NULL, means that the param is not set if (GET('status') === null) { $status = 'Open'; } $db = new ossim_db(); $conn = $db->connect(); // Close selected tickets if (GET('close') == _("Close selected")) { foreach ($_GET as $k => $v) { if (preg_match("/^ticket\\d+/", $k) && $v != "") { $idprio = explode("_", $v); if (is_numeric($idprio[0]) && is_numeric($idprio[1])) { Incident_ticket::insert($conn, $idprio[0], "Closed", $idprio[1], Session::get_session_user(), " ", "", "", array(), null); } } } } $criteria = array('ref' => $ref, 'type' => $type, 'title' => $title, 'submitter' => $submitter, 'in_charge' => $in_charge, 'with_text' => $with_text, 'status' => $status, 'priority_str' => $priority, 'attach_name' => $attachment, 'related_to_user' => $related_to_user, 'tag' => $tag); $incident_tag = new Incident_tag($conn); ?> <!-- filter --> <form name="filter" id="filter" method="GET" action="<?php echo $_SERVER["SCRIPT_NAME"]; ?> "> <input type="hidden" name="page" id="page" value=""/> <?php
echo json_encode($data); } exit; } else { if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error'; $data['data'] = $validation_errors; } else { $data['status'] = 'OK'; $attachment = null; if (isset($_FILES['attachment']) && $_FILES['attachment']['tmp_name']) { $attachment = $_FILES['attachment']; $attachment['content'] = file_get_contents($attachment['tmp_name']); unlink($attachment['tmp_name']); } Incident_ticket::insert($conn, $incident_id, $status, $priority, $login, $description, $action, $transferred, $tags, $attachment); ?> <script type='text/javascript'> //Refresh Header /* Deprecated header if (typeof(top.frames['header']) != 'undefined' && top.frames['header'] != null){ top.frames['header'].document.location.reload(); } */ document.location.href='incident.php?id=<?php echo $incident_id; ?> &edit=<?php echo $edit; ?> ';