holiday.php 20 KB

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