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