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