</tr> <tr> <td><?php echo $list->getDisplayId(); ?> </td> <td><?php echo date('M d, Y h:i A', strtotime($list->getLastActivity())); ?> </td> <td><?php echo $list->getLastReplier(); ?> </td> <td><?php echo kyDepartment::get($list->getDepartmentId())->getTitle(); ?> </td> <td><?php echo kyTicketType::get($list->getTypeId())->getTitle(); ?> </td> <td><?php echo kyTicketStatus::get($list->getStatusId())->getTitle(); ?> </td> <td style=" background-color: <?php echo kyTicketPriority::get($list->getPriorityId())->getBackgroundColor(); ?> ;"> <span style="color: <?php
/** * Returns department object associated with the ticket. * * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyDepartment */ public function getDepartment($reload = false) { if ($this->department !== null && !$reload) { return $this->department; } if ($this->department_id === null) { return null; } $this->department = kyDepartment::get($this->department_id); return $this->department; }
/** * Retrieve Department by ID * * @param int $department_id * * @return object */ public function getDepartmentByID($department_id) { $department = kyDepartment::get($department_id); return $department; }
$smarty->assign('_templateURL', getcwd() . '/templates/kayako'); $smarty->assign('_imageURL', WHMCS_URL . 'templates/kayako/images'); $templatefile = 'ticketform'; } else { header('Location: ' . WHMCS_URL . 'submitticket.php'); } } else { if ($_REQUEST['step'] == 3) { if (!empty($_POST)) { //Set Defaults for a new ticket $_defaultStatusID = kyTicketStatus::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId(); $_defaultPriorityID = kyTicketPriority::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId(); $_defaultTypeID = kyTicketType::getAll()->filterByType(kyTicketStatus::TYPE_PUBLIC)->first()->getId(); kyTicket::setDefaults($_defaultStatusID, $_defaultPriorityID, $_defaultTypeID); //Create ticket $_department = kyDepartment::get($_POST['departmentid']); $_priority = kyTicketPriority::get($_POST['ticketpriorityid']); $_ticket = kyTicket::createNewAuto($_department, $clientsdetails['firstname'] . ' ' . $clientsdetails['lastname'], $clientsdetails['email'], $_POST['ticketmessage'], $_POST['ticketsubject'])->setPriority($_priority)->setIgnoreAutoResponder($_settings['ignoreautoresponder'])->create(); $_ticketPosts = $_ticket->getPosts(); //Save ticket attachments foreach ($_FILES['ticketattachments']['tmp_name'] as $_key => $_ticketAttachment) { kyTicketAttachment::createNewFromFile($_ticketPosts[0], $_ticketAttachment, $_FILES['ticketattachments']['name'][$_key])->create(); } //Save custom fields $_ticket->setCustomFieldValuesFromPOST(); $_ticket->updateCustomFields(); $smarty->assign('_ticketDisplayID', $_ticket->getDisplayId()); $smarty->assign('_ticketSubject', $_POST['ticketsubject']); $smarty->assign('_ticketMessage', nl2br($_POST['ticketmessage'])); $templatefile = 'ticketConfirmation'; } else {
echo !$form_valid && $fields_valid['contents'] !== true ? ' error' : ''; ?> ">Provide the contents of your request.</span> </label> </fieldset> <input type="submit" name="submit_general" value="Submit"> </form> <?php } //we are submitting the ticket; we are doing this before rendering Custom Fields form because there is no way to load them before creating the ticket (see http://dev.kayako.com/browse/SWIFT-2391 for improvement request) if ($render === 'submit') { //load the department we've chosen in Department form /** @var $department kyDepartment */ $department = kyDepartment::get($department_id); //load default ticket status (based on DEFAULT_TICKET_STATUS_NAME constant defined at top of the file) $status_id = kyTicketStatus::getAll()->filterByTitle(DEFAULT_TICKET_STATUS_NAME)->first()->getId(); //initialize default ticket status (loaded line before), priority (from General Information form) and type (from General Information form) kyTicket::setDefaults($status_id, $priority_id, $type_id); //create the ticket /** @var $ticket kyTicket */ $ticket = kyTicket::createNewAuto($department, $creator_full_name, $creator_email, $contents, $subject)->create(); //get ticket id $ticket_id = $ticket->getId(); //load ticket custom fields $file_custom_field_present = true; $ticket_custom_fields = get_ticket_custom_fields($ticket, $file_custom_field_present); if (count($ticket_custom_fields) > 0) { //load custom field default values $custom_field_values = array();
?> </div> <table id="ticket"> <tr> <th>Department</th> <th>Owner</th> <th>Type</th> <th>Status</th> <th style="background-color: <?php echo kyTicketPriority::get($ticket_details->getPriorityId())->getBackgroundColor(); ?> ;">Priority</th> </tr> <tr> <td><?php echo kyDepartment::get($ticket_details->getDepartmentId())->getTitle(); ?> </td> <td><?php echo $ticket_details->getFullName(); ?> </td> <td><?php echo kyTicketType::get($ticket_details->getTypeId())->getTitle(); ?> </td> <td> <select name="status"> <?php foreach ($status_list as $status) { ?>
/** * Create urgent ticket providing only name and e-mail of the user. * * @return ticket mask id */ public function createTickets() { $input = JFactory::getApplication()->input; $form_value = $input->getArray(array('fname' => null, 'mail' => null, 'message' => null, 'subject' => null, 'dep_type' => null, 'priority' => null, 'status' => null, 'type' => null)); if ($form_value['dep_type'] == null || $form_value['fname'] == null || $form_value['mail'] == null || $form_value['priority'] == null || $form_value['status'] == null || $form_value['type'] == null || $form_value['subject'] == null || $form_value['message'] == null) { return false; } else { require_once 'modules/mod_kayako/includes/kayako-php-api/kyIncludes.php'; JTickets::init(); kyTicket::setDefaults($form_value['status'], $form_value['priority'], $form_value['type']); //Create urgent ticket providing only name and e-mail of the user. $ticket = kyTicket::createNewAuto(kyDepartment::get($form_value['dep_type']), $form_value['fname'], $form_value['mail'], $form_value['message'], $form_value['subject'])->create(); //get ticket id $ticket_mask_id = $ticket->getDisplayId(); return $ticket_mask_id; } }