ticket config : select product type matching tickets.

This commit is contained in:
Thomas Negre 2022-02-28 17:51:37 +01:00
parent 2cf433019e
commit 5fba0dc237
2 changed files with 38 additions and 5 deletions

View File

@ -26,6 +26,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php";
// Load translation files required by the page
$langs->loadLangs(array("admin", "ticket"));
@ -157,6 +158,14 @@ if ($action == 'setvarworkflow') {
}
}
if ($action == 'setvarworkflowother' || $action == 'setvarworkflow') {
$param_ticket_product_category = GETPOST('product_category_id', 'int');
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
@ -219,7 +228,7 @@ if ($action == 'setvarother') {
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$form = new Form($db);
$form = new FormCategory($db);
$help_url = "FR:Module_Ticket";
$page_name = "TicketSetup";
@ -489,8 +498,7 @@ foreach ($dirmodels as $reldir) {
print '</table>';
print '</div><br>';
if (!$conf->use_javascript_ajax) {
if (empty($conf->use_javascript_ajax)) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarworkflow">';
@ -551,10 +559,33 @@ print $form->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, '
print '</td>';
print '</tr>';
if (!$conf->use_javascript_ajax) {
print '</form>';
// Choose which product category is used for tickets
if ($conf->use_javascript_ajax) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarworkflowother">';
}
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
print '<td class="left">';
$form->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
if ($conf->use_javascript_ajax) {
print ajax_combobox('select_'.$htmlname);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
print '<div class="center">';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
// Define wanted maximum time elapsed before answers to tickets
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="action" value="setvarother">';

View File

@ -145,6 +145,8 @@ TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received
TicketsAutoNotifyClose=Automatically notify thirdparty when closing a ticket
TicketsAutoNotifyCloseHelp=When closing a ticket, you will be proposed to send a message to one of thirdparty's contacts. On mass closing, a message will be sent to one contact of the thirdparty linked to the ticket.
TicketWrongContact=Provided contact is not part of current ticket contacts. Email not sent.
TicketChooseProductCategory=Product category for ticket support
TicketChooseProductCategoryHelp=Select the product category of ticket support. This will be used to automatically link a contract to a ticket.
#
# Index & list page