contract.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <?php
  2. /* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
  3. * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/admin/contract.php
  20. * \ingroup contract
  21. * \brief Setup page of module Contracts
  22. */
  23. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("admin", "errors", "contracts"));
  31. if (!$user->admin) {
  32. accessforbidden();
  33. }
  34. $action = GETPOST('action', 'aZ09');
  35. $value = GETPOST('value', 'alpha');
  36. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  37. $label = GETPOST('label', 'alpha');
  38. $scandir = GETPOST('scan_dir', 'alpha');
  39. $type = 'contract';
  40. if (!getDolGlobalString('CONTRACT_ADDON')) {
  41. $conf->global->CONTRACT_ADDON = 'mod_contract_serpis';
  42. }
  43. /*
  44. * Actions
  45. */
  46. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  47. $error=0;
  48. if ($action == 'updateMask') {
  49. $maskconst = GETPOST('maskconstcontract', 'aZ09');
  50. $maskvalue = GETPOST('maskcontract', 'alpha');
  51. if ($maskconst && preg_match('/_MASK$/', $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. $contract = new Contrat($db);
  65. $contract->initAsSpecimen();
  66. // Search template files
  67. $file = '';
  68. $classname = '';
  69. $filefound = 0;
  70. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  71. foreach ($dirmodels as $reldir) {
  72. $file = dol_buildpath($reldir."core/modules/contract/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($contract, $langs) > 0) {
  83. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf");
  84. return;
  85. } else {
  86. setEventMessages($obj->error, $obj->errors, 'errors');
  87. dol_syslog($obj->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->CONTRACT_ADDON_PDF == "$value") {
  100. dolibarr_del_const($db, 'CONTRACT_ADDON_PDF', $conf->entity);
  101. }
  102. }
  103. } elseif ($action == 'setdoc') {
  104. // Set default model
  105. if (dolibarr_set_const($db, "CONTRACT_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->CONTRACT_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 == 'unsetdoc') {
  116. dolibarr_del_const($db, "CONTRACT_ADDON_PDF", $conf->entity);
  117. } elseif ($action == 'setmod') {
  118. // TODO Verifier si module numerotation choisi peut etre active
  119. // par appel methode canBeActivated
  120. dolibarr_set_const($db, "CONTRACT_ADDON", $value, 'chaine', 0, '', $conf->entity);
  121. } elseif ($action == 'set_other') {
  122. $freetext = GETPOST('CONTRACT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  123. $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  124. $draft = GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
  125. $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
  126. $value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
  127. $res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
  128. if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0)) {
  129. $error++;
  130. }
  131. if (!$error) {
  132. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  133. } else {
  134. setEventMessages($langs->trans("Error"), null, 'errors');
  135. }
  136. } elseif ($action == "allowonlinesign") {
  137. if (!dolibarr_set_const($db, "CONTRACT_ALLOW_ONLINESIGN", $value, 'int', 0, '', $conf->entity)) {
  138. $error++;
  139. }
  140. } elseif (preg_match('/set_(.*)/', $action, $reg)) {
  141. $code = $reg[1];
  142. $value = (GETPOST($code) ? GETPOST($code) : 1);
  143. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  144. if (!($res > 0)) {
  145. $error++;
  146. }
  147. if ($error) {
  148. setEventMessages($langs->trans('Error'), null, 'errors');
  149. } else {
  150. setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
  151. header("Location: " . $_SERVER["PHP_SELF"]);
  152. exit();
  153. }
  154. } elseif (preg_match('/del_(.*)/', $action, $reg)) {
  155. $code = $reg[1];
  156. $res = dolibarr_del_const($db, $code, $conf->entity);
  157. if (!($res > 0)) {
  158. $error++;
  159. }
  160. if ($error) {
  161. setEventMessages($langs->trans('Error'), null, 'errors');
  162. } else {
  163. setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
  164. header("Location: " . $_SERVER["PHP_SELF"]);
  165. exit();
  166. }
  167. }
  168. /*
  169. * View
  170. */
  171. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  172. llxHeader();
  173. $form = new Form($db);
  174. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  175. print load_fiche_titre($langs->trans("ContractsSetup"), $linkback, 'title_setup');
  176. $head = contract_admin_prepare_head();
  177. print dol_get_fiche_head($head, 'contract', $langs->trans("Contracts"), -1, 'contract');
  178. /*
  179. * Contracts Numbering model
  180. */
  181. print load_fiche_titre($langs->trans("ContractsNumberingModules"), '', '');
  182. print '<div class="div-table-responsive-no-min">';
  183. print '<table class="noborder centpercent">';
  184. print '<tr class="liste_titre">';
  185. print '<td width="100">'.$langs->trans("Name").'</td>';
  186. print '<td>'.$langs->trans("Description").'</td>';
  187. print '<td>'.$langs->trans("Example").'</td>';
  188. print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
  189. print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  190. print "</tr>\n";
  191. clearstatcache();
  192. foreach ($dirmodels as $reldir) {
  193. $dir = dol_buildpath($reldir."core/modules/contract/");
  194. if (is_dir($dir)) {
  195. $handle = opendir($dir);
  196. if (is_resource($handle)) {
  197. while (($file = readdir($handle)) !== false) {
  198. if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
  199. $file = substr($file, 0, dol_strlen($file) - 4);
  200. require_once $dir.$file.'.php';
  201. $module = new $file($db);
  202. // Show modules according to features level
  203. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  204. continue;
  205. }
  206. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  207. continue;
  208. }
  209. if ($module->isEnabled()) {
  210. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  211. print $module->info($langs);
  212. print '</td>';
  213. // Show example of numbering model
  214. print '<td class="nowrap">';
  215. $tmp = $module->getExample();
  216. if (preg_match('/^Error/', $tmp)) {
  217. $langs->load("errors");
  218. print '<div class="error">'.$langs->trans($tmp).'</div>';
  219. } elseif ($tmp == 'NotConfigured') {
  220. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  221. } else {
  222. print $tmp;
  223. }
  224. print '</td>'."\n";
  225. print '<td class="center">';
  226. if ($conf->global->CONTRACT_ADDON == "$file") {
  227. print img_picto($langs->trans("Activated"), 'switch_on');
  228. } else {
  229. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
  230. print img_picto($langs->trans("Disabled"), 'switch_off');
  231. print '</a>';
  232. }
  233. print '</td>';
  234. $contract = new Contrat($db);
  235. $contract->initAsSpecimen();
  236. // Info
  237. $htmltooltip = '';
  238. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  239. $nextval = $module->getNextValue($mysoc, $contract);
  240. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  241. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  242. if ($nextval) {
  243. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  244. $nextval = $langs->trans($nextval);
  245. }
  246. $htmltooltip .= $nextval.'<br>';
  247. } else {
  248. $htmltooltip .= $langs->trans($module->error).'<br>';
  249. }
  250. }
  251. print '<td class="center">';
  252. print $form->textwithpicto('', $htmltooltip, 1, 0);
  253. print '</td>';
  254. print '</tr>';
  255. }
  256. }
  257. }
  258. closedir($handle);
  259. }
  260. }
  261. }
  262. print '</table></div><br>';
  263. /*
  264. * Documents models for Contracts
  265. */
  266. print load_fiche_titre($langs->trans("TemplatePDFContracts"), '', '');
  267. // Defini tableau def des modeles
  268. $def = array();
  269. $sql = "SELECT nom";
  270. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  271. $sql .= " WHERE type = '".$db->escape($type)."'";
  272. $sql .= " AND entity = ".$conf->entity;
  273. $resql = $db->query($sql);
  274. if ($resql) {
  275. $i = 0;
  276. $num_rows = $db->num_rows($resql);
  277. while ($i < $num_rows) {
  278. $array = $db->fetch_array($resql);
  279. array_push($def, $array[0]);
  280. $i++;
  281. }
  282. } else {
  283. dol_print_error($db);
  284. }
  285. print '<div class="div-table-responsive-no-min">';
  286. print '<table class="noborder centpercent">';
  287. print '<tr class="liste_titre">';
  288. print '<td>'.$langs->trans("Name").'</td>';
  289. print '<td>'.$langs->trans("Description").'</td>';
  290. print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
  291. print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
  292. print '<td class="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  293. print '<td class="center" width="80">'.$langs->trans("Preview").'</td>';
  294. print "</tr>\n";
  295. clearstatcache();
  296. foreach ($dirmodels as $reldir) {
  297. foreach (array('', '/doc') as $valdir) {
  298. $realpath = $reldir."core/modules/contract".$valdir;
  299. $dir = dol_buildpath($realpath);
  300. if (is_dir($dir)) {
  301. $handle = opendir($dir);
  302. if (is_resource($handle)) {
  303. while (($file = readdir($handle)) !== false) {
  304. $filelist[] = $file;
  305. }
  306. closedir($handle);
  307. arsort($filelist);
  308. foreach ($filelist as $file) {
  309. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  310. if (file_exists($dir.'/'.$file)) {
  311. $name = substr($file, 4, dol_strlen($file) - 16);
  312. $classname = substr($file, 0, dol_strlen($file) - 12);
  313. require_once $dir.'/'.$file;
  314. $module = new $classname($db);
  315. $modulequalified = 1;
  316. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  317. $modulequalified = 0;
  318. }
  319. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  320. $modulequalified = 0;
  321. }
  322. if ($modulequalified) {
  323. print '<tr class="oddeven"><td width="100">';
  324. print(empty($module->name) ? $name : $module->name);
  325. print "</td><td>\n";
  326. if (method_exists($module, 'info')) {
  327. print $module->info($langs);
  328. } else {
  329. print $module->description;
  330. }
  331. print '</td>';
  332. // Active
  333. if (in_array($name, $def)) {
  334. print '<td class="center">'."\n";
  335. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
  336. print img_picto($langs->trans("Enabled"), 'switch_on');
  337. print '</a>';
  338. print '</td>';
  339. } else {
  340. print '<td class="center">'."\n";
  341. 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>';
  342. print "</td>";
  343. }
  344. // Defaut
  345. print '<td class="center">';
  346. if (getDolGlobalString('CONTRACT_ADDON_PDF') == $name) {
  347. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  348. } else {
  349. 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>';
  350. }
  351. print '</td>';
  352. // Info
  353. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  354. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  355. if ($module->type == 'pdf') {
  356. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  357. }
  358. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  359. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  360. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  361. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  362. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  363. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  364. $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
  365. print '<td class="center">';
  366. print $form->textwithpicto('', $htmltooltip, 1, 0);
  367. print '</td>';
  368. // Preview
  369. print '<td class="center">';
  370. if ($module->type == 'pdf') {
  371. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  372. } else {
  373. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  374. }
  375. print '</td>';
  376. print "</tr>\n";
  377. }
  378. }
  379. }
  380. }
  381. }
  382. }
  383. }
  384. }
  385. print '</table>';
  386. print '</div>';
  387. print "<br>";
  388. /*
  389. * Other options
  390. *
  391. */
  392. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  393. print '<input type="hidden" name="token" value="'.newToken().'">';
  394. print '<input type="hidden" name="action" value="set_other">';
  395. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  396. print '<div class="div-table-responsive-no-min">';
  397. print '<table class="noborder centpercent">';
  398. print '<tr class="liste_titre">';
  399. print '<td>'.$langs->trans("Parameter").'</td>';
  400. print '<td class="right">'.$langs->trans("Value").'</td>';
  401. print "</tr>\n";
  402. $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
  403. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  404. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  405. foreach ($substitutionarray as $key => $val) {
  406. $htmltext .= $key.'<br>';
  407. }
  408. $htmltext .= '</i>';
  409. print '<tr class="oddeven"><td colspan="2">';
  410. print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
  411. print '<br>';
  412. $variablename = 'CONTRACT_FREE_TEXT';
  413. if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
  414. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
  415. } else {
  416. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  417. $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
  418. print $doleditor->Create();
  419. }
  420. print '</td></tr>'."\n";
  421. //Use draft Watermark
  422. print '<tr class="oddeven"><td>';
  423. print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
  424. print '</td><td class="right">';
  425. print '<input class="flat minwidth200" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('CONTRACT_DRAFT_WATERMARK')).'">';
  426. print '</td></tr>'."\n";
  427. print '<tr class="oddeven">';
  428. print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>';
  429. print '<td class="right">';
  430. print $form->selectyesno("activate_hideClosedServiceByDefault", (getDolGlobalString('CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT') ? $conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT : 0), 1);
  431. print '</td>';
  432. print '</tr>';
  433. // Allow online signing
  434. print '<tr class="oddeven">';
  435. print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
  436. print '<td class="right">';
  437. if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) {
  438. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
  439. print img_picto($langs->trans("Activited"), 'switch_on');
  440. print '</a>';
  441. } else {
  442. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=1">';
  443. print img_picto($langs->trans("Disabled"), 'switch_off');
  444. print '</a>';
  445. }
  446. print '</td>';
  447. print '</tr>';
  448. // Allow external download
  449. print '<tr class="oddeven">';
  450. print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
  451. print '<td class="right">';
  452. print ajax_constantonoff('CONTRACT_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
  453. print '</td>';
  454. print '</tr>';
  455. print '</table>';
  456. print '</div>';
  457. print $form->buttonsSaveCancel("Save", '');
  458. print '</form>';
  459. print dol_get_fiche_end();
  460. // End of page
  461. llxFooter();
  462. $db->close();