Ejemplo n.º 1
0
     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();
             }
             Ticket::showSubForm($item, $_POST["id"], array('parent' => $parent, 'tickets_id' => $_POST["tickets_id"]));
         } else {
             _e('Access denied');
         }
     } else {
         if ($_POST['type'] == "Solution") {
             $ticket = new Ticket();
             $ticket->getFromDB($_POST["tickets_id"]);
             if (!isset($_REQUEST['load_kb_sol'])) {
                 $_REQUEST['load_kb_sol'] = 0;
             }
             $ticket->showSolutionForm($_REQUEST['load_kb_sol']);