fichinter.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <?php
  2. /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
  5. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  6. * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
  7. * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
  8. * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
  9. * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/admin/fichinter.php
  26. * \ingroup fichinter
  27. * \brief Setup page of module Interventions
  28. */
  29. // Load Dolibarr environment
  30. require '../main.inc.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
  35. // Load translation files required by the page
  36. $langs->loadLangs(array('admin', 'errors', 'interventions', 'other'));
  37. if (!$user->admin) {
  38. accessforbidden();
  39. }
  40. $action = GETPOST('action', 'aZ09');
  41. $value = GETPOST('value', 'alpha');
  42. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  43. $label = GETPOST('label', 'alpha');
  44. $scandir = GETPOST('scan_dir', 'alpha');
  45. $type = 'ficheinter';
  46. /*
  47. * Actions
  48. */
  49. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  50. if ($action == 'updateMask') {
  51. $maskconst = GETPOST('maskconst', 'aZ09');
  52. $maskvalue = GETPOST('maskvalue', 'alpha');
  53. if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
  54. $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
  55. }
  56. if (!($res > 0)) {
  57. $error++;
  58. }
  59. if (!$error) {
  60. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  61. } else {
  62. setEventMessages($langs->trans("Error"), null, 'errors');
  63. }
  64. } elseif ($action == 'specimen') { // For fiche inter
  65. $modele = GETPOST('module', 'alpha');
  66. $inter = new Fichinter($db);
  67. $inter->initAsSpecimen();
  68. // Search template files
  69. $file = ''; $classname = ''; $filefound = 0;
  70. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  71. foreach ($dirmodels as $reldir) {
  72. $file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
  73. if (file_exists($file)) {
  74. $filefound = 1;
  75. $classname = "pdf_".$modele;
  76. break;
  77. }
  78. }
  79. if ($filefound) {
  80. require_once $file;
  81. $module = new $classname($db);
  82. if ($module->write_file($inter, $langs) > 0) {
  83. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
  84. return;
  85. } else {
  86. setEventMessages($module->error, $module->errors, 'errors');
  87. dol_syslog($module->error, LOG_ERR);
  88. }
  89. } else {
  90. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  91. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  92. }
  93. } elseif ($action == 'set') {
  94. // Activate a model
  95. $ret = addDocumentModel($value, $type, $label, $scandir);
  96. } elseif ($action == 'del') {
  97. $ret = delDocumentModel($value, $type);
  98. if ($ret > 0) {
  99. if ($conf->global->FICHEINTER_ADDON_PDF == "$value") {
  100. dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF', $conf->entity);
  101. }
  102. }
  103. } elseif ($action == 'setdoc') {
  104. // Set default model
  105. if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  106. // La constante qui a ete lue en avant du nouveau set
  107. // on passe donc par une variable pour avoir un affichage coherent
  108. $conf->global->FICHEINTER_ADDON_PDF = $value;
  109. }
  110. // On active le modele
  111. $ret = delDocumentModel($value, $type);
  112. if ($ret > 0) {
  113. $ret = addDocumentModel($value, $type, $label, $scandir);
  114. }
  115. } elseif ($action == 'setmod') {
  116. // TODO Verifier si module numerotation choisi peut etre active
  117. // par appel methode canBeActivated
  118. dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity);
  119. } elseif ($action == 'set_FICHINTER_FREE_TEXT') {
  120. $freetext = GETPOST('FICHINTER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  121. $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  122. if (!($res > 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. } elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') {
  131. $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
  132. $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
  133. if (!($res > 0)) {
  134. $error++;
  135. }
  136. if (!$error) {
  137. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  138. } else {
  139. setEventMessages($langs->trans("Error"), null, 'errors');
  140. }
  141. } elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') {
  142. $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
  143. $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  144. if (!($res > 0)) {
  145. $error++;
  146. }
  147. if (!$error) {
  148. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  149. } else {
  150. setEventMessages($langs->trans("Error"), null, 'errors');
  151. }
  152. } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
  153. $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
  154. $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  155. if (!($res > 0)) {
  156. $error++;
  157. }
  158. if (!$error) {
  159. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  160. } else {
  161. setEventMessages($langs->trans("Error"), null, 'errors');
  162. }
  163. } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
  164. $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
  165. $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  166. if (!($res > 0)) {
  167. $error++;
  168. }
  169. if (!$error) {
  170. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  171. } else {
  172. setEventMessages($langs->trans("Error"), null, 'errors');
  173. }
  174. } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
  175. $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
  176. $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  177. if (!($res > 0)) {
  178. $error++;
  179. }
  180. if (!$error) {
  181. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  182. } else {
  183. setEventMessages($langs->trans("Error"), null, 'errors');
  184. }
  185. } elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") {
  186. $val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha');
  187. $res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  188. if (!($res > 0)) {
  189. $error++;
  190. }
  191. if (!$error) {
  192. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  193. } else {
  194. setEventMessages($langs->trans("Error"), null, 'errors');
  195. }
  196. } elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
  197. $val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha');
  198. $res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  199. if (!($res > 0)) {
  200. $error++;
  201. }
  202. if (!$error) {
  203. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  204. } else {
  205. setEventMessages($langs->trans("Error"), null, 'errors');
  206. }
  207. }
  208. /*
  209. * View
  210. */
  211. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  212. llxHeader();
  213. $form = new Form($db);
  214. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  215. print load_fiche_titre($langs->trans("InterventionsSetup"), $linkback, 'title_setup');
  216. $head = fichinter_admin_prepare_head();
  217. print dol_get_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), -1, 'intervention');
  218. // Interventions numbering model
  219. print load_fiche_titre($langs->trans("FicheinterNumberingModules"), '', '');
  220. print '<div class="div-table-responsive-no-min">';
  221. print '<table class="noborder centpercent">';
  222. print '<tr class="liste_titre">';
  223. print '<td width="100">'.$langs->trans("Name").'</td>';
  224. print '<td>'.$langs->trans("Description").'</td>';
  225. print '<td>'.$langs->trans("Example").'</td>';
  226. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  227. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  228. print "</tr>\n";
  229. clearstatcache();
  230. foreach ($dirmodels as $reldir) {
  231. $dir = dol_buildpath($reldir."core/modules/fichinter/");
  232. if (is_dir($dir)) {
  233. $handle = opendir($dir);
  234. if (is_resource($handle)) {
  235. while (($file = readdir($handle)) !== false) {
  236. if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
  237. $file = $reg[1];
  238. $classname = substr($file, 4);
  239. require_once $dir.$file.'.php';
  240. $module = new $file;
  241. if ($module->isEnabled()) {
  242. // Show modules according to features level
  243. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  244. continue;
  245. }
  246. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  247. continue;
  248. }
  249. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  250. print $module->info($langs);
  251. print '</td>';
  252. // Show example of numbering model
  253. print '<td class="nowrap">';
  254. $tmp = $module->getExample();
  255. if (preg_match('/^Error/', $tmp)) {
  256. $langs->load("errors");
  257. print '<div class="error">'.$langs->trans($tmp).'</div>';
  258. } elseif ($tmp == 'NotConfigured') {
  259. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  260. } else {
  261. print $tmp;
  262. }
  263. print '</td>'."\n";
  264. print '<td class="center">';
  265. if ($conf->global->FICHEINTER_ADDON == $classname) {
  266. print img_picto($langs->trans("Activated"), 'switch_on');
  267. } else {
  268. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($classname).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  269. }
  270. print '</td>';
  271. $ficheinter = new Fichinter($db);
  272. $ficheinter->initAsSpecimen();
  273. // Info
  274. $htmltooltip = '';
  275. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  276. $nextval = $module->getNextValue($mysoc, $ficheinter);
  277. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  278. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  279. if ($nextval) {
  280. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  281. $nextval = $langs->trans($nextval);
  282. }
  283. $htmltooltip .= $nextval.'<br>';
  284. } else {
  285. $htmltooltip .= $langs->trans($module->error).'<br>';
  286. }
  287. }
  288. print '<td class="center">';
  289. print $form->textwithpicto('', $htmltooltip, 1, 0);
  290. print '</td>';
  291. print '</tr>';
  292. }
  293. }
  294. }
  295. closedir($handle);
  296. }
  297. }
  298. }
  299. print '</table>';
  300. print '</div>';
  301. print '<br>';
  302. /*
  303. * Documents models for Interventions
  304. */
  305. print load_fiche_titre($langs->trans("TemplatePDFInterventions"), '', '');
  306. // Defini tableau def des modeles
  307. $type = 'ficheinter';
  308. $def = array();
  309. $sql = "SELECT nom";
  310. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  311. $sql .= " WHERE type = '".$db->escape($type)."'";
  312. $sql .= " AND entity = ".$conf->entity;
  313. $resql = $db->query($sql);
  314. if ($resql) {
  315. $i = 0;
  316. $num_rows = $db->num_rows($resql);
  317. while ($i < $num_rows) {
  318. $array = $db->fetch_array($resql);
  319. array_push($def, $array[0]);
  320. $i++;
  321. }
  322. } else {
  323. dol_print_error($db);
  324. }
  325. print '<div class="div-table-responsive-no-min">';
  326. print '<table class="noborder centpercent">';
  327. print '<tr class="liste_titre">';
  328. print '<td>'.$langs->trans("Name").'</td>';
  329. print '<td>'.$langs->trans("Description").'</td>';
  330. print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
  331. print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
  332. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  333. print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
  334. print "</tr>\n";
  335. clearstatcache();
  336. foreach ($dirmodels as $reldir) {
  337. $realpath = $reldir."core/modules/fichinter/doc";
  338. $dir = dol_buildpath($realpath);
  339. if (is_dir($dir)) {
  340. $handle = opendir($dir);
  341. if (is_resource($handle)) {
  342. while (($file = readdir($handle)) !== false) {
  343. $filelist[] = $file;
  344. }
  345. closedir($handle);
  346. arsort($filelist);
  347. foreach ($filelist as $file) {
  348. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  349. if (file_exists($dir.'/'.$file)) {
  350. $name = substr($file, 4, dol_strlen($file) - 16);
  351. $classname = substr($file, 0, dol_strlen($file) - 12);
  352. require_once $dir.'/'.$file;
  353. $module = new $classname($db);
  354. $modulequalified = 1;
  355. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  356. $modulequalified = 0;
  357. }
  358. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  359. $modulequalified = 0;
  360. }
  361. if ($modulequalified) {
  362. print '<tr class="oddeven"><td width="100">';
  363. print (empty($module->name) ? $name : $module->name);
  364. print "</td><td>\n";
  365. if (method_exists($module, 'info')) {
  366. print $module->info($langs);
  367. } else {
  368. print $module->description;
  369. }
  370. print '</td>';
  371. // Active
  372. if (in_array($name, $def)) {
  373. print "<td align=\"center\">\n";
  374. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">';
  375. print img_picto($langs->trans("Enabled"), 'switch_on');
  376. print '</a>';
  377. print "</td>";
  378. } else {
  379. print "<td align=\"center\">\n";
  380. print '<a 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>';
  381. print "</td>";
  382. }
  383. // Default
  384. print "<td align=\"center\">";
  385. if ($conf->global->FICHEINTER_ADDON_PDF == "$name") {
  386. print img_picto($langs->trans("Default"), 'on');
  387. } else {
  388. print '<a 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>';
  389. }
  390. print '</td>';
  391. // Info
  392. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  393. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  394. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  395. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  396. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  397. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  398. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  399. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  400. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  401. $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
  402. print '<td class="center">';
  403. print $form->textwithpicto('', $htmltooltip, -1, 0);
  404. print '</td>';
  405. // Preview
  406. print '<td class="center">';
  407. if ($module->type == 'pdf') {
  408. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  409. } else {
  410. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  411. }
  412. print '</td>';
  413. print '</tr>';
  414. }
  415. }
  416. }
  417. }
  418. }
  419. }
  420. }
  421. print '</table>';
  422. print '</div>';
  423. print "<br>";
  424. /*
  425. * Other options
  426. */
  427. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  428. print '<div class="div-table-responsive-no-min">';
  429. print '<table class="noborder centpercent">';
  430. print '<tr class="liste_titre">';
  431. print '<td>'.$langs->trans("Parameter").'</td>';
  432. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  433. print "<td>&nbsp;</td>\n";
  434. print "</tr>\n";
  435. $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
  436. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  437. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  438. foreach ($substitutionarray as $key => $val) {
  439. $htmltext .= $key.'<br>';
  440. }
  441. $htmltext .= '</i>';
  442. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  443. print '<input type="hidden" name="token" value="'.newToken().'">';
  444. print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
  445. print '<tr class="oddeven"><td colspan="2">';
  446. print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
  447. $variablename = 'FICHINTER_FREE_TEXT';
  448. if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
  449. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
  450. } else {
  451. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  452. $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
  453. print $doleditor->Create();
  454. }
  455. print '</td><td class="right">';
  456. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  457. print "</td></tr>\n";
  458. print '</form>';
  459. //Use draft Watermark
  460. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  461. print '<input type="hidden" name="token" value="'.newToken().'">';
  462. print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
  463. print '<tr class="oddeven"><td>';
  464. print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
  465. print '</td><td>';
  466. print '<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('FICHINTER_DRAFT_WATERMARK')).'">';
  467. print '</td><td class="right">';
  468. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  469. print "</td></tr>\n";
  470. print '</form>';
  471. // print products on fichinter
  472. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  473. print '<input type="hidden" name="token" value="'.newToken().'">';
  474. print '<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
  475. print '<tr class="oddeven"><td>';
  476. print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')</td>';
  477. print '<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
  478. if (getDolGlobalString("FICHINTER_PRINT_PRODUCTS")) {
  479. print 'checked ';
  480. }
  481. print '/>';
  482. print '</td><td class="right">';
  483. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  484. print "</td></tr>\n";
  485. print '</form>';
  486. // Use services duration
  487. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  488. print '<input type="hidden" name="token" value="'.newToken().'">';
  489. print '<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
  490. print '<tr class="oddeven">';
  491. print '<td>';
  492. print $langs->trans("UseServicesDurationOnFichinter");
  493. print '</td>';
  494. print '<td class="center">';
  495. print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString("FICHINTER_USE_SERVICE_DURATION") ? ' checked' : '').'>';
  496. print '</td>';
  497. print '<td class="right">';
  498. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  499. print '</td>';
  500. print '</tr>';
  501. print '</form>';
  502. // Use duration
  503. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  504. print '<input type="hidden" name="token" value="'.newToken().'">';
  505. print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
  506. print '<tr class="oddeven">';
  507. print '<td>';
  508. print $langs->trans("UseDurationOnFichinter");
  509. print '</td>';
  510. print '<td class="center">';
  511. print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString("FICHINTER_WITHOUT_DURATION") ? ' checked' : '').'>';
  512. print '</td>';
  513. print '<td class="right">';
  514. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  515. print '</td>';
  516. print '</tr>';
  517. print '</form>';
  518. // use date without hour
  519. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  520. print '<input type="hidden" name="token" value="'.newToken().'">';
  521. print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
  522. print '<tr class="oddeven">';
  523. print '<td>';
  524. print $langs->trans("UseDateWithoutHourOnFichinter");
  525. print '</td>';
  526. print '<td class="center">';
  527. print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString("FICHINTER_DATE_WITHOUT_HOUR") ? ' checked' : '').'>';
  528. print '</td>';
  529. print '<td class="right">';
  530. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  531. print '</td>';
  532. print '</tr>';
  533. print '</form>';
  534. // Allow online signing
  535. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  536. print '<input type="hidden" name="token" value="'.newToken().'">';
  537. print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
  538. print '<tr class="oddeven">';
  539. print '<td>';
  540. print $langs->trans("AllowOnlineSign");
  541. print '</td>';
  542. print '<td class="center">';
  543. print '<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString("FICHINTER_ALLOW_ONLINE_SIGN") ? ' checked' : '').'>';
  544. print '</td>';
  545. print '<td class="right">';
  546. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  547. print '</td>';
  548. print '</tr>';
  549. print '</form>';
  550. // Allow external download
  551. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  552. print '<input type="hidden" name="token" value="'.newToken().'">';
  553. print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
  554. print '<tr class="oddeven">';
  555. print '<td>';
  556. print $langs->trans("AllowExternalDownload");
  557. print '</td>';
  558. print '<td class="center">';
  559. print '<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString("FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ? ' checked' : '').'>';
  560. print '</td>';
  561. print '<td class="right">';
  562. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  563. print '</td>';
  564. print '</tr>';
  565. print '</form>';
  566. print '</table>';
  567. print '</div>';
  568. print '<br>';
  569. // End of page
  570. llxFooter();
  571. $db->close();