dolibarr  17.0.4
holiday.php
1 <?php
2 /* Copyright (C) 2011-2019 Juanjo Menent <jmenent@2byte.es>
3  * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
4  * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
5  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 // Load Dolibarr environment
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
33 
34 // Load translation files required by the page
35 $langs->loadLangs(array("admin", "errors", "holiday"));
36 
37 if (!$user->admin) {
39 }
40 
41 $action = GETPOST('action', 'aZ09');
42 $value = GETPOST('value', 'alpha');
43 $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
44 
45 $label = GETPOST('label', 'alpha');
46 $scandir = GETPOST('scan_dir', 'alpha');
47 $type = 'contract';
48 
49 if (empty($conf->global->HOLIDAY_ADDON)) {
50  $conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
51 }
52 
53 
54 /*
55  * Actions
56  */
57 
58 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
59 
60 if ($action == 'updateMask') {
61  $maskconst = GETPOST('maskconstholiday', 'aZ09');
62  $maskvalue = GETPOST('maskholiday', 'alpha');
63  if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
64  $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
65  }
66 
67  if (!($res > 0)) {
68  $error++;
69  }
70 
71  if (!$error) {
72  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
73  } else {
74  setEventMessages($langs->trans("Error"), null, 'errors');
75  }
76 } elseif ($action == 'specimen') { // For contract
77  $modele = GETPOST('module', 'alpha');
78 
79  $holiday = new Holiday($db);
80  $holiday->initAsSpecimen();
81 
82  // Search template files
83  $file = ''; $classname = ''; $filefound = 0;
84  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
85  foreach ($dirmodels as $reldir) {
86  $file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
87  if (file_exists($file)) {
88  $filefound = 1;
89  $classname = "pdf_".$modele;
90  break;
91  }
92  }
93 
94  if ($filefound) {
95  require_once $file;
96 
97  $module = new $classname($db);
98 
99  if ($module->write_file($holiday, $langs) > 0) {
100  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
101  return;
102  } else {
103  setEventMessages($obj->error, $obj->errors, 'errors');
104  dol_syslog($obj->error, LOG_ERR);
105  }
106  } else {
107  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
108  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
109  }
110 } elseif ($action == 'set') {
111  // Activate a model
112  $ret = addDocumentModel($value, $type, $label, $scandir);
113 } elseif ($action == 'del') {
114  $ret = delDocumentModel($value, $type);
115  if ($ret > 0) {
116  if ($conf->global->HOLIDAY_ADDON_PDF == "$value") {
117  dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF', $conf->entity);
118  }
119  }
120 } elseif ($action == 'setdoc') {
121  // Set default model
122  if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
123  // La constante qui a ete lue en avant du nouveau set
124  // on passe donc par une variable pour avoir un affichage coherent
125  $conf->global->HOLIDAY_ADDON_PDF = $value;
126  }
127 
128  // On active le modele
129  $ret = delDocumentModel($value, $type);
130  if ($ret > 0) {
131  $ret = addDocumentModel($value, $type, $label, $scandir);
132  }
133 } elseif ($action == 'setmod') {
134  // TODO Verifier si module numerotation choisi peut etre active
135  // par appel methode canBeActivated
136 
137  dolibarr_set_const($db, "HOLIDAY_ADDON", $value, 'chaine', 0, '', $conf->entity);
138 } elseif ($action == 'set_other') {
139  $freetext = GETPOST('HOLIDAY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
140  $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
141 
142  $draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
143  $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
144 
145  if (!($res1 > 0) || !($res2 > 0)) {
146  $error++;
147  }
148 
149  if (!$error) {
150  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
151  } else {
152  setEventMessages($langs->trans("Error"), null, 'errors');
153  }
154 }
155 
156 
157 /*
158  * View
159  */
160 
161 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
162 
163 llxHeader();
164 
165 $form = new Form($db);
166 
167 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
168 print load_fiche_titre($langs->trans("HolidaySetup"), $linkback, 'title_setup');
169 
171 
172 print dol_get_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
173 
174 /*
175  * Holiday Numbering model
176  */
177 
178 print load_fiche_titre($langs->trans("HolidaysNumberingModules"), '', '');
179 
180 print '<div class="div-table-responsive-no-min">';
181 print '<table class="noborder centpercent">';
182 print '<tr class="liste_titre">';
183 print '<td width="100">'.$langs->trans("Name").'</td>';
184 print '<td>'.$langs->trans("Description").'</td>';
185 print '<td>'.$langs->trans("Example").'</td>';
186 print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
187 print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
188 print "</tr>\n";
189 
190 clearstatcache();
191 
192 foreach ($dirmodels as $reldir) {
193  $dir = dol_buildpath($reldir."core/modules/holiday/");
194 
195  if (is_dir($dir)) {
196  $handle = opendir($dir);
197  if (is_resource($handle)) {
198  while (($file = readdir($handle)) !== false) {
199  if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
200  $file = substr($file, 0, dol_strlen($file) - 4);
201 
202  require_once $dir.$file.'.php';
203 
204  $module = new $file($db);
205 
206  // Show modules according to features level
207  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
208  continue;
209  }
210  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
211  continue;
212  }
213 
214  if ($module->isEnabled()) {
215  print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
216  print $module->info();
217  print '</td>';
218 
219  // Show example of numbering model
220  print '<td class="nowrap">';
221  $tmp = $module->getExample();
222  if (preg_match('/^Error/', $tmp)) {
223  $langs->load("errors");
224  print '<div class="error">'.$langs->trans($tmp).'</div>';
225  } elseif ($tmp == 'NotConfigured') {
226  print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
227  } else {
228  print $tmp;
229  }
230  print '</td>'."\n";
231 
232  print '<td class="center">';
233  if ($conf->global->HOLIDAY_ADDON == "$file") {
234  print img_picto($langs->trans("Activated"), 'switch_on');
235  } else {
236  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
237  print img_picto($langs->trans("Disabled"), 'switch_off');
238  print '</a>';
239  }
240  print '</td>';
241 
242  $holiday = new Holiday($db);
243  $holiday->initAsSpecimen();
244 
245  // Info
246  $htmltooltip = '';
247  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
248  $nextval = $module->getNextValue($mysoc, $holiday);
249  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
250  $htmltooltip .= ''.$langs->trans("NextValue").': ';
251  if ($nextval) {
252  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
253  $nextval = $langs->trans($nextval);
254  }
255  $htmltooltip .= $nextval.'<br>';
256  } else {
257  $htmltooltip .= $langs->trans($module->error).'<br>';
258  }
259  }
260 
261  print '<td class="center">';
262  print $form->textwithpicto('', $htmltooltip, 1, 0);
263  print '</td>';
264 
265  print '</tr>';
266  }
267  }
268  }
269  closedir($handle);
270  }
271  }
272 }
273 
274 print '</table>';
275 print '</div>';
276 
277 print '<br>';
278 
279 
280 /*
281  * Documents models for Holidays
282  */
283 
284 if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
285  print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
286 
287  // Defined model definition table
288  $def = array();
289  $sql = "SELECT nom";
290  $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
291  $sql .= " WHERE type = '".$db->escape($type)."'";
292  $sql .= " AND entity = ".$conf->entity;
293  $resql = $db->query($sql);
294  if ($resql) {
295  $i = 0;
296  $num_rows = $db->num_rows($resql);
297  while ($i < $num_rows) {
298  $array = $db->fetch_array($resql);
299  array_push($def, $array[0]);
300  $i++;
301  }
302  } else {
303  dol_print_error($db);
304  }
305 
306 
307  print '<div class="div-table-responsive-no-min">';
308  print '<table class="noborder centpercent">';
309  print '<tr class="liste_titre">';
310  print '<td>'.$langs->trans("Name").'</td>';
311  print '<td>'.$langs->trans("Description").'</td>';
312  print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
313  print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
314  print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
315  print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
316  print "</tr>\n";
317 
318  clearstatcache();
319 
320  foreach ($dirmodels as $reldir) {
321  foreach (array('', '/doc') as $valdir) {
322  $realpath = $reldir."core/modules/holiday".$valdir;
323  $dir = dol_buildpath($realpath);
324 
325  if (is_dir($dir)) {
326  $handle = opendir($dir);
327  if (is_resource($handle)) {
328  while (($file = readdir($handle)) !== false) {
329  $filelist[] = $file;
330  }
331  closedir($handle);
332  arsort($filelist);
333 
334  foreach ($filelist as $file) {
335  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
336  if (file_exists($dir.'/'.$file)) {
337  $name = substr($file, 4, dol_strlen($file) - 16);
338  $classname = substr($file, 0, dol_strlen($file) - 12);
339 
340  require_once $dir.'/'.$file;
341  $module = new $classname($db);
342 
343  $modulequalified = 1;
344  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
345  $modulequalified = 0;
346  }
347  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
348  $modulequalified = 0;
349  }
350 
351  if ($modulequalified) {
352  print '<tr class="oddeven"><td width="100">';
353  print (empty($module->name) ? $name : $module->name);
354  print "</td><td>\n";
355  if (method_exists($module, 'info')) {
356  print $module->info($langs);
357  } else {
358  print $module->description;
359  }
360  print '</td>';
361 
362  // Active
363  if (in_array($name, $def)) {
364  print '<td class="center">'."\n";
365  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
366  print img_picto($langs->trans("Enabled"), 'switch_on');
367  print '</a>';
368  print '</td>';
369  } else {
370  print '<td class="center">'."\n";
371  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
372  print "</td>";
373  }
374 
375  // Default
376  print '<td class="center">';
377  if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
378  print img_picto($langs->trans("Default"), 'on');
379  } else {
380  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
381  }
382  print '</td>';
383 
384  // Info
385  $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
386  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
387  if ($module->type == 'pdf') {
388  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
389  }
390  $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
391 
392  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
393  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
394  $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
395  $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
396  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
397  $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
398 
399 
400  print '<td class="center">';
401  print $form->textwithpicto('', $htmltooltip, 1, 0);
402  print '</td>';
403 
404  // Preview
405  print '<td class="center">';
406  if ($module->type == 'pdf') {
407  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
408  } else {
409  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
410  }
411  print '</td>';
412 
413  print "</tr>\n";
414  }
415  }
416  }
417  }
418  }
419  }
420  }
421  }
422 
423  print '</table>';
424  print '</div>';
425  print "<br>";
426 }
427 
428 
429 /*
430  * Other options
431  */
432 
433 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
434 print '<input type="hidden" name="token" value="'.newToken().'">';
435 print '<input type="hidden" name="action" value="set_other">';
436 
437 print load_fiche_titre($langs->trans("OtherOptions"), '', '');
438 
439 print '<div class="div-table-responsive-no-min">';
440 print '<table class="noborder centpercent">';
441 print '<tr class="liste_titre">';
442 print '<td>'.$langs->trans("Parameter").'</td>';
443 print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
444 print "</tr>\n";
445 
446 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
447 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
448 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
449 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
450 
451 if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
452  $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
453 }
454 if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
455  $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
456 }
457 
458 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
459 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
460 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
461 //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
462 
463 
464 // Set working days
465 print '<tr class="oddeven">';
466 print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))."</td>";
467 print '<td class="center">';
468 if ($conf->use_javascript_ajax) {
469  print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
470 } else {
471  if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
472  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
473  } else {
474  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
475  }
476 }
477 print "</td>";
478 print "</tr>";
479 
480 // Set working days
481 print '<tr class="oddeven">';
482 print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday"))."</td>";
483 print '<td class="center">';
484 if ($conf->use_javascript_ajax) {
485  print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
486 } else {
487  if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
488  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
489  } else {
490  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
491  }
492 }
493 print "</td>";
494 print "</tr>";
495 
496 // Set working days
497 print '<tr class="oddeven">';
498 print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday"))."</td>";
499 print '<td class="center">';
500 if ($conf->use_javascript_ajax) {
501  print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
502 } else {
503  if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
504  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
505  } else {
506  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
507  }
508 }
509 print "</td>";
510 print "</tr>";
511 
512 // Set working days
513 print '<tr class="oddeven">';
514 print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday"))."</td>";
515 print '<td class="center">';
516 if ($conf->use_javascript_ajax) {
517  print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
518 } else {
519  if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
520  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
521  } else {
522  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
523  }
524 }
525 print "</td>";
526 print "</tr>";
527 
528 if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
529  $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
530  $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
531  $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
532  foreach ($substitutionarray as $key => $val) {
533  $htmltext .= $key.'<br>';
534  }
535  $htmltext .= '</i>';
536 
537  print '<tr class="oddeven"><td colspan="2">';
538  print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
539  print '<br>';
540  $variablename = 'HOLIDAY_FREE_TEXT';
541  if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
542  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
543  } else {
544  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
545  $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
546  print $doleditor->Create();
547  }
548  print '</td></tr>'."\n";
549 
550  //Use draft Watermark
551 
552  print '<tr class="oddeven"><td>';
553  print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
554  print '</td><td>';
555  print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('HOLIDAY_DRAFT_WATERMARK')).'">';
556  print '</td></tr>'."\n";
557 }
558 
559 print '</table>';
560 print '</div>';
561 
562 print $form->buttonsSaveCancel("Save", '');
563 
564 print '</form>';
565 
566 
567 
568 print dol_get_fiche_end();
569 
570 // End of page
571 llxFooter();
572 $db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
Definition: admin.lib.php:1888
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).
Definition: admin.lib.php:632
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:556
delDocumentModel($name, $type)
Delete document model used by doc generator.
Definition: admin.lib.php:1919
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='')
On/off button for constant.
Definition: ajax.lib.php:600
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage a WYSIWYG editor.
Class to manage generation of HTML components Only common components must be here.
Class of the module paid holiday.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
holiday_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: holiday.lib.php:81
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition: pdf.lib.php:749
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.