29require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
44$langs->loadLangs(array(
"admin",
"errors",
"holiday",
"other"));
50$action =
GETPOST(
'action',
'aZ09');
51$value =
GETPOST(
'value',
'alpha');
52$modulepart =
GETPOST(
'modulepart',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scan_dir',
'alpha');
59 $conf->global->HOLIDAY_ADDON =
'mod_holiday_madonna';
68include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
70if ($action ==
'updateMask') {
71 $maskconst =
GETPOST(
'maskconstholiday',
'aZ09');
72 $maskvalue =
GETPOST(
'maskholiday',
'alpha');
74 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
83 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
85 setEventMessages($langs->trans(
"Error"),
null,
'errors');
87} elseif ($action ==
'specimen') {
88 $modele =
GETPOST(
'module',
'alpha');
91 $holiday->initAsSpecimen();
96 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
97 foreach ($dirmodels as $reldir) {
98 $file =
dol_buildpath($reldir.
"core/modules/holiday/doc/pdf_".$modele.
".modules.php", 0);
99 if (file_exists($file)) {
100 $classname =
"pdf_".$modele;
105 if ($classname !==
'') {
109 '@phan-var-force ModelePDFHoliday $module';
111 if (
$module->write_file($holiday, $langs) > 0) {
112 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=holiday&file=SPECIMEN.pdf");
119 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
120 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
122} elseif ($action ==
'set') {
125} elseif ($action ==
'del') {
132} elseif ($action ==
'setdoc') {
137 $conf->global->HOLIDAY_ADDON_PDF = $value;
145} elseif ($action ==
'setmod') {
150} elseif ($action ==
'set_other') {
151 $freetext =
GETPOST(
'HOLIDAY_FREE_TEXT',
'restricthtml');
154 $draft =
GETPOST(
'HOLIDAY_DRAFT_WATERMARK',
'alpha');
157 if (!($res1 > 0) || !($res2 > 0)) {
162 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
164 setEventMessages($langs->trans(
"Error"),
null,
'errors');
173$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
175llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-holiday');
177$form =
new Form($db);
179$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
181print
load_fiche_titre($langs->trans(
"HolidaySetup"), $linkback,
'title_setup');
192$holiday->initAsSpecimen();
194printNumberingModuleList(
'holiday',
'mod_holiday_',
'HOLIDAY_ADDON', $langs->trans(
"HolidaysNumberingModules"), $holiday);
204 printDocumentModelList($type,
'holiday',
'HOLIDAY_ADDON_PDF', $langs->trans(
"TemplatePDFHolidays"), array(
205 'Logo' =>
'option_logo',
206 'PaymentMode' =>
'option_modereg',
207 'PaymentConditions' =>
'option_condreg',
208 'MultiLanguage' =>
'option_multilang',
209 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
221print
'<div class="urllink">';
222print img_picto(
'',
'url',
'class="pictofixedwidth"').
' <a href="'.DOL_URL_ROOT.
'/admin/dict.php?id=28&search_country_id='.(
$conf->entity).
'">'.$langs->trans(
"ClickHereToGoToDictionary", $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Dictionary"), $langs->transnoentitiesnoconv(
"LeaveType")).
'</a>';
234print
'<div class="urllink">';
235print img_picto(
'',
'url',
'class="pictofixedwidth"').
' <a href="'.DOL_URL_ROOT.
'/admin/dict.php?id=32&search_country_id='.(
$conf->entity).
'">'.$langs->trans(
"ClickHereToGoToDictionary", $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Dictionary"), $langs->transnoentitiesnoconv(
"DictionaryPublicHolidays")).
'</a>';
245print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
246print
'<input type="hidden" name="token" value="'.newToken().
'">';
247print
'<input type="hidden" name="action" value="set_other">';
251print
'<div class="div-table-responsive-no-min">';
252print
'<table class="noborder centpercent">';
253print
'<tr class="liste_titre">';
254print
'<td>'.$langs->trans(
"Parameter").
'</td>';
255print
'<td align="center" width="60"></td>';
259print
'<tr class="oddeven">';
260print
"<td>".$langs->trans(
"XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv(
"Monday")).
"</td>";
261print
'<td class="center">';
262if (
$conf->use_javascript_ajax) {
263 print ajax_constantonoff(
'MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(),
null, 0);
266 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>';
268 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>';
275print
'<tr class="oddeven">';
276print
"<td>".$langs->trans(
"XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv(
"Friday")).
"</td>";
277print
'<td class="center">';
278if (
$conf->use_javascript_ajax) {
279 print ajax_constantonoff(
'MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(),
null, 0);
282 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>';
284 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>';
291print
'<tr class="oddeven">';
292print
"<td>".$langs->trans(
"XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv(
"Saturday")).
"</td>";
293print
'<td class="center">';
294if (
$conf->use_javascript_ajax) {
295 print ajax_constantonoff(
'MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(),
null, 0, 0, 0, 2, 0, 1);
298 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>';
300 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>';
307print
'<tr class="oddeven">';
308print
"<td>".$langs->trans(
"XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv(
"Sunday")).
"</td>";
309print
'<td class="center">';
310if (
$conf->use_javascript_ajax) {
311 print ajax_constantonoff(
'MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(),
null, 0, 0, 0, 2, 0, 1);
314 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>';
316 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>';
323print
'<tr class="oddeven">';
324print
"<td>".$langs->trans(
"ConsumeHolidaysAtTheEndOfTheMonthTheyAreTakenAt").
' <span class="opacitymedium">('.$langs->trans(
"ConsumeHolidaysAtTheEndOfTheMonthTheyAreTakenAtBis").
')</span></td>';
325print
'<td class="center">';
326if (
$conf->use_javascript_ajax) {
327 print ajax_constantonoff(
'HOLIDAY_DECREASE_AT_END_OF_MONTH', array(),
null, 0, 0, 0, 2, 0, 1);
330 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>';
332 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>';
340 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
341 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
342 foreach ($substitutionarray as $key => $val) {
343 $htmltext .= $key.
'<br>';
347 print
'<tr class="oddeven"><td colspan="2">';
348 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnHolidays"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'tooltiphelp');
350 $variablename =
'HOLIDAY_FREE_TEXT';
352 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
354 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
356 print $doleditor->Create();
358 print
'</td></tr>'.
"\n";
362 print
'<tr class="oddeven"><td>';
363 print $form->textwithpicto($langs->trans(
"WatermarkOnDraftHolidayCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
365 print
'<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'HOLIDAY_DRAFT_WATERMARK')).
'">';
366 print
'</td></tr>'.
"\n";
372print $form->buttonsSaveCancel(
"Save",
'');
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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage a WYSIWYG editor.
Class of the module paid holiday.
if(! $sortfield) if(! $sortorder) $module
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.