fichinter.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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 = '';
  70. $classname = '';
  71. $filefound = 0;
  72. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  73. foreach ($dirmodels as $reldir) {
  74. $file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
  75. if (file_exists($file)) {
  76. $filefound = 1;
  77. $classname = "pdf_".$modele;
  78. break;
  79. }
  80. }
  81. if ($filefound) {
  82. require_once $file;
  83. $module = new $classname($db);
  84. if ($module->write_file($inter, $langs) > 0) {
  85. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
  86. return;
  87. } else {
  88. setEventMessages($module->error, $module->errors, 'errors');
  89. dol_syslog($module->error, LOG_ERR);
  90. }
  91. } else {
  92. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  93. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  94. }
  95. } elseif ($action == 'set') {
  96. // Activate a model
  97. $ret = addDocumentModel($value, $type, $label, $scandir);
  98. } elseif ($action == 'del') {
  99. $ret = delDocumentModel($value, $type);
  100. if ($ret > 0) {
  101. if ($conf->global->FICHEINTER_ADDON_PDF == "$value") {
  102. dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF', $conf->entity);
  103. }
  104. }
  105. } elseif ($action == 'setdoc') {
  106. // Set default model
  107. if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  108. // La constante qui a ete lue en avant du nouveau set
  109. // on passe donc par une variable pour avoir un affichage coherent
  110. $conf->global->FICHEINTER_ADDON_PDF = $value;
  111. }
  112. // On active le modele
  113. $ret = delDocumentModel($value, $type);
  114. if ($ret > 0) {
  115. $ret = addDocumentModel($value, $type, $label, $scandir);
  116. }
  117. } elseif ($action == 'setmod') {
  118. // TODO Verifier si module numerotation choisi peut etre active
  119. // par appel methode canBeActivated
  120. dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity);
  121. } elseif ($action == 'set_FICHINTER_FREE_TEXT') {
  122. $freetext = GETPOST('FICHINTER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  123. $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  124. if (!($res > 0)) {
  125. $error++;
  126. }
  127. if (!$error) {
  128. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  129. } else {
  130. setEventMessages($langs->trans("Error"), null, 'errors');
  131. }
  132. } elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') {
  133. $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
  134. $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
  135. if (!($res > 0)) {
  136. $error++;
  137. }
  138. if (!$error) {
  139. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  140. } else {
  141. setEventMessages($langs->trans("Error"), null, 'errors');
  142. }
  143. } elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') {
  144. $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
  145. $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  146. if (!($res > 0)) {
  147. $error++;
  148. }
  149. if (!$error) {
  150. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  151. } else {
  152. setEventMessages($langs->trans("Error"), null, 'errors');
  153. }
  154. } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
  155. $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
  156. $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  157. if (!($res > 0)) {
  158. $error++;
  159. }
  160. if (!$error) {
  161. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  162. } else {
  163. setEventMessages($langs->trans("Error"), null, 'errors');
  164. }
  165. } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
  166. $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
  167. $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  168. if (!($res > 0)) {
  169. $error++;
  170. }
  171. if (!$error) {
  172. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  173. } else {
  174. setEventMessages($langs->trans("Error"), null, 'errors');
  175. }
  176. } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
  177. $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
  178. $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  179. if (!($res > 0)) {
  180. $error++;
  181. }
  182. if (!$error) {
  183. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  184. } else {
  185. setEventMessages($langs->trans("Error"), null, 'errors');
  186. }
  187. } elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") {
  188. $val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha');
  189. $res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  190. if (!($res > 0)) {
  191. $error++;
  192. }
  193. if (!$error) {
  194. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  195. } else {
  196. setEventMessages($langs->trans("Error"), null, 'errors');
  197. }
  198. } elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
  199. $val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha');
  200. $res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
  201. if (!($res > 0)) {
  202. $error++;
  203. }
  204. if (!$error) {
  205. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  206. } else {
  207. setEventMessages($langs->trans("Error"), null, 'errors');
  208. }
  209. }
  210. /*
  211. * View
  212. */
  213. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  214. llxHeader();
  215. $form = new Form($db);
  216. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  217. print load_fiche_titre($langs->trans("InterventionsSetup"), $linkback, 'title_setup');
  218. $head = fichinter_admin_prepare_head();
  219. print dol_get_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), -1, 'intervention');
  220. // Interventions numbering model
  221. print load_fiche_titre($langs->trans("FicheinterNumberingModules"), '', '');
  222. print '<div class="div-table-responsive-no-min">';
  223. print '<table class="noborder centpercent">';
  224. print '<tr class="liste_titre">';
  225. print '<td width="100">'.$langs->trans("Name").'</td>';
  226. print '<td>'.$langs->trans("Description").'</td>';
  227. print '<td>'.$langs->trans("Example").'</td>';
  228. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  229. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  230. print "</tr>\n";
  231. clearstatcache();
  232. foreach ($dirmodels as $reldir) {
  233. $dir = dol_buildpath($reldir."core/modules/fichinter/");
  234. if (is_dir($dir)) {
  235. $handle = opendir($dir);
  236. if (is_resource($handle)) {
  237. while (($file = readdir($handle)) !== false) {
  238. if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
  239. $file = $reg[1];
  240. $classname = substr($file, 4);
  241. require_once $dir.$file.'.php';
  242. $module = new $file();
  243. if ($module->isEnabled()) {
  244. // Show modules according to features level
  245. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  246. continue;
  247. }
  248. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  249. continue;
  250. }
  251. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  252. print $module->info($langs);
  253. print '</td>';
  254. // Show example of numbering model
  255. print '<td class="nowrap">';
  256. $tmp = $module->getExample();
  257. if (preg_match('/^Error/', $tmp)) {
  258. $langs->load("errors");
  259. print '<div class="error">'.$langs->trans($tmp).'</div>';
  260. } elseif ($tmp == 'NotConfigured') {
  261. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  262. } else {
  263. print $tmp;
  264. }
  265. print '</td>'."\n";
  266. print '<td class="center">';
  267. if ($conf->global->FICHEINTER_ADDON == $classname) {
  268. print img_picto($langs->trans("Activated"), 'switch_on');
  269. } else {
  270. 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>';
  271. }
  272. print '</td>';
  273. $ficheinter = new Fichinter($db);
  274. $ficheinter->initAsSpecimen();
  275. // Info
  276. $htmltooltip = '';
  277. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  278. $nextval = $module->getNextValue($mysoc, $ficheinter);
  279. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  280. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  281. if ($nextval) {
  282. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  283. $nextval = $langs->trans($nextval);
  284. }
  285. $htmltooltip .= $nextval.'<br>';
  286. } else {
  287. $htmltooltip .= $langs->trans($module->error).'<br>';
  288. }
  289. }
  290. print '<td class="center">';
  291. print $form->textwithpicto('', $htmltooltip, 1, 0);
  292. print '</td>';
  293. print '</tr>';
  294. }
  295. }
  296. }
  297. closedir($handle);
  298. }
  299. }
  300. }
  301. print '</table>';
  302. print '</div>';
  303. print '<br>';
  304. /*
  305. * Documents models for Interventions
  306. */
  307. print load_fiche_titre($langs->trans("TemplatePDFInterventions"), '', '');
  308. // Defini tableau def des modeles
  309. $type = 'ficheinter';
  310. $def = array();
  311. $sql = "SELECT nom";
  312. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  313. $sql .= " WHERE type = '".$db->escape($type)."'";
  314. $sql .= " AND entity = ".$conf->entity;
  315. $resql = $db->query($sql);
  316. if ($resql) {
  317. $i = 0;
  318. $num_rows = $db->num_rows($resql);
  319. while ($i < $num_rows) {
  320. $array = $db->fetch_array($resql);
  321. array_push($def, $array[0]);
  322. $i++;
  323. }
  324. } else {
  325. dol_print_error($db);
  326. }
  327. print '<div class="div-table-responsive-no-min">';
  328. print '<table class="noborder centpercent">';
  329. print '<tr class="liste_titre">';
  330. print '<td>'.$langs->trans("Name").'</td>';
  331. print '<td>'.$langs->trans("Description").'</td>';
  332. print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
  333. print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
  334. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  335. print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
  336. print "</tr>\n";
  337. clearstatcache();
  338. foreach ($dirmodels as $reldir) {
  339. $realpath = $reldir."core/modules/fichinter/doc";
  340. $dir = dol_buildpath($realpath);
  341. if (is_dir($dir)) {
  342. $handle = opendir($dir);
  343. if (is_resource($handle)) {
  344. while (($file = readdir($handle)) !== false) {
  345. $filelist[] = $file;
  346. }
  347. closedir($handle);
  348. arsort($filelist);
  349. foreach ($filelist as $file) {
  350. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  351. if (file_exists($dir.'/'.$file)) {
  352. $name = substr($file, 4, dol_strlen($file) - 16);
  353. $classname = substr($file, 0, dol_strlen($file) - 12);
  354. require_once $dir.'/'.$file;
  355. $module = new $classname($db);
  356. $modulequalified = 1;
  357. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  358. $modulequalified = 0;
  359. }
  360. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  361. $modulequalified = 0;
  362. }
  363. if ($modulequalified) {
  364. print '<tr class="oddeven"><td width="100">';
  365. print(empty($module->name) ? $name : $module->name);
  366. print "</td><td>\n";
  367. if (method_exists($module, 'info')) {
  368. print $module->info($langs);
  369. } else {
  370. print $module->description;
  371. }
  372. print '</td>';
  373. // Active
  374. if (in_array($name, $def)) {
  375. print "<td align=\"center\">\n";
  376. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">';
  377. print img_picto($langs->trans("Enabled"), 'switch_on');
  378. print '</a>';
  379. print "</td>";
  380. } else {
  381. print "<td align=\"center\">\n";
  382. 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>';
  383. print "</td>";
  384. }
  385. // Default
  386. print "<td align=\"center\">";
  387. if ($conf->global->FICHEINTER_ADDON_PDF == "$name") {
  388. print img_picto($langs->trans("Default"), 'on');
  389. } else {
  390. 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>';
  391. }
  392. print '</td>';
  393. // Info
  394. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  395. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  396. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  397. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  398. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  399. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  400. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  401. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  402. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  403. $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
  404. print '<td class="center">';
  405. print $form->textwithpicto('', $htmltooltip, -1, 0);
  406. print '</td>';
  407. // Preview
  408. print '<td class="center">';
  409. if ($module->type == 'pdf') {
  410. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  411. } else {
  412. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  413. }
  414. print '</td>';
  415. print '</tr>';
  416. }
  417. }
  418. }
  419. }
  420. }
  421. }
  422. }
  423. print '</table>';
  424. print '</div>';
  425. print "<br>";
  426. /*
  427. * Other options
  428. */
  429. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  430. print '<div class="div-table-responsive-no-min">';
  431. print '<table class="noborder centpercent">';
  432. print '<tr class="liste_titre">';
  433. print '<td>'.$langs->trans("Parameter").'</td>';
  434. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  435. print "<td>&nbsp;</td>\n";
  436. print "</tr>\n";
  437. $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
  438. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  439. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  440. foreach ($substitutionarray as $key => $val) {
  441. $htmltext .= $key.'<br>';
  442. }
  443. $htmltext .= '</i>';
  444. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  445. print '<input type="hidden" name="token" value="'.newToken().'">';
  446. print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
  447. print '<tr class="oddeven"><td colspan="2">';
  448. print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
  449. $variablename = 'FICHINTER_FREE_TEXT';
  450. if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
  451. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
  452. } else {
  453. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  454. $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
  455. print $doleditor->Create();
  456. }
  457. print '</td><td class="right">';
  458. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  459. print "</td></tr>\n";
  460. print '</form>';
  461. //Use draft Watermark
  462. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  463. print '<input type="hidden" name="token" value="'.newToken().'">';
  464. print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
  465. print '<tr class="oddeven"><td>';
  466. print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
  467. print '</td><td>';
  468. print '<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('FICHINTER_DRAFT_WATERMARK')).'">';
  469. print '</td><td class="right">';
  470. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  471. print "</td></tr>\n";
  472. print '</form>';
  473. // print products on fichinter
  474. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  475. print '<input type="hidden" name="token" value="'.newToken().'">';
  476. print '<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
  477. print '<tr class="oddeven"><td>';
  478. print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')</td>';
  479. print '<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
  480. if (getDolGlobalString("FICHINTER_PRINT_PRODUCTS")) {
  481. print 'checked ';
  482. }
  483. print '/>';
  484. print '</td><td class="right">';
  485. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  486. print "</td></tr>\n";
  487. print '</form>';
  488. // Use services duration
  489. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  490. print '<input type="hidden" name="token" value="'.newToken().'">';
  491. print '<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
  492. print '<tr class="oddeven">';
  493. print '<td>';
  494. print $langs->trans("UseServicesDurationOnFichinter");
  495. print '</td>';
  496. print '<td class="center">';
  497. print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString("FICHINTER_USE_SERVICE_DURATION") ? ' checked' : '').'>';
  498. print '</td>';
  499. print '<td class="right">';
  500. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  501. print '</td>';
  502. print '</tr>';
  503. print '</form>';
  504. // Use duration
  505. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  506. print '<input type="hidden" name="token" value="'.newToken().'">';
  507. print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
  508. print '<tr class="oddeven">';
  509. print '<td>';
  510. print $langs->trans("UseDurationOnFichinter");
  511. print '</td>';
  512. print '<td class="center">';
  513. print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString("FICHINTER_WITHOUT_DURATION") ? ' checked' : '').'>';
  514. print '</td>';
  515. print '<td class="right">';
  516. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  517. print '</td>';
  518. print '</tr>';
  519. print '</form>';
  520. // use date without hour
  521. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  522. print '<input type="hidden" name="token" value="'.newToken().'">';
  523. print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
  524. print '<tr class="oddeven">';
  525. print '<td>';
  526. print $langs->trans("UseDateWithoutHourOnFichinter");
  527. print '</td>';
  528. print '<td class="center">';
  529. print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString("FICHINTER_DATE_WITHOUT_HOUR") ? ' checked' : '').'>';
  530. print '</td>';
  531. print '<td class="right">';
  532. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  533. print '</td>';
  534. print '</tr>';
  535. print '</form>';
  536. // Allow online signing
  537. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  538. print '<input type="hidden" name="token" value="'.newToken().'">';
  539. print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
  540. print '<tr class="oddeven">';
  541. print '<td>';
  542. print $langs->trans("AllowOnlineSign");
  543. print '</td>';
  544. print '<td class="center">';
  545. print '<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString("FICHINTER_ALLOW_ONLINE_SIGN") ? ' checked' : '').'>';
  546. print '</td>';
  547. print '<td class="right">';
  548. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  549. print '</td>';
  550. print '</tr>';
  551. print '</form>';
  552. // Allow external download
  553. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  554. print '<input type="hidden" name="token" value="'.newToken().'">';
  555. print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
  556. print '<tr class="oddeven">';
  557. print '<td>';
  558. print $langs->trans("AllowExternalDownload");
  559. print '</td>';
  560. print '<td class="center">';
  561. print '<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString("FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ? ' checked' : '').'>';
  562. print '</td>';
  563. print '<td class="right">';
  564. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  565. print '</td>';
  566. print '</tr>';
  567. print '</form>';
  568. print '</table>';
  569. print '</div>';
  570. print '<br>';
  571. // End of page
  572. llxFooter();
  573. $db->close();