<?php

/**
 * Sirportly WHMCS Support Tickets Module
 * @copyright Copyright (c) 2015 aTech Media Ltd
 * @version 3.0
 */
use WHMCS\ClientArea;
define("CLIENTAREA", true);
## Required files
require_once ROOTDIR . "/includes/sirportly/functions.php";
include ROOTDIR . "/includes/sirportly/config.php";
$ca = new ClientArea();
$ca->setPageTitle($_LANG['supportticketssubmitticket']);
$ca->addToBreadCrumb('index.php', $whmcs->get_lang('globalsystemname'));
$ca->addToBreadCrumb('clientarea.php', $whmcs->get_lang('clientareatitle'));
$ca->addToBreadCrumb('supporttickets.php', $whmcs->get_lang('supportticketspagetitle'));
$ca->addToBreadCrumb('submitticket.php', $whmcs->get_lang('supportticketssubmitticket'));
$ca->initPage();
## Return custom fields
if ($action == 'fetchcustomfields') {
    $sirportlyCustomFields = sirportlyCustomFields($deptid, $customfield);
    $ca->assign("customfields", $sirportlyCustomFields);
    echo $smarty->fetch($CONFIG['Template'] . "/supportticketsubmit-customfields.tpl");
    exit;
}
## Setup the menus
Menu::addContext('support_module', 'sirportly');
## Load the sirportly contact
$sirportlyContact = findOrCreateSirportlyContact($_SESSION['uid'], $_SESSION['cid']);
# Fetch the WHMCS client