Ejemplo n.º 1
0
require '../../include/easyscp-lib.php';
check_login(__FILE__);
$reseller_id = $_SESSION['user_created_by'];
if (!hasTicketSystem($reseller_id)) {
    user_goto('index.php');
}
$back_url = 'ticket_system.php';
$user_id = $_SESSION['user_id'];
if (isset($_GET['ticket_id']) && $_GET['ticket_id'] != '') {
    $ticket_id = $_GET['ticket_id'];
    $user_id = $_SESSION['user_id'];
    $query = "\n\t\tSELECT\n\t\t\t`ticket_status`\n\t\tFROM\n\t\t\t`tickets`\n\t\tWHERE\n\t\t\t`ticket_id` = ?\n\t\tAND\n\t\t\t(`ticket_from` = ? OR `ticket_to` = ?)\n\t;";
    $rs = exec_query($sql, $query, array($ticket_id, $user_id, $user_id));
    if ($rs->recordCount() == 0) {
        user_goto('ticket_system.php');
    }
    $back_url = getTicketStatus($ticket_id) == 0 ? 'ticket_closed.php' : 'ticket_system.php';
    deleteTicket($ticket_id);
    write_log(sprintf("%s: deletes support ticket %d", $_SESSION['user_logged'], $ticket_id));
    set_page_message(tr('Support ticket deleted successfully!'), 'info');
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'open') {
    deleteTickets('open', $user_id);
    write_log(sprintf("%s: deletes all open support tickets.", $_SESSION['user_logged']));
    set_page_message(tr('All open support tickets deleted successfully!'), 'info');
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'closed') {
    deleteTickets('closed', $user_id);
    write_log(sprintf("%s: deletes all closed support ticket.", $_SESSION['user_logged']));
    set_page_message(tr('All closed support tickets deleted successfully!'), 'info');
    $back_url = 'ticket_closed.php';
}
user_goto($back_url);
Ejemplo n.º 2
0
customerHasFeature('support') or showBadRequestErrorPage();
$userId = $_SESSION['user_id'];
$previousPage = 'ticket_system';
if (isset($_GET['ticket_id']) && !empty($_GET['ticket_id'])) {
    $ticketId = (int) $_GET['ticket_id'];
    $query = "\n\t\tSELECT\n\t\t\t`ticket_status`\n\t\tFROM\n\t\t\t`tickets`\n\t\tWHERE\n\t\t\t`ticket_id` = ?\n\t\tAND\n\t\t\t(`ticket_from` = ? OR `ticket_to` = ?)\n\t";
    $stmt = exec_query($query, array($ticketId, $userId, $userId));
    if ($stmt->rowCount() == 0) {
        set_page_message(tr("Ticket with Id '%d' was not found.", $ticketId), 'error');
        redirectTo($previousPage . '.php');
    }
    // The ticket status was 0 so we come from ticket_closed.php
    if ($stmt->fields['ticket_status'] == 0) {
        $previousPage = 'ticket_closed';
    }
    deleteTicket($ticketId);
    set_page_message(tr('Ticket successfully deleted.'), 'success');
    write_log(sprintf("%s: deleted ticket %d", $_SESSION['user_logged'], $ticketId), E_USER_NOTICE);
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'open') {
    deleteTickets('open', $userId);
    set_page_message(tr('All open tickets were successfully deleted.'), 'success');
    write_log(sprintf("%s: deleted all open tickets.", $_SESSION['user_logged']), E_USER_NOTICE);
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'closed') {
    deleteTickets('closed', $userId);
    set_page_message(tr('All closed tickets were successfully deleted.'), 'success');
    write_log(sprintf("%s: deleted all closed tickets.", $_SESSION['user_logged']), E_USER_NOTICE);
    $previousPage = 'ticket_closed';
} else {
    set_page_message(tr('Unknown action requested.'), 'error');
}
redirectTo($previousPage . '.php');