include '../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Session::checkLoginUser(); if (!isset($_POST['action'])) { exit; } switch ($_POST['action']) { case "change_task_state": if (!isset($_POST['tasks_id'])) { exit; } $task = new TicketTask(); $task->getFromDB(intval($_POST['tasks_id'])); if (!in_array($task->fields['state'], array(0, Planning::INFO))) { echo $new_state = $task->fields['state'] == Planning::DONE ? Planning::TODO : Planning::DONE; $task->update(array('id' => intval($_POST['tasks_id']), 'tickets_id' => intval($_POST['tickets_id']), 'state' => $new_state)); } break; case "viewsubitem": Html::header_nocache(); if (!isset($_POST['type'])) { exit; } if (!isset($_POST['parenttype'])) { exit; } if (($item = getItemForItemtype($_POST['type'])) && ($parent = getItemForItemtype($_POST['parenttype']))) { if (isset($_POST[$parent->getForeignKeyField()]) && isset($_POST["id"]) && $parent->getFromDB($_POST[$parent->getForeignKeyField()])) { $ol = ObjectLock::isLocked($_POST['parenttype'], $parent->getID()); if ($ol && Session::getLoginUserID() != $ol->fields['users_id']) { ObjectLock::setReadOnlyProfile();
/** * Transfer task categories for specified tickets * * @param $ID original ticket ID * @param $newID new ticket ID **/ function transferTicketTaskCategory($ID, $newID) { global $DB; $task = new TicketTask(); $query = "SELECT *\n FROM `glpi_tickettasks`\n WHERE `tickets_id` = '{$ID}'"; if ($result = $DB->query($query)) { if ($DB->numrows($result) != 0) { while ($data = $DB->fetch_assoc($result)) { $input = array(); if ($data['taskcategories_id'] > 0) { $categ = new TaskCategory(); if ($categ->getFromDB($data['taskcategories_id'])) { $inputcat['entities_id'] = $this->to; $inputcat['completename'] = $categ->fields['completename']; $catid = $categ->findID($inputcat); if ($catid < 0) { $catid = $categ->import($inputcat); } $input['id'] = $data['id']; $input['tickets_id'] = $ID; $input['taskcategories_id'] = $catid; $task->update($input); } } } } } }
-------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- define('GLPI_ROOT', '..'); include GLPI_ROOT . "/inc/includes.php"; checkCentralAccess(); $task = new TicketTask(); if (isset($_POST["add"])) { $task->check(-1, 'w', $_POST); $task->add($_POST); Event::log($task->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]); glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $task->getField('tickets_id')); } else { if (isset($_POST["delete"])) { $task->check($_POST['id'], 'd'); $task->delete($_POST); Event::log($task->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]); glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $task->getField('tickets_id')); } else { if (isset($_POST["update"])) { $task->check($_POST["id"], 'w'); $task->update($_POST); Event::log($task->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]); glpi_header($_SERVER['HTTP_REFERER']); } } } displayErrorAndDie('Lost');