if ($_REQUEST['step'] == 2) { if (!empty($_POST['departmentid'])) { // get priorities of 'public' type only $_ticketPriorityContainer = kyTicketPriority::getAll()->filterByType(kyTicketPriority::TYPE_PUBLIC)->orderByDisplayOrder(); $_ticketPriorities = []; foreach ($_ticketPriorityContainer as $_ticketPriorityObject) { $_ticketPriority['priorityid'] = $_ticketPriorityObject->getId(); $_ticketPriority['title'] = $_ticketPriorityObject->getTitle(); $_ticketPriorities[] = $_ticketPriority; } $smarty->assign('_ticketPriorities', $_ticketPriorities); //Get Ticket Custom fields $_customFieldObjectContainer = kyCustomFieldDefinition::getAll(); $_customFields = []; foreach ($_customFieldObjectContainer as $_customFieldObject) { $_customFields[$_customFieldObject->getGroupId()][] = RenderCustomField($_customFieldObject, MODE_INSERT); } // Custom field groups $_customFieldGroupContainer = []; // fetch custom field groups based on selected department $_customFieldGroupObjectContainer = kyCustomFieldGroup::getAll(['departmentid' => $_POST['departmentid']])->filterByGroupType([kyCustomFieldGroup::GROUP_STAFFTICKET, kyCustomFieldGroup::GROUP_STAFFUSERTICKET, kyCustomFieldGroup::GROUP_USERTICKET]); foreach ($_customFieldGroupObjectContainer as $_customFieldGroupObject) { if (isset($_customFields[$_customFieldGroupObject->getId()])) { $_customFieldGroup = []; $_customFieldGroup['title'] = $_customFieldGroupObject->getTitle(); $_customFieldGroup['_fields'] = $_customFields[$_customFieldGroupObject->getId()]; $_customFieldGroupContainer[$_customFieldGroupObject->getId()] = $_customFieldGroup; } } $smarty->assign('_customFieldGroupContainer', $_customFieldGroupContainer); $smarty->assign('_ticketFormURL', WHMCS_URL . 'submitticket.php?step=3');
$_ticketAttachment['name'] = $_attachmentObject->getFileName(); $_ticketAttachment['size'] = FormattedSize($_attachmentObject->getFileSize()); $_fileExtension = mb_strtolower(substr($_ticketAttachment['name'], strrpos($_ticketAttachment['name'], '.') + 1)); $_mimeData = GetMimeData($_fileExtension); $_attachmentIcon = 'icon_file.gif'; if (isset($_mimeData[1])) { $_attachmentIcon = $_mimeData[1]; } $_ticketAttachment['icon'] = $_attachmentIcon; $_ticketAttachment['link'] = WHMCS_URL . 'viewticket.php?tid=' . $_GET['ticketid'] . '&aid=' . $_attachmentObject->getId(); $_ticketAttachmentContainer[] = $_ticketAttachment; } $_ticketPost['attachments'] = $_ticketAttachmentContainer; $_ticketPostContainer[$_ticketPost['ticketpostid']] = $_ticketPost; } //Process customfields $_customFieldGroupContainer = array(); $_customFieldGroupObjectContainer = $_ticketObject->getCustomFieldGroups(); foreach ($_customFieldGroupObjectContainer as $_customFieldGroupObject) { $_customFieldGroup['title'] = $_customFieldGroupObject->getTitle(); $_customFieldGroup['_fields'] = array(); $_customFieldObjectContainer = $_customFieldGroupObject->getFields(); foreach ($_customFieldObjectContainer as $_customFieldObject) { $_customFieldGroup['_fields'][] = RenderCustomField($_customFieldObject, MODE_EDIT); } $_customFieldGroupContainer[$_customFieldGroupObject->getId()] = $_customFieldGroup; } $smarty->assign('_ticketContainer', $_ticketContainer); $smarty->assign('_ticketPostContainer', $_ticketPostContainer); $smarty->assign('_customFieldGroupContainer', $_customFieldGroupContainer); }