contract.php 19 KB

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