25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
27 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
28 require_once DOL_DOCUMENT_ROOT.
"/core/lib/ticket.lib.php";
31 $langs->loadLangs(array(
"admin",
"ticket"));
39 $value =
GETPOST(
'value',
'alpha');
40 $action =
GETPOST(
'action',
'aZ09');
41 $label =
GETPOST(
'label',
'alpha');
42 $scandir =
GETPOST(
'scandir',
'alpha');
52 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
54 if ($action ==
'updateMask') {
55 $maskconstticket =
GETPOST(
'maskconstticket',
'alpha');
56 $maskticket =
GETPOST(
'maskticket',
'alpha');
58 if ($maskconstticket) {
59 $res =
dolibarr_set_const($db, $maskconstticket, $maskticket,
'chaine', 0,
'', $conf->entity);
75 elseif ($action ==
'set') {
77 } elseif ($action ==
'del') {
81 if ($conf->global->TICKET_ADDON_PDF ==
"$value")
dolibarr_del_const($db,
'TICKET_ADDON_PDF', $conf->entity);
86 elseif ($action ==
'setdoc') {
87 if (
dolibarr_set_const($db,
"TICKET_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity))
91 $conf->global->TICKET_ADDON_PDF = $value;
102 elseif ($action ==
'setmod') {
107 } elseif ($action ==
'setvar') {
108 include_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
110 $notification_email =
GETPOST(
'TICKET_NOTIFICATION_EMAIL_FROM',
'alpha');
111 if (!empty($notification_email)) {
112 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email,
'chaine', 0,
'', $conf->entity);
114 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_EMAIL_FROM',
'',
'chaine', 0,
'', $conf->entity);
121 $notification_email_to =
GETPOST(
'TICKET_NOTIFICATION_EMAIL_TO',
'alpha');
122 if (!empty($notification_email_to)) {
123 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to,
'chaine', 0,
'', $conf->entity);
125 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_EMAIL_TO',
'',
'chaine', 0,
'', $conf->entity);
131 $mail_intro =
GETPOST(
'TICKET_MESSAGE_MAIL_INTRO',
'restricthtml');
132 if (!empty($mail_intro)) {
133 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_INTRO', $mail_intro,
'chaine', 0,
'', $conf->entity);
135 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_INTRO', $langs->trans(
'TicketMessageMailIntroText'),
'chaine', 0,
'', $conf->entity);
141 $mail_signature =
GETPOST(
'TICKET_MESSAGE_MAIL_SIGNATURE',
'restricthtml');
142 if (!empty($mail_signature)) {
143 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature,
'chaine', 0,
'', $conf->entity);
145 $res =
dolibarr_set_const($db,
'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans(
'TicketMessageMailSignatureText'),
'chaine', 0,
'', $conf->entity);
152 if ($action ==
'setvarother') {
153 $param_must_exists =
GETPOST(
'TICKET_EMAIL_MUST_EXISTS',
'alpha');
154 $res =
dolibarr_set_const($db,
'TICKET_EMAIL_MUST_EXISTS', $param_must_exists,
'chaine', 0,
'', $conf->entity);
159 $param_disable_email =
GETPOST(
'TICKET_DISABLE_NOTIFICATION_MAILS',
'alpha');
160 $res =
dolibarr_set_const($db,
'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email,
'chaine', 0,
'', $conf->entity);
165 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
167 $param_show_module_logo =
GETPOST(
'TICKET_SHOW_MODULE_LOGO',
'alpha');
168 $res =
dolibarr_set_const($db,
'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo,
'chaine', 0,
'', $conf->entity);
174 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
176 $param_notification_also_main_addressemail =
GETPOST(
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS',
'alpha');
177 $res =
dolibarr_set_const($db,
'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail,
'chaine', 0,
'', $conf->entity);
183 $param_limit_view =
GETPOST(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY',
'alpha');
184 $res =
dolibarr_set_const($db,
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view,
'chaine', 0,
'', $conf->entity);
189 $param_auto_assign =
GETPOST(
'TICKET_AUTO_ASSIGN_USER_CREATE',
'alpha');
190 $res =
dolibarr_set_const($db,
'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign,
'chaine', 0,
'', $conf->entity);
202 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
204 $form =
new Form($db);
206 $help_url =
"FR:Module_Ticket";
207 $page_name =
"TicketSetup";
208 llxHeader(
'', $langs->trans($page_name), $help_url);
211 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
220 print '<span class="opacitymedium">'.$langs->trans(
"TicketSetupDictionaries").
'</span> : <a href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
"ClickHereToGoTo", $langs->transnoentitiesnoconv(
"DictionarySetup")).
'</a><br>';
231 print '<div class="div-table-responsive-no-min">';
232 print
'<table class="noborder centpercent">';
233 print
'<tr class="liste_titre">';
234 print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
235 print
'<td>'.$langs->trans(
"Description").
'</td>';
236 print
'<td>'.$langs->trans(
"Example").
'</td>';
237 print
'<td align="center" width="60">'.$langs->trans(
"Activated").
'</td>';
238 print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
243 foreach ($dirmodels as $reldir) {
247 $handle = opendir($dir);
248 if (is_resource($handle)) {
249 while (($file = readdir($handle)) !==
false) {
250 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
252 $classname = substr($file, 4);
254 include_once $dir.
'/'.$file.
'.php';
259 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
263 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
267 if ($module->isEnabled()) {
268 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
269 print $module->info();
273 print
'<td class="nowrap">';
274 $tmp = $module->getExample();
275 if (preg_match(
'/^Error/', $tmp)) {
276 $langs->load(
"errors");
277 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
278 } elseif ($tmp ==
'NotConfigured') {
279 print $langs->trans($tmp);
286 print
'<td class="center">';
287 if ($conf->global->TICKET_ADDON ==
'mod_'.$classname) {
288 print
img_picto($langs->trans(
"Activated"),
'switch_on');
290 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value=mod_'.$classname.
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
294 $ticket =
new Ticket($db);
295 $ticket->initAsSpecimen();
299 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
300 $nextval = $module->getNextValue($mysoc, $ticket);
301 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
302 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
304 $htmltooltip .= $nextval.
'<br>';
306 $htmltooltip .= $langs->trans($module->error).
'<br>';
310 print
'<td class="center">';
311 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
338 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
339 $sql .=
" WHERE type = '".$db->escape($type).
"'";
340 $sql .=
" AND entity = ".$conf->entity;
341 $resql = $db->query($sql);
345 $num_rows = $db->num_rows(
$resql);
346 while ($i < $num_rows)
348 $array = $db->fetch_array(
$resql);
349 array_push($def, $array[0]);
357 print
'<div class="div-table-responsive-no-min">';
358 print
"<table class=\"noborder\" width=\"100%\">\n";
359 print
"<tr class=\"liste_titre\">\n";
360 print
'<td>'.$langs->trans(
"Name").
'</td>';
361 print
'<td>'.$langs->trans(
"Description").
'</td>';
362 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
363 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
364 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
365 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
370 foreach ($dirmodels as $reldir)
372 foreach (array(
'',
'/doc') as $valdir)
374 $realpath = $reldir.
"core/modules/ticket".$valdir;
379 $handle = opendir($dir);
380 if (is_resource($handle))
382 while (($file = readdir($handle)) !==
false)
389 foreach ($filelist as $file)
391 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file))
393 if (file_exists($dir.
'/'.$file))
395 $name = substr($file, 4,
dol_strlen($file) - 16);
396 $classname = substr($file, 0,
dol_strlen($file) - 12);
398 require_once $dir.
'/'.$file;
399 $module =
new $classname($db);
401 $modulequalified = 1;
402 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
403 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
405 if ($modulequalified)
407 print
'<tr class="oddeven"><td width="100">';
408 print (empty($module->name) ? $name : $module->name);
410 if (method_exists($module,
'info')) print $module->info($langs);
411 else print $module->description;
415 if (in_array($name, $def))
417 print
'<td class="center">'.
"\n";
418 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&value='.$name.
'">';
419 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
423 print
'<td class="center">'.
"\n";
424 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
429 print
'<td class="center">';
430 if ($conf->global->TICKET_ADDON_PDF == $name)
432 print
img_picto($langs->trans(
"Default"),
'on');
434 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
439 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
440 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
441 if ($module->type ==
'pdf')
443 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
445 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
447 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
448 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
449 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
455 print
'<td class="center">';
456 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
460 print
'<td class="center">';
461 if ($module->type ==
'pdf')
463 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
465 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
483 if (!$conf->use_javascript_ajax) {
484 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
485 print
'<input type="hidden" name="token" value="'.newToken().
'">';
486 print
'<input type="hidden" name="action" value="setvarother">';
490 print
'<table class="noborder centpercent">';
492 print
'<tr class="liste_titre">';
493 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
499 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsAutoAssignTicket").
'</td>';
500 print
'<td class="left">';
501 if ($conf->use_javascript_ajax) {
504 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
505 print $form->selectarray(
"TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
508 print
'<td class="center">';
509 print $form->textwithpicto(
'', $langs->trans(
"TicketsAutoAssignTicketHelp"), 1,
'help');
513 print
'</table><br>';
515 if (!$conf->use_javascript_ajax) {
522 print
'<table class="noborder centpercent">';
524 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
525 print
'<input type="hidden" name="token" value="'.newToken().
'">';
526 print
'<input type="hidden" name="action" value="setvar">';
528 print
'<tr class="liste_titre">';
529 print
'<td colspan="3">'.$langs->trans(
"Email").
'</td>';
532 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
534 print
'<td colspan="3"><div class="info">'.$langs->trans(
"TicketCkEditorEmailNotActivated").
'</div></td>';
541 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketEmailNotificationFrom").
'</td>';
542 print
'<td class="left">';
543 print
'<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.
'"></td>';
544 print
'<td class="center">';
545 print $form->textwithpicto(
'', $langs->trans(
"TicketEmailNotificationFromHelp"), 1,
'help');
550 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketEmailNotificationTo").
' ('.$langs->trans(
"Creation").
')</td>';
551 print
'<td class="left">';
552 print
'<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO :
'').
'"></td>';
553 print
'<td class="center">';
554 print $form->textwithpicto(
'', $langs->trans(
"TicketEmailNotificationToHelp"), 1,
'help');
559 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
561 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketsEmailAlsoSendToMainAddress").
'</td>';
562 print
'<td class="left">';
563 if ($conf->use_javascript_ajax) {
566 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
567 print $form->selectarray(
"TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
570 print
'<td class="center">';
571 print $form->textwithpicto(
'', $langs->trans(
"TicketsEmailAlsoSendToMainAddressHelp"), 1,
'help');
577 $mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans(
'TicketMessageMailIntroText');
578 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketMessageMailIntroLabelAdmin").
' ('.$langs->trans(
"Responses").
')';
580 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
581 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_INTRO', $mail_intro,
'100%', 120,
'dolibarr_mailings',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
582 $doleditor->Create();
584 print
'<td class="center">';
585 print $form->textwithpicto(
'', $langs->trans(
"TicketMessageMailIntroHelpAdmin"), 1,
'help');
589 $mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans(
'TicketMessageMailSignatureText');
590 print
'<tr class="oddeven"><td>'.$langs->trans(
"TicketMessageMailSignatureLabelAdmin").
'</label>';
592 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
593 $doleditor =
new DolEditor(
'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature,
'100%', 120,
'dolibarr_mailings',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
594 $doleditor->Create();
596 print
'<td class="center">';
597 print $form->textwithpicto(
'', $langs->trans(
"TicketMessageMailSignatureHelpAdmin"), 1,
'help');
602 print
'<div class="center">';
603 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
delDocumentModel($name, $type)
Delete document model used by doc generator.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
ticketAdminPrepareHead()
Build tabs for admin page.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.