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