foreach ($customfield as $cf => $value) {
         $params["custom[{$cf}]"] = $value;
     }
     ## Submit the ticket to Sirportly
     $sirportlyTicket = _doSirportlyAPICall('tickets/submit', $params);
     ## Check to see if we encountered any errors
     if (checkForSirportlyErrors($sirportlyTicket)) {
         $step = 2;
         $formattedErrorMessages = formatSirportlyErrors($ticket['errors']);
         $ca->assign('errormessage', $formattedErrorMessages);
         $ca->setTemplate('/templates/sirportly/supportticketsubmit-steptwo.tpl');
         $ca->output();
         return;
     }
     ## Add the first update
     $sirportlyTicketUpdate = _doSirportlyAPICall('tickets/post_update', array('ticket' => $sirportlyTicket['reference'], 'authenticated' => true, 'attachments' => implode($attachedFiles), 'contact' => $sirportlyTicket['contact']['id'], 'message' => $message));
     ## Set the ticket variables
     $_SESSION['tempticketdata'] = array('tid' => $sirportlyTicket['reference'], 'c' => $sirportlyTicket['id'], 'subject' => $sirportlyTicket['subject']);
     ## Redirect to the next step
     redir("step=4");
     break;
 case '4':
     $ca->assign("tid", $_SESSION['tempticketdata']['tid']);
     $ca->assign("c", $_SESSION['tempticketdata']['c']);
     $ca->assign("subject", $_SESSION['tempticketdata']['subject']);
     $ca->setTemplate('/templates/sirportly/supportticketsubmit-confirm.tpl');
     break;
 default:
     $ca->assign("departments", $departments);
     $ca->setTemplate('/templates/sirportly/supportticketsubmit-stepone.tpl');
     break;
Esempio n. 2
0
function sirportly_upload_attachments($attachments)
{
    include "config.php";
    $returnArray = array();
    $attachments = rearray_uploaded_files($attachments);
    foreach ($attachments as $attachment) {
        $params = array('file' => '@' . $attachment['tmp_name'], 'filename' => $attachment['name']);
        $sirportlyAttachment = _doSirportlyAPICall('tickets/add_attachment', $params);
        $returnArray[] = $sirportlyAttachment['temporary_token'];
    }
    return $returnArray;
}
Esempio n. 3
0
    }
}
## Add an update to the ticket
if ($postreply) {
    check_token();
    if (!$replymessage) {
        $errormessage .= "<li>" . $_LANG['supportticketserrornomessage'];
    }
    $ca->assign('postingReply', isset($postreply));
    $ca->assign('errormessage', $errormessage);
    ## If we're error free attempt to submit the update to Sirportly
    if (!$errormessage) {
        ## Upload any attachments and store their tokens
        $attachedFiles = sirportly_upload_attachments($_FILES['attachments']);
        ## Submit the update
        $sirportlyTicketUpdate = _doSirportlyAPICall('tickets/post_update', array('ticket' => $tid, 'message' => $replymessage, 'attachments' => implode($attachedFiles), 'contact' => $sirportlyContact));
        ## Check to see if we encountered any errors
        if (checkForSirportlyErrors($sirportlyTicketUpdate)) {
            $formattedErrorMessages = formatSirportlyErrors($update['errors']);
            $ca->assign('errormessage', $formattedErrorMessages);
        } else {
            redir("tid=" . $tid . "&c=" . $c);
        }
    }
}
## Setup the updates
$updates = array();
foreach ($response['updates'] as $update) {
    if (!$update['private']) {
        ## Sort the attachments
        $attachments = array();