supplier_proposal.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  7. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  8. * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
  9. * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
  10. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  24. */
  25. // Load Dolibarr environment
  26. require '../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
  31. // Load translation files required by the page
  32. $langs->loadLangs(array("admin", "errors", "other", "supplier_proposal"));
  33. if (!$user->admin) {
  34. accessforbidden();
  35. }
  36. $action = GETPOST('action', 'aZ09');
  37. $value = GETPOST('value', 'alpha');
  38. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  39. $label = GETPOST('label', 'alpha');
  40. $scandir = GETPOST('scan_dir', 'alpha');
  41. $type = 'supplier_proposal';
  42. $error = 0;
  43. /*
  44. * Actions
  45. */
  46. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  47. if ($action == 'updateMask') {
  48. $maskconstsupplier_proposal = GETPOST('maskconstsupplier_proposal', 'aZ09');
  49. $masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha');
  50. if ($maskconstsupplier_proposal && preg_match('/_MASK$/', $maskconstsupplier_proposal)) {
  51. $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity);
  52. }
  53. if (!($res > 0)) {
  54. $error++;
  55. }
  56. if (!$error) {
  57. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  58. } else {
  59. setEventMessages($langs->trans("Error"), null, 'errors');
  60. }
  61. }
  62. if ($action == 'specimen') {
  63. $modele = GETPOST('module', 'alpha');
  64. $supplier_proposal = new SupplierProposal($db);
  65. $supplier_proposal->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/supplier_proposal/doc/pdf_".$modele.".modules.php");
  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($supplier_proposal, $langs) > 0) {
  81. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf");
  82. return;
  83. } else {
  84. setEventMessages($module->error, null, 'errors');
  85. dol_syslog($module->error, LOG_ERR);
  86. }
  87. } else {
  88. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  89. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  90. }
  91. }
  92. if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK') {
  93. $draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha');
  94. $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
  95. if (!($res > 0)) {
  96. $error++;
  97. }
  98. if (!$error) {
  99. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  100. } else {
  101. setEventMessages($langs->trans("Error"), null, 'errors');
  102. }
  103. }
  104. if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT') {
  105. $freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  106. $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  107. if (!($res > 0)) {
  108. $error++;
  109. }
  110. if (!$error) {
  111. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  112. } else {
  113. setEventMessages($langs->trans("Error"), null, 'errors');
  114. }
  115. }
  116. if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL') {
  117. $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
  118. if (!($res > 0)) {
  119. $error++;
  120. }
  121. if (!$error) {
  122. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  123. } else {
  124. setEventMessages($langs->trans("Error"), null, 'errors');
  125. }
  126. }
  127. // Activate a model
  128. if ($action == 'set') {
  129. $ret = addDocumentModel($value, $type, $label, $scandir);
  130. } elseif ($action == 'del') {
  131. $ret = delDocumentModel($value, $type);
  132. if ($ret > 0) {
  133. if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$value") {
  134. dolibarr_del_const($db, 'SUPPLIER_PROPOSAL_ADDON_PDF', $conf->entity);
  135. }
  136. }
  137. } elseif ($action == 'setdoc') {
  138. if (dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  139. $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF = $value;
  140. }
  141. // On active le modele
  142. $ret = delDocumentModel($value, $type);
  143. if ($ret > 0) {
  144. $ret = addDocumentModel($value, $type, $label, $scandir);
  145. }
  146. } elseif ($action == 'setmod') {
  147. // TODO Verifier si module numerotation choisi peut etre active
  148. // par appel methode canBeActivated
  149. dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON", $value, 'chaine', 0, '', $conf->entity);
  150. } elseif (preg_match('/set_(.*)/', $action, $reg)) {
  151. $code = $reg[1];
  152. $value = (GETPOST($code) ? GETPOST($code) : 1);
  153. $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
  154. if (!($res > 0)) {
  155. $error++;
  156. }
  157. if ($error) {
  158. setEventMessages($langs->trans('Error'), null, 'errors');
  159. } else {
  160. setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
  161. header("Location: " . $_SERVER["PHP_SELF"]);
  162. exit();
  163. }
  164. } elseif (preg_match('/del_(.*)/', $action, $reg)) {
  165. $code = $reg[1];
  166. $res = dolibarr_del_const($db, $code, $conf->entity);
  167. if (!($res > 0)) {
  168. $error++;
  169. }
  170. if ($error) {
  171. setEventMessages($langs->trans('Error'), null, 'errors');
  172. } else {
  173. setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
  174. header("Location: " . $_SERVER["PHP_SELF"]);
  175. exit();
  176. }
  177. }
  178. /*
  179. * Affiche page
  180. */
  181. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  182. llxHeader('', $langs->trans("SupplierProposalSetup"));
  183. $form = new Form($db);
  184. //if ($mesg) print $mesg;
  185. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  186. print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title_setup');
  187. $head = supplier_proposal_admin_prepare_head();
  188. print dol_get_fiche_head($head, 'general', $langs->trans("CommRequests"), -1, 'supplier_proposal');
  189. /*
  190. * Module numerotation
  191. */
  192. print load_fiche_titre($langs->trans("SupplierProposalNumberingModules"), '', '');
  193. print '<table class="noborder centpercent">';
  194. print '<tr class="liste_titre">';
  195. print '<td>'.$langs->trans("Name")."</td>\n";
  196. print '<td>'.$langs->trans("Description")."</td>\n";
  197. print '<td class="nowrap">'.$langs->trans("Example")."</td>\n";
  198. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  199. print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  200. print '</tr>'."\n";
  201. clearstatcache();
  202. foreach ($dirmodels as $reldir) {
  203. $dir = dol_buildpath($reldir."core/modules/supplier_proposal");
  204. if (is_dir($dir)) {
  205. $handle = opendir($dir);
  206. if (is_resource($handle)) {
  207. while (($file = readdir($handle)) !== false) {
  208. if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
  209. $file = substr($file, 0, dol_strlen($file) - 4);
  210. require_once $dir.'/'.$file.'.php';
  211. $module = new $file;
  212. // Show modules according to features level
  213. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  214. continue;
  215. }
  216. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  217. continue;
  218. }
  219. if ($module->isEnabled()) {
  220. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  221. print $module->info($langs);
  222. print '</td>';
  223. // Show example of numbering module
  224. print '<td class="nowrap">';
  225. $tmp = $module->getExample();
  226. if (preg_match('/^Error/', $tmp)) {
  227. $langs->load("errors");
  228. print '<div class="error">'.$langs->trans($tmp).'</div>';
  229. } elseif ($tmp == 'NotConfigured') {
  230. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  231. } else {
  232. print $tmp;
  233. }
  234. print '</td>'."\n";
  235. print '<td class="center">';
  236. if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file") {
  237. print img_picto($langs->trans("Activated"), 'switch_on');
  238. } else {
  239. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
  240. print img_picto($langs->trans("Disabled"), 'switch_off');
  241. print '</a>';
  242. }
  243. print '</td>';
  244. $supplier_proposal = new SupplierProposal($db);
  245. $supplier_proposal->initAsSpecimen();
  246. // Info
  247. $htmltooltip = '';
  248. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  249. $nextval = $module->getNextValue($mysoc, $supplier_proposal);
  250. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  251. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  252. if ($nextval) {
  253. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  254. $nextval = $langs->trans($nextval);
  255. }
  256. $htmltooltip .= $nextval.'<br>';
  257. } else {
  258. $htmltooltip .= $langs->trans($module->error).'<br>';
  259. }
  260. }
  261. print '<td class="center">';
  262. print $form->textwithpicto('', $htmltooltip, 1, 0);
  263. print '</td>';
  264. print "</tr>\n";
  265. }
  266. }
  267. }
  268. closedir($handle);
  269. }
  270. }
  271. }
  272. print "</table><br>\n";
  273. /*
  274. * Document templates generators
  275. */
  276. print load_fiche_titre($langs->trans("SupplierProposalPDFModules"), '', '');
  277. // Load array def with activated templates
  278. $def = array();
  279. $sql = "SELECT nom";
  280. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  281. $sql .= " WHERE type = '".$db->escape($type)."'";
  282. $sql .= " AND entity = ".$conf->entity;
  283. $resql = $db->query($sql);
  284. if ($resql) {
  285. $i = 0;
  286. $num_rows = $db->num_rows($resql);
  287. while ($i < $num_rows) {
  288. $array = $db->fetch_array($resql);
  289. array_push($def, $array[0]);
  290. $i++;
  291. }
  292. } else {
  293. dol_print_error($db);
  294. }
  295. print "<table class=\"noborder\" width=\"100%\">\n";
  296. print "<tr class=\"liste_titre\">\n";
  297. print " <td>".$langs->trans("Name")."</td>\n";
  298. print " <td>".$langs->trans("Description")."</td>\n";
  299. print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
  300. print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
  301. print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
  302. print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
  303. print "</tr>\n";
  304. clearstatcache();
  305. foreach ($dirmodels as $reldir) {
  306. foreach (array('', '/doc') as $valdir) {
  307. $realpath = $reldir."core/modules/supplier_proposal".$valdir;
  308. $dir = dol_buildpath($realpath);
  309. if (is_dir($dir)) {
  310. $handle = opendir($dir);
  311. if (is_resource($handle)) {
  312. while (($file = readdir($handle)) !== false) {
  313. $filelist[] = $file;
  314. }
  315. closedir($handle);
  316. arsort($filelist);
  317. foreach ($filelist as $file) {
  318. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  319. if (file_exists($dir.'/'.$file)) {
  320. $name = substr($file, 4, dol_strlen($file) - 16);
  321. $classname = substr($file, 0, dol_strlen($file) - 12);
  322. require_once $dir.'/'.$file;
  323. $module = new $classname($db);
  324. $modulequalified = 1;
  325. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  326. $modulequalified = 0;
  327. }
  328. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  329. $modulequalified = 0;
  330. }
  331. if ($modulequalified) {
  332. print '<tr class="oddeven"><td width="100">';
  333. print (empty($module->name) ? $name : $module->name);
  334. print "</td><td>\n";
  335. if (method_exists($module, 'info')) {
  336. print $module->info($langs);
  337. } else {
  338. print $module->description;
  339. }
  340. print '</td>';
  341. // Active
  342. if (in_array($name, $def)) {
  343. print '<td class="center">'."\n";
  344. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
  345. print img_picto($langs->trans("Enabled"), 'switch_on');
  346. print '</a>';
  347. print '</td>';
  348. } else {
  349. print '<td align="center">'."\n";
  350. 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>';
  351. print "</td>";
  352. }
  353. // Defaut
  354. print '<td align="center">';
  355. if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") {
  356. print img_picto($langs->trans("Default"), 'on');
  357. } else {
  358. 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>';
  359. }
  360. print '</td>';
  361. // Info
  362. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  363. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  364. if ($module->type == 'pdf') {
  365. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  366. }
  367. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  368. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  369. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  370. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  371. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  372. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  373. //$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
  374. //$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
  375. $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark, 1, 1);
  376. print '<td class="center">';
  377. print $form->textwithpicto('', $htmltooltip, 1, 0);
  378. print '</td>';
  379. // Preview
  380. print '<td class="center">';
  381. if ($module->type == 'pdf') {
  382. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  383. } else {
  384. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  385. }
  386. print '</td>';
  387. print "</tr>\n";
  388. }
  389. }
  390. }
  391. }
  392. }
  393. }
  394. }
  395. }
  396. print '</table>';
  397. print '<br>';
  398. /*
  399. * Other options
  400. *
  401. */
  402. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  403. print "<table class=\"noborder\" width=\"100%\">";
  404. print "<tr class=\"liste_titre\">";
  405. print "<td>".$langs->trans("Parameter")."</td>\n";
  406. print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
  407. print "<td>&nbsp;</td>\n";
  408. print "</tr>";
  409. $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
  410. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  411. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  412. foreach ($substitutionarray as $key => $val) {
  413. $htmltext .= $key.'<br>';
  414. }
  415. $htmltext .= '</i>';
  416. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  417. print '<input type="hidden" name="token" value="'.newToken().'">';
  418. print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
  419. print '<tr class="oddeven"><td colspan="2">';
  420. print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
  421. $variablename = 'SUPPLIER_PROPOSAL_FREE_TEXT';
  422. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
  423. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
  424. } else {
  425. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  426. $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
  427. print $doleditor->Create();
  428. }
  429. print '</td><td class="right">';
  430. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  431. print "</td></tr>\n";
  432. print '</form>';
  433. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  434. print '<input type="hidden" name="token" value="'.newToken().'">';
  435. print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
  436. print '<tr class="oddeven"><td>';
  437. print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
  438. print '</td><td>';
  439. print '<input class="flat minwidth200" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('SUPPLIER_PROPOSAL_DRAFT_WATERMARK')).'">';
  440. print '</td><td class="right">';
  441. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  442. print "</td></tr>\n";
  443. print '</form>';
  444. if (isModEnabled('banque')) {
  445. print '<tr class="oddeven"><td>';
  446. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
  447. print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
  448. print '</td></tr>';
  449. } else {
  450. print '<tr class="oddeven"><td>';
  451. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  452. }
  453. // Allow external download
  454. print '<tr class="oddeven">';
  455. print '<td>'.$langs->trans("AllowExternalDownload").'</td><td>&nbsp;</td>';
  456. print '<td class="right">';
  457. print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
  458. print '</td></tr>';
  459. print '</table>';
  460. /*
  461. * Directory
  462. */
  463. print '<br>';
  464. print load_fiche_titre($langs->trans("PathToDocuments"), '', '');
  465. print "<table class=\"noborder\" width=\"100%\">\n";
  466. print "<tr class=\"liste_titre\">\n";
  467. print " <td>".$langs->trans("Name")."</td>\n";
  468. print " <td>".$langs->trans("Value")."</td>\n";
  469. print "</tr>\n";
  470. print "<tr class=\"oddeven\">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
  471. print "</table>\n<br>";
  472. // End of page
  473. llxFooter();
  474. $db->close();