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