$track->check($_POST['id'], 'd'); if ($track->restore($_POST)) { Event::log($_POST["id"], "ticket", 4, "tracking", sprintf(__('%s restores an item'), $_SESSION["glpiname"])); } $track->redirectToList(); } else { if (isset($_POST['sla_delete'])) { $track->check($_POST["id"], 'w'); $track->deleteSLA($_POST["id"]); Event::log($_POST["id"], "ticket", 4, "tracking", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST["id"]); } else { if (isset($_POST['delete_user'])) { ///TODO try to move it to specific form page $ticket_user = new Ticket_User(); $ticket_user->check($_POST['id'], 'd'); $ticket_user->delete($_POST); Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']); } else { if (isset($_POST['delete_group'])) { $group_ticket = new Group_Ticket(); $group_ticket->check($_POST['id'], 'd'); $group_ticket->delete($_POST); Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']); } else { if (isset($_POST['delete_supplier'])) { $supplier_ticket = new Supplier_Ticket(); $supplier_ticket->check($_POST['id'], 'd'); $supplier_ticket->delete($_POST);
if (isset($_POST['sla_delete'])) { $track->check($_POST["id"], 'w'); $track->deleteSLA($_POST["id"]); Event::log($_POST["id"], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]); glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST["id"]); } else { if (isset($_REQUEST['delete_link'])) { $ticket_ticket = new Ticket_Ticket(); $ticket_ticket->check($_REQUEST['id'], 'w'); $ticket_ticket->delete($_REQUEST); Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][120]); glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']); } else { if (isset($_REQUEST['delete_user'])) { $ticket_user = new Ticket_User(); $ticket_user->check($_REQUEST['id'], 'w'); $ticket_user->delete($_REQUEST); Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][122]); glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']); } else { if (isset($_REQUEST['delete_group'])) { $group_ticket = new Group_Ticket(); $group_ticket->check($_REQUEST['id'], 'w'); $group_ticket->delete($_REQUEST); Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][122]); glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']); } else { if (isset($_REQUEST['addme_observer'])) { $ticket_user = new Ticket_User(); $track->check($_REQUEST['tickets_id'], 'r'); $input = array('tickets_id' => $_REQUEST['tickets_id'], 'users_id' => getLoginUserID(), 'use_notification' => 1, 'type' => Ticket::OBSERVER);
it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: Walid Nouh // Purpose of file: // ---------------------------------------------------------------------- $ticket_user = new Ticket_User(); if (isset($_REQUEST["update"])) { $ticket_user->check($_REQUEST["id"], 'w'); $ticket_user->update($_REQUEST); echo "<script type='text/javascript' >\n"; echo "window.opener.location.reload();"; echo "window.close()"; echo "</script>"; } else { if (isset($_REQUEST["id"])) { $ticket_user->showForm($_REQUEST["id"]); } }
You should have received a copy of the GNU General Public License along with GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { include '../inc/includes.php'; } $link = new Ticket_User(); $item = new Ticket(); Session::checkLoginUser(); Html::popHeader(__('Email followup'), $_SERVER['PHP_SELF']); if (isset($_POST["update"])) { $link->check($_POST["id"], UPDATE); $link->update($_POST); echo "<script type='text/javascript' >\n"; echo "window.parent.location.reload();"; echo "</script>"; } else { if (isset($_POST['delete'])) { $link->check($_POST['id'], DELETE); $link->delete($_POST); Event::log($link->fields['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); if ($item->can($link->fields["tickets_id"], READ)) { Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $link->fields['tickets_id']); } Session::addMessageAfterRedirect(__('You have been redirected because you no longer have access to this item'), true, ERROR); Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.php"); } else {
GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { include '../inc/includes.php'; } $ticket_user = new Ticket_User(); Session::checkLoginUser(); if (isset($_POST["update"])) { $ticket_user->check($_POST["id"], 'w'); $ticket_user->update($_POST); echo "<script type='text/javascript' >\n"; echo "window.opener.location.reload();"; echo "window.close()"; echo "</script>"; } else { if (isset($_GET["id"])) { $ticket_user->showUserNotificationForm($_GET["id"]); } else { Html::displayErrorAndDie('Lost'); } }
private function manageTicket($closed = true) { global $DB, $CFG_GLPI; $DB->connect(); $_SESSION['glpiactive_entity'] = 0; $CFG_GLPI['root_doc'] = "http://127.0.0.1/fusion0.83/"; $plugin = new Plugin(); $plugin->getFromDBbyDir("timelineticket"); $plugin->activate($plugin->fields['id']); Plugin::load("timelineticket"); Session::loadLanguage("en_GB"); $ticket = new Ticket(); $group = new Group(); $group_ticket = new Group_Ticket(); $GLPIlog = new GLPIlogs(); $ticket_User = new Ticket_User(); $_SESSION['plugin_timelineticket_date'] = array(); $group->add(array('name' => 'grtech1')); $group->add(array('name' => 'grtech2')); // * 01/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate = array('1' => $_SESSION["glpi_currenttime"]); $input = array(); $input['name'] = 'Pb with the ticket'; $input['content'] = 'I have a problem with the ticket'; $tickets_id = $ticket->add($input); $GLPIlog->testSQLlogs('01/'); $GLPIlog->testPHPlogs('01/'); // * 02/ sleep(2); // * 03/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[3] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['_itil_assign']['_type'] = 'group'; $input['_itil_assign']['groups_id'] = 1; $ticket->update($input); $input['_itil_assign']['_type'] = 'user'; $input['_itil_assign']['users_id'] = 2; $ticket->update($input); $GLPIlog->testSQLlogs('03/'); $GLPIlog->testPHPlogs('03/'); $a_db = getAllDatasFromTable('glpi_groups_tickets'); $a_ref = array(); $a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'groups_id' => '1', 'type' => '2'); $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group1'); $a_db = getAllDatasFromTable('glpi_tickets_users'); $a_ref = array(); $a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'users_id' => '2', 'type' => '1', 'use_notification' => '1', 'alternative_email' => ''); $a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'users_id' => '2', 'type' => '2', 'use_notification' => '1', 'alternative_email' => ''); $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to user 2 (glpi)'); // * 04/ sleep(2); // * 05/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[5] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['status'] = Ticket::WAITING; $ticket->update($input); $GLPIlog->testSQLlogs('05/'); $GLPIlog->testPHPlogs('05/'); $ticket->getFromDB(1); $this->assertEquals('waiting', $ticket->fields['status'], 'May have status waiting'); // * 06/ sleep(1); // * 07/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[7] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = 2; $input['itickets_id'] = $tickets_id; $ticket_User->check($input['id'], 'w'); $ticket_User->delete($input); $input = array(); $input['id'] = 1; $input['itickets_id'] = $tickets_id; $group_ticket->check($input['id'], 'w'); $group_ticket->delete($input); $GLPIlog->testSQLlogs('07/'); $GLPIlog->testPHPlogs('07/'); $a_db = getAllDatasFromTable('glpi_groups_tickets'); $this->assertEquals(array(), $a_db, 'May have no group assigned'); // * 08/ sleep(1); // * 09/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[9] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['_itil_assign']['_type'] = 'group'; $input['_itil_assign']['groups_id'] = 2; $ticket->update($input); $GLPIlog->testSQLlogs('09/'); $GLPIlog->testPHPlogs('09/'); $a_db = getAllDatasFromTable('glpi_groups_tickets'); $a_ref = array(); $a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'groups_id' => '2', 'type' => '2'); $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group2'); $ticket->getFromDB(1); $this->assertEquals('assign', $ticket->fields['status'], '(09/) Status is assign'); // * 10/ sleep(1); // * 11/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[11] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['status'] = Ticket::WAITING; $ticket->update($input); $input = array(); $input['id'] = $tickets_id; $input['_itil_assign']['_type'] = 'user'; $input['_itil_assign']['users_id'] = 4; $ticket->update($input); $GLPIlog->testSQLlogs('11/'); $GLPIlog->testPHPlogs('11/'); // * 12/ sleep(1); // * 13/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[13] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['_itil_assign']['_type'] = 'group'; $input['_itil_assign']['groups_id'] = 1; $ticket->update($input); $input['_itil_assign']['_type'] = 'user'; $input['_itil_assign']['users_id'] = 2; $ticket->update($input); $GLPIlog->testSQLlogs('13/'); $GLPIlog->testPHPlogs('13/'); $ticket->getFromDB(1); $this->assertEquals('waiting', $ticket->fields['status'], '(13/)May have always status waiting'); // * 14/ $input = array(); $input['id'] = 2; $input['itickets_id'] = $tickets_id; $group_ticket->check($input['id'], 'w'); $group_ticket->delete($input); $GLPIlog->testSQLlogs('14/'); $GLPIlog->testPHPlogs('14/'); $a_db = getAllDatasFromTable('glpi_groups_tickets'); $a_ref = array(); $a_ref[3] = array('id' => '3', 'tickets_id' => '1', 'groups_id' => '1', 'type' => '2'); $this->assertEquals($a_ref, $a_db, '(14/) May have ticket assigned to group1'); $ticket->getFromDB(1); $this->assertEquals('waiting', $ticket->fields['status'], '(14/) Status is waiting'); // * 15/ sleep(2); // * 16/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[16] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['status'] = Ticket::ASSIGNED; $ticket->update($input); $GLPIlog->testSQLlogs('16/'); $GLPIlog->testPHPlogs('16/'); // * 17/ sleep(1); // * 18/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[18] = $_SESSION["glpi_currenttime"]; $input = array(); $input['id'] = $tickets_id; $input['solution'] = "solution"; $ticket->update($input); $GLPIlog->testSQLlogs('18/'); $GLPIlog->testPHPlogs('18/'); $ticket->getFromDB(1); $this->assertEquals('solved', $ticket->fields['status'], '(18/) Status is solved'); if ($closed) { // * 19/ sleep(1); // * 20/ $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s"); $a_storedate[20] = $_SESSION["glpi_currenttime"]; $fup = new TicketFollowup(); $input = array(); $input['tickets_id'] = $tickets_id; $input['add_close'] = 'add_close'; $fup->add($input); $GLPIlog->testSQLlogs('20/'); $GLPIlog->testPHPlogs('20/'); $ticket->getFromDB(1); $this->assertEquals('closed', $ticket->fields['status'], '(19/) Status is closed'); } self::$storedate = $a_storedate; }