Beispiel #1
0
function changeTicketStatus($user, $ticket, $status)
{
    global $db;
    $statuses = getTicketsStatuses();
    $old_ticket = getTicket($ticket);
    $comments = $old_ticket['comments_id'];
    $autocomment = "Изменил статус на \"" . $statuses[$status]["name"] . "\".";
    $query_autocomment = $db->query("INSERT INTO helpdesk_comments (`creator`, `date`, `text`,`autocomment`)\r\n                                                              VALUES ('{$user}', NOW(), '{$autocomment}',true)");
    if ($query_autocomment) {
        $autocomment_id = $db->insert_id();
        $comments = $comments . (strlen($comments) > 0 ? "," : "") . $autocomment_id;
    }
    if ($status != $old_ticket["status"]) {
        $change_status_query = "INSERT INTO helpdesk_history (`changed`, `changer`, `ticket`,  `status`)\r\n                                                      VALUES ( NOW(),   '{$user}',   '{$ticket}', '{$status}')";
        $db->query($change_status_query);
    }
    $changed = "";
    if (in_array($status, [1, 2, 3, 5, 7, 8])) {
        $changed = ", `changed`=NOW(), `changer`='{$user}'";
    }
    $query_upd = $db->query("UPDATE helpdesk SET `status`='{$status}', `comments`='{$comments}' " . $changed . " WHERE `id`='{$ticket}'");
    if ($query_upd) {
        $result['success'] = true;
        $result['msg'] = "Статус изменен на \"" . $statuses[$status]["name"] . "\"!";
    } else {
        $result['success'] = false;
    }
    return $result;
}
Beispiel #2
0
    } elseif (checkRequest('list')) {
        header("Location: {$url}?list");
    } else {
        header("Location: {$url}");
    }
}
if ($c = isKnownUser($_SESSION['username'], $_SESSION['userpass'])) {
    $uid = $c["uid"];
    $users = getUsers();
    $c['MONTHS_G'] = $MONTHS_G;
    $c['usercomp'] = $_SESSION['usercomp'];
    $c['useros'] = $_SESSION['useros'];
    $c['dir'] = 'helpdesk';
    $c['admins'] = getAdmins();
    $c['users'] = $users;
    $c['statuses'] = getTicketsStatuses();
    $c['msg'] = $_SESSION['msg'];
    unset($_SESSION['msg']);
    $c['msg_type'] = $_SESSION['msg_type'];
    unset($_SESSION['msg_type']);
    $c["is_boss"] = in_array($users[$uid]['post_id'], [1, 5, 9, 37, 68, 21, 60, 25, 51, 29, 35, 57, 59, 40, 46]);
    if (isset($_REQUEST['list']) or isset($_REQUEST['dept_list'])) {
        $c['section'] = checkRequest('list') !== false ? 'list' : (checkRequest('dept_list') !== false ? 'dept_list' : "");
        $section = 'list';
        $c["pagename"] = "Мои заявки :: Задачник IT";
        $c['access_level'] = $ACCESS_LEVEL;
        $creator = $c["uid"];
        if ($c["is_boss"]) {
            $dept_users = getUsersListByDept($users[$uid]['dept_id']);
            if ($c['section'] == 'dept_list') {
                $creator = implode(",", $dept_users);
Beispiel #3
0
     break;
 case 'getTicketInfo':
     require_once "../vendor/autoload.php";
     // Twig инициализация
     Twig_Autoloader::register();
     $loader = new Twig_Loader_Filesystem("../templates/helpdesk");
     // Twig папка с шаблонами
     $twig = new Twig_Environment($loader, array("cache" => ""));
     // Twig no cache
     $id = $_POST['ticket_id'];
     $AREAS = getAreas();
     $ADMINS = getAdmins();
     $query_info = "SELECT\r\n                                    `id`,\r\n                                    `title`,\r\n                                    `creator`,\r\n                                    `contractor`,\r\n                                    `performers`,\r\n                                    `area`,\r\n                                    `description`,\r\n                                    DATE_FORMAT(`created`, '%d.%m.%Y') as `created`,\r\n                                    DATE_FORMAT(`changed`, '%d.%m.%Y') as `changed`,\r\n                                    DATE_FORMAT(`deadline`,'%d.%m.%Y') as `deadline`,\r\n                                    `type`,\r\n                                    `status`,\r\n                                    `parent`,\r\n                                    `tags`,\r\n                                    `comments`,\r\n                                    `category`,\r\n                                    `access`\r\n                                        FROM helpdesk WHERE `id`={$id}";
     if ($query_info_res = $db->query($query_info)) {
         $info_data = $db->fetch_assoc($query_info_res);
         $info_data['statuses'] = getTicketsStatuses();
         $info_data['types'] = getTicketsTypes();
         $info_data['categories'] = getTicketsCategories();
         $info_data['admins'] = $ADMINS;
         $info_data['comments'] = getTicketComments($id);
         $info_data['areas'] = $AREAS;
         $result['ticket_info'] = $twig->render('ticket_info.twig', $info_data);
         unset($result['msg']);
     }
     break;
 case "saveNewComment":
     $ticket_id = check_string($_REQUEST['ticket_id'], 'digits');
     $result['ticket_id'] = $ticket_id;
     $text = check_string($_REQUEST['text'], 'text');
     $result['text'] = $text;
     $admin_id = $admin_login['uid'];
Beispiel #4
0
require_once "../vendor/autoload.php";
// Twig инициализация
require_once "./subs.php";
require_once "./conf.php";
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => "../cache", "auto_reload" => 1));
// Twig no cache
$template = 'helpdesk.twig';
$stage = checkRequest("stage");
// Стадия
if ($admin_login = isAuthorized()) {
    $comments = [];
    $TITLE['helpdesk/reports'] = "Отчёты";
    $STATUSES = getTicketsStatuses();
    $c['MONTHS_G'] = $MONTHS_G;
    $c['admin_fio'] = $admin_login["lastname"] . " " . $admin_login["firstname"];
    $c['admin_id'] = $admin_login["uid"];
    $c['statuses'] = $STATUSES;
    $c['access_level'] = $ACCESS_LEVEL;
    $c['dir'] = basename(__DIR__);
    $c['notify'] = getBurnedCounts($admin_login["uid"]);
    $c['filter'] = checkRequest("filter");
    $c['search'] = checkRequest("search");
    $c['stage'] = checkRequest("stage");
    $c['pagename'] = "helpdesk";
    $c["msg"] = $_SESSION["msg"];
    $c["msg_type"] = $_SESSION["msg_type"];
    $default_order = '`status_order`,(CASE WHEN `deadline`=0 THEN 1 ELSE 0 END), deadline';
    if (!isset($page_title)) {