|
98 | 98 | } |
99 | 99 | } |
100 | 100 |
|
| 101 | +if ($action == 'update_ticket_public_interface_url') { |
| 102 | + $urlInfos = ['origin', 'short', 'external']; |
| 103 | + $publicInterfaceTypes = array_merge(['current'], isModEnabled('multicompany') ? ['multicompany'] : []); |
| 104 | + foreach ($publicInterfaceTypes as $publicInterfaceType) { |
| 105 | + $radio = GETPOST($publicInterfaceType . '_ticket_public_interface_url'); |
| 106 | + foreach ($urlInfos as $urlType) { |
| 107 | + if ($radio != $urlType . dol_ucfirst($publicInterfaceType) . 'TicketPublicInterfaceURL') { |
| 108 | + continue; |
| 109 | + } |
| 110 | + |
| 111 | + $url = GETPOST($urlType . '_' . $publicInterfaceType . '_ticket_public_interface_url', 'custom', 0, FILTER_SANITIZE_URL); |
| 112 | + if (empty($url)) { |
| 113 | + setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities(dol_ucfirst($urlType) . 'URL')) . '<br>' . $langs->transnoentities(dol_ucfirst($publicInterfaceType) . 'TicketPublicInterfaceURL'), [], 'errors'); |
| 114 | + header('Location: ' . $_SERVER['PHP_SELF'] . '?page_y=' . $pageY); |
| 115 | + exit; |
| 116 | + } |
| 117 | + |
| 118 | + dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_' . dol_strtoupper($publicInterfaceType) . '_PUBLIC_INTERFACE_URL_' . dol_strtoupper($urlType), $url, 'chaine', 0, '', $conf->entity); |
| 119 | + } |
| 120 | + |
| 121 | + dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_' . dol_strtoupper($publicInterfaceType) . '_PUBLIC_INTERFACE_RADIO', $radio, 'chaine', 0, '', $conf->entity); |
| 122 | + } |
| 123 | + |
| 124 | + setEventMessages('SavedConfig', []); |
| 125 | + header('Location: ' . $_SERVER['PHP_SELF'] . '?page_y=' . $pageY); |
| 126 | + exit; |
| 127 | +} |
| 128 | + |
101 | 129 | if ($action == 'setEmails') { |
102 | 130 | dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_SUBMITTED_SEND_MAIL_TO', GETPOST('emails'), 'integer', 0, '', $conf->entity); |
103 | 131 | setEventMessages($langs->transnoentities('EmailsToNotifySet'), array()); |
|
308 | 336 |
|
309 | 337 | print dol_get_fiche_head($head, 'ticket', $title, -1, "digiriskdolibarr_color@digiriskdolibarr"); |
310 | 338 |
|
311 | | -print load_fiche_titre('<i class="fa fa-ticket-alt"></i> ' . $langs->transnoentities("TicketManagement"), '', ''); |
312 | | -print '<hr>'; |
313 | | -print load_fiche_titre($langs->transnoentities("PublicInterface"), '', ''); |
314 | | - |
315 | | -print '<span class="opacitymedium">' . $langs->transnoentities("DigiriskTicketPublicAccess") . '</span> : <a class="wordbreak" href="' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php?entity=' . $conf->entity, 1) . '" target="_blank" >' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php?entity=' . $conf->entity, 2) . '</a>'; |
316 | | - |
317 | | -if (isModEnabled('multicompany')) { |
318 | | - print load_fiche_titre($langs->transnoentities("MultiEntityPublicInterface"), '', ''); |
319 | | - |
320 | | - print '<span class="opacitymedium">' . $langs->transnoentities("DigiriskTicketPublicAccess") . '</span> : <a class="wordbreak" href="' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php', 1) . '" target="_blank" >' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php', 2) . '</a>'; |
321 | | -} |
322 | | - |
323 | | -print dol_get_fiche_end(); |
324 | | - |
325 | 339 | $enableDisableHtml = $langs->transnoentities("TicketActivatePublicInterface") . ' '; |
326 | 340 | if (empty($conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE)) { |
327 | 341 | // Button off, click to enable |
|
339 | 353 | print '<br><br>'; |
340 | 354 |
|
341 | 355 | if ($conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE == 1) { |
| 356 | + |
| 357 | + // Public interface configuration |
| 358 | + print load_fiche_titre($langs->transnoentities('TicketsPublicInterfaceConfig'), '', ''); |
| 359 | + |
| 360 | + print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '" name="ticket_public_interface_form">'; |
| 361 | + print '<input type="hidden" name="token" value="' . newToken() . '">'; |
| 362 | + print '<input type="hidden" name="action" value="update_ticket_public_interface_url">'; |
| 363 | + print '<input type="hidden" name="page_y">'; |
| 364 | + print '<table class="noborder centpercent">'; |
| 365 | + print '<tr class="liste_titre">'; |
| 366 | + print '<td>' . $langs->transnoentities('Name') . '</td>'; |
| 367 | + print '<td class="widthcentpercentminusx">' . $langs->transnoentities('Value') . '</td>'; |
| 368 | + print '</tr>'; |
| 369 | + |
| 370 | + // Ticket public interface URL |
| 371 | + $urlInfos = [ |
| 372 | + 'origin' => 'https://dolibarr.org', |
| 373 | + 'short' => 'https://demo.digirisk.com/registre', |
| 374 | + 'external' => 'https://evarisk.com/help' |
| 375 | + ]; |
| 376 | + $publicInterfaceTypes = array_merge(['current'], isModEnabled('multicompany') ? ['multicompany'] : []); |
| 377 | + foreach ($publicInterfaceTypes as $publicInterfaceType) { |
| 378 | + print '<tr class="oddeven"><td>' . $langs->transnoentities(dol_ucfirst($publicInterfaceType) . 'TicketPublicInterfaceURL') . '</td>'; |
| 379 | + print '<td class="widthcentpercentminusx">'; |
| 380 | + foreach ($urlInfos as $urlType => $placeholder) { |
| 381 | + print '<input type="radio" id="' . $urlType . '-' . $publicInterfaceType . '-ticket-public-interface-url" name="' . $publicInterfaceType . '_ticket_public_interface_url" value="' . $urlType . dol_ucfirst($publicInterfaceType) . 'TicketPublicInterfaceURL"' . (getDolGlobalString('DIGIRISKDOLIBARR_TICKET_' . dol_strtoupper($publicInterfaceType) . '_PUBLIC_INTERFACE_RADIO') == $urlType . dol_ucfirst($publicInterfaceType) . 'TicketPublicInterfaceURL' ? 'checked' : '') . '/>'; |
| 382 | + $link = img_picto('', 'external-link-alt', 'class="paddingright"'); |
| 383 | + $ticketPublicInterfaceURL = getDolGlobalString('DIGIRISKDOLIBARR_TICKET_' . dol_strtoupper($publicInterfaceType) . '_PUBLIC_INTERFACE_URL_' . dol_strtoupper($urlType)); |
| 384 | + if (!empty($ticketPublicInterfaceURL)) { |
| 385 | + $link = '<a href="' . $ticketPublicInterfaceURL . '" target="_blank">' . img_picto('', 'external-link-alt', 'class="paddingright"') . '</a>'; |
| 386 | + } |
| 387 | + print '<label for="' . $urlType . '-' . $publicInterfaceType . '-ticket-public-interface-url" id="' . $urlType . '-' . $publicInterfaceType . '-ticket-public-interface-url-label">' . $link . $langs->transnoentities(dol_ucfirst($urlType) . 'URL'); |
| 388 | + if (!empty($ticketPublicInterfaceURL)) { |
| 389 | + print showValueWithClipboardCPButton($ticketPublicInterfaceURL, 0, 'none'); |
| 390 | + } |
| 391 | + print '</label><br>'; |
| 392 | + print '<input type="url" name="' . $urlType . '_' . $publicInterfaceType . '_ticket_public_interface_url" id="' . $urlType . '-' . $publicInterfaceType . '-ticket-public-interface-url-input" class="marginleftonly widthcentpercentminusx" placeholder="' . $placeholder . '" pattern="https?://.*" size="30" value="' . $ticketPublicInterfaceURL . '" /><br>'; |
| 393 | + } |
| 394 | + print '</td></tr>'; |
| 395 | + } |
| 396 | + |
| 397 | + print '</table>'; |
| 398 | + print '<div class="tabsAction reposition"><button type="submit" class="butAction">' . $langs->trans('Save') . '</button></div>'; |
| 399 | + print '</form>'; |
| 400 | + |
| 401 | + print load_fiche_titre($langs->transnoentities('Config'), '', ''); |
| 402 | + |
342 | 403 | print '<div class="div-table-responsive-no-min">'; |
343 | 404 | print '<table class="noborder centpercent">'; |
344 | 405 | print '<tr class="liste_titre">'; |
|
348 | 409 | print '<td class="center">' . $langs->transnoentities("ShortInfo") . '</td>'; |
349 | 410 | print '</tr>'; |
350 | 411 |
|
| 412 | + // Show logo for company |
| 413 | + print '<tr class="oddeven"><td>' . $langs->transnoentities("TicketShowCompanyLogo") . '</td>'; |
| 414 | + print '<td class="center">'; |
| 415 | + print ajax_constantonoff('DIGIRISKDOLIBARR_TICKET_SHOW_COMPANY_LOGO'); |
| 416 | + print '</td>'; |
| 417 | + print '<td class="center">'; |
| 418 | + print ''; |
| 419 | + print '</td>'; |
| 420 | + print '<td class="center">'; |
| 421 | + print $form->textwithpicto('', $langs->transnoentities("TicketShowCompanyLogoHelp")); |
| 422 | + print '</td>'; |
| 423 | + print '</tr>'; |
| 424 | + |
351 | 425 | // Show logo for company |
352 | 426 | print '<tr class="oddeven"><td>' . $langs->transnoentities("TicketShowCompanyLogo") . '</td>'; |
353 | 427 | print '<td class="center">'; |
|
0 commit comments