holiday.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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. /**
  21. * \file htdocs/admin/contract.php
  22. * \ingroup contract
  23. * \brief Setup page of module Contracts
  24. */
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
  30. // Load translation files required by the page
  31. $langs->loadLangs(array("admin", "errors", "holiday"));
  32. if (!$user->admin) {
  33. accessforbidden();
  34. }
  35. $action = GETPOST('action', 'aZ09');
  36. $value = GETPOST('value', 'alpha');
  37. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  38. $label = GETPOST('label', 'alpha');
  39. $scandir = GETPOST('scan_dir', 'alpha');
  40. $type = 'contract';
  41. if (empty($conf->global->HOLIDAY_ADDON)) {
  42. $conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
  43. }
  44. /*
  45. * Actions
  46. */
  47. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  48. if ($action == 'updateMask') {
  49. $maskconst = GETPOST('maskconstholiday', 'alpha');
  50. $maskvalue = GETPOST('maskholiday', 'alpha');
  51. if ($maskconst) {
  52. $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
  53. }
  54. if (!($res > 0)) {
  55. $error++;
  56. }
  57. if (!$error) {
  58. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  59. } else {
  60. setEventMessages($langs->trans("Error"), null, 'errors');
  61. }
  62. } elseif ($action == 'specimen') { // For contract
  63. $modele = GETPOST('module', 'alpha');
  64. $holiday = new Holiday($db);
  65. $holiday->initAsSpecimen();
  66. // Search template files
  67. $file = ''; $classname = ''; $filefound = 0;
  68. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  69. foreach ($dirmodels as $reldir) {
  70. $file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
  71. if (file_exists($file)) {
  72. $filefound = 1;
  73. $classname = "pdf_".$modele;
  74. break;
  75. }
  76. }
  77. if ($filefound) {
  78. require_once $file;
  79. $module = new $classname($db);
  80. if ($module->write_file($holiday, $langs) > 0) {
  81. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
  82. return;
  83. } else {
  84. setEventMessages($obj->error, $obj->errors, 'errors');
  85. dol_syslog($obj->error, LOG_ERR);
  86. }
  87. } else {
  88. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  89. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  90. }
  91. } elseif ($action == 'set') {
  92. // Activate a model
  93. $ret = addDocumentModel($value, $type, $label, $scandir);
  94. } elseif ($action == 'del') {
  95. $ret = delDocumentModel($value, $type);
  96. if ($ret > 0) {
  97. if ($conf->global->HOLIDAY_ADDON_PDF == "$value") {
  98. dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF', $conf->entity);
  99. }
  100. }
  101. } elseif ($action == 'setdoc') {
  102. // Set default model
  103. if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  104. // La constante qui a ete lue en avant du nouveau set
  105. // on passe donc par une variable pour avoir un affichage coherent
  106. $conf->global->HOLIDAY_ADDON_PDF = $value;
  107. }
  108. // On active le modele
  109. $ret = delDocumentModel($value, $type);
  110. if ($ret > 0) {
  111. $ret = addDocumentModel($value, $type, $label, $scandir);
  112. }
  113. } elseif ($action == 'setmod') {
  114. // TODO Verifier si module numerotation choisi peut etre active
  115. // par appel methode canBeActivated
  116. dolibarr_set_const($db, "HOLIDAY_ADDON", $value, 'chaine', 0, '', $conf->entity);
  117. } elseif ($action == 'set_other') {
  118. $freetext = GETPOST('HOLIDAY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  119. $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  120. $draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
  121. $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
  122. if (!$res1 > 0 || !$res2 > 0) {
  123. $error++;
  124. }
  125. if (!$error) {
  126. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  127. } else {
  128. setEventMessages($langs->trans("Error"), null, 'errors');
  129. }
  130. }
  131. /*
  132. * View
  133. */
  134. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  135. llxHeader();
  136. $form = new Form($db);
  137. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  138. print load_fiche_titre($langs->trans("HolidaySetup"), $linkback, 'title_setup');
  139. $head = holiday_admin_prepare_head();
  140. print dol_get_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
  141. /*
  142. * Holiday Numbering model
  143. */
  144. print load_fiche_titre($langs->trans("HolidaysNumberingModules"), '', '');
  145. print '<div class="div-table-responsive-no-min">';
  146. print '<table class="noborder centpercent">';
  147. print '<tr class="liste_titre">';
  148. print '<td width="100">'.$langs->trans("Name").'</td>';
  149. print '<td>'.$langs->trans("Description").'</td>';
  150. print '<td>'.$langs->trans("Example").'</td>';
  151. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  152. print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  153. print "</tr>\n";
  154. clearstatcache();
  155. foreach ($dirmodels as $reldir) {
  156. $dir = dol_buildpath($reldir."core/modules/holiday/");
  157. if (is_dir($dir)) {
  158. $handle = opendir($dir);
  159. if (is_resource($handle)) {
  160. while (($file = readdir($handle)) !== false) {
  161. if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
  162. $file = substr($file, 0, dol_strlen($file) - 4);
  163. require_once $dir.$file.'.php';
  164. $module = new $file($db);
  165. // Show modules according to features level
  166. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  167. continue;
  168. }
  169. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  170. continue;
  171. }
  172. if ($module->isEnabled()) {
  173. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  174. print $module->info();
  175. print '</td>';
  176. // Show example of numbering model
  177. print '<td class="nowrap">';
  178. $tmp = $module->getExample();
  179. if (preg_match('/^Error/', $tmp)) {
  180. $langs->load("errors");
  181. print '<div class="error">'.$langs->trans($tmp).'</div>';
  182. } elseif ($tmp == 'NotConfigured') {
  183. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  184. } else {
  185. print $tmp;
  186. }
  187. print '</td>'."\n";
  188. print '<td class="center">';
  189. if ($conf->global->HOLIDAY_ADDON == "$file") {
  190. print img_picto($langs->trans("Activated"), 'switch_on');
  191. } else {
  192. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
  193. print img_picto($langs->trans("Disabled"), 'switch_off');
  194. print '</a>';
  195. }
  196. print '</td>';
  197. $holiday = new Holiday($db);
  198. $holiday->initAsSpecimen();
  199. // Info
  200. $htmltooltip = '';
  201. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  202. $nextval = $module->getNextValue($mysoc, $holiday);
  203. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  204. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  205. if ($nextval) {
  206. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  207. $nextval = $langs->trans($nextval);
  208. }
  209. $htmltooltip .= $nextval.'<br>';
  210. } else {
  211. $htmltooltip .= $langs->trans($module->error).'<br>';
  212. }
  213. }
  214. print '<td class="center">';
  215. print $form->textwithpicto('', $htmltooltip, 1, 0);
  216. print '</td>';
  217. print '</tr>';
  218. }
  219. }
  220. }
  221. closedir($handle);
  222. }
  223. }
  224. }
  225. print '</table>';
  226. print '</div>';
  227. print '<br>';
  228. /*
  229. * Documents models for Holidays
  230. */
  231. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  232. print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
  233. // Defined model definition table
  234. $def = array();
  235. $sql = "SELECT nom";
  236. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  237. $sql .= " WHERE type = '".$db->escape($type)."'";
  238. $sql .= " AND entity = ".$conf->entity;
  239. $resql = $db->query($sql);
  240. if ($resql) {
  241. $i = 0;
  242. $num_rows = $db->num_rows($resql);
  243. while ($i < $num_rows) {
  244. $array = $db->fetch_array($resql);
  245. array_push($def, $array[0]);
  246. $i++;
  247. }
  248. } else {
  249. dol_print_error($db);
  250. }
  251. print '<div class="div-table-responsive-no-min">';
  252. print '<table class="noborder centpercent">';
  253. print '<tr class="liste_titre">';
  254. print '<td>'.$langs->trans("Name").'</td>';
  255. print '<td>'.$langs->trans("Description").'</td>';
  256. print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
  257. print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
  258. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  259. print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
  260. print "</tr>\n";
  261. clearstatcache();
  262. foreach ($dirmodels as $reldir) {
  263. foreach (array('', '/doc') as $valdir) {
  264. $realpath = $reldir."core/modules/holiday".$valdir;
  265. $dir = dol_buildpath($realpath);
  266. if (is_dir($dir)) {
  267. $handle = opendir($dir);
  268. if (is_resource($handle)) {
  269. while (($file = readdir($handle)) !== false) {
  270. $filelist[] = $file;
  271. }
  272. closedir($handle);
  273. arsort($filelist);
  274. foreach ($filelist as $file) {
  275. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  276. if (file_exists($dir.'/'.$file)) {
  277. $name = substr($file, 4, dol_strlen($file) - 16);
  278. $classname = substr($file, 0, dol_strlen($file) - 12);
  279. require_once $dir.'/'.$file;
  280. $module = new $classname($db);
  281. $modulequalified = 1;
  282. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  283. $modulequalified = 0;
  284. }
  285. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  286. $modulequalified = 0;
  287. }
  288. if ($modulequalified) {
  289. print '<tr class="oddeven"><td width="100">';
  290. print (empty($module->name) ? $name : $module->name);
  291. print "</td><td>\n";
  292. if (method_exists($module, 'info')) {
  293. print $module->info($langs);
  294. } else {
  295. print $module->description;
  296. }
  297. print '</td>';
  298. // Active
  299. if (in_array($name, $def)) {
  300. print '<td class="center">'."\n";
  301. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
  302. print img_picto($langs->trans("Enabled"), 'switch_on');
  303. print '</a>';
  304. print '</td>';
  305. } else {
  306. print '<td class="center">'."\n";
  307. 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>';
  308. print "</td>";
  309. }
  310. // Default
  311. print '<td class="center">';
  312. if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
  313. print img_picto($langs->trans("Default"), 'on');
  314. } else {
  315. 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>';
  316. }
  317. print '</td>';
  318. // Info
  319. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  320. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  321. if ($module->type == 'pdf') {
  322. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  323. }
  324. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  325. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  326. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  327. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  328. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  329. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  330. $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
  331. print '<td class="center">';
  332. print $form->textwithpicto('', $htmltooltip, 1, 0);
  333. print '</td>';
  334. // Preview
  335. print '<td class="center">';
  336. if ($module->type == 'pdf') {
  337. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  338. } else {
  339. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  340. }
  341. print '</td>';
  342. print "</tr>\n";
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. print '</table>';
  352. print '</div>';
  353. print "<br>";
  354. }
  355. /*
  356. * Other options
  357. */
  358. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  359. print '<input type="hidden" name="token" value="'.newToken().'">';
  360. print '<input type="hidden" name="action" value="set_other">';
  361. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  362. print '<div class="div-table-responsive-no-min">';
  363. print '<table class="noborder centpercent">';
  364. print '<tr class="liste_titre">';
  365. print '<td>'.$langs->trans("Parameter").'</td>';
  366. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  367. print "</tr>\n";
  368. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
  369. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
  370. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
  371. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
  372. if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
  373. $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
  374. }
  375. if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
  376. $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
  377. }
  378. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
  379. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
  380. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
  381. //var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
  382. // Set working days
  383. print '<tr class="oddeven">';
  384. print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))."</td>";
  385. print '<td class="center">';
  386. if ($conf->use_javascript_ajax) {
  387. print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
  388. } else {
  389. if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
  390. 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>';
  391. } else {
  392. 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>';
  393. }
  394. }
  395. print "</td>";
  396. print "</tr>";
  397. // Set working days
  398. print '<tr class="oddeven">';
  399. print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday"))."</td>";
  400. print '<td class="center">';
  401. if ($conf->use_javascript_ajax) {
  402. print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
  403. } else {
  404. if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
  405. 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>';
  406. } else {
  407. 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>';
  408. }
  409. }
  410. print "</td>";
  411. print "</tr>";
  412. // Set working days
  413. print '<tr class="oddeven">';
  414. print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday"))."</td>";
  415. print '<td class="center">';
  416. if ($conf->use_javascript_ajax) {
  417. print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
  418. } else {
  419. if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
  420. 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>';
  421. } else {
  422. 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>';
  423. }
  424. }
  425. print "</td>";
  426. print "</tr>";
  427. // Set working days
  428. print '<tr class="oddeven">';
  429. print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday"))."</td>";
  430. print '<td class="center">';
  431. if ($conf->use_javascript_ajax) {
  432. print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
  433. } else {
  434. if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
  435. 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>';
  436. } else {
  437. 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>';
  438. }
  439. }
  440. print "</td>";
  441. print "</tr>";
  442. if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
  443. $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
  444. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  445. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  446. foreach ($substitutionarray as $key => $val) {
  447. $htmltext .= $key.'<br>';
  448. }
  449. $htmltext .= '</i>';
  450. print '<tr class="oddeven"><td colspan="2">';
  451. print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
  452. print '<br>';
  453. $variablename = 'HOLIDAY_FREE_TEXT';
  454. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
  455. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
  456. } else {
  457. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  458. $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
  459. print $doleditor->Create();
  460. }
  461. print '</td></tr>'."\n";
  462. //Use draft Watermark
  463. print '<tr class="oddeven"><td>';
  464. print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
  465. print '</td><td>';
  466. print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
  467. print '</td></tr>'."\n";
  468. }
  469. print '</table>';
  470. print '</div>';
  471. print $form->buttonsSaveCancel("Save", '');
  472. print '</form>';
  473. print dol_get_fiche_end();
  474. // End of page
  475. llxFooter();
  476. $db->close();