propal.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  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@capnetworks.com>
  8. * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
  9. * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
  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 <http://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/admin/propal.php
  26. * \ingroup propale
  27. * \brief Setup page for commercial proposal module
  28. */
  29. require '../main.inc.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
  34. $langs->load("admin");
  35. $langs->load("errors");
  36. $langs->load('other');
  37. $langs->load('propal');
  38. if (! $user->admin) accessforbidden();
  39. $action = GETPOST('action','alpha');
  40. $value = GETPOST('value','alpha');
  41. $label = GETPOST('label','alpha');
  42. $scandir = GETPOST('scandir','alpha');
  43. $type='propal';
  44. /*
  45. * Actions
  46. */
  47. $error=0;
  48. if ($action == 'updateMask')
  49. {
  50. $maskconstpropal=GETPOST('maskconstpropal','alpha');
  51. $maskpropal=GETPOST('maskpropal','alpha');
  52. if ($maskconstpropal) $res = dolibarr_set_const($db,$maskconstpropal,$maskpropal,'chaine',0,'',$conf->entity);
  53. if (! $res > 0) $error++;
  54. if (! $error)
  55. {
  56. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  57. }
  58. else
  59. {
  60. setEventMessages($langs->trans("Error"), null, 'errors');
  61. }
  62. }
  63. if ($action == 'specimen')
  64. {
  65. $modele=GETPOST('module','alpha');
  66. $propal = new Propal($db);
  67. $propal->initAsSpecimen();
  68. // Search template files
  69. $file=''; $classname=''; $filefound=0;
  70. $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
  71. foreach($dirmodels as $reldir)
  72. {
  73. $file=dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php");
  74. if (file_exists($file))
  75. {
  76. $filefound=1;
  77. $classname = "pdf_".$modele;
  78. break;
  79. }
  80. }
  81. if ($filefound)
  82. {
  83. require_once $file;
  84. $module = new $classname($db);
  85. if ($module->write_file($propal,$langs) > 0)
  86. {
  87. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
  88. return;
  89. }
  90. else
  91. {
  92. setEventMessages($module->error, $module->errors, 'errors');
  93. dol_syslog($module->error, LOG_ERR);
  94. }
  95. }
  96. else
  97. {
  98. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  99. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  100. }
  101. }
  102. if ($action == 'set_PROPALE_DRAFT_WATERMARK')
  103. {
  104. $draft = GETPOST('PROPALE_DRAFT_WATERMARK','alpha');
  105. $res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
  106. if (! $res > 0) $error++;
  107. if (! $error)
  108. {
  109. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  110. }
  111. else
  112. {
  113. setEventMessages($langs->trans("Error"), null, 'errors');
  114. }
  115. }
  116. if ($action == 'set_PROPOSAL_FREE_TEXT')
  117. {
  118. $freetext = GETPOST('PROPOSAL_FREE_TEXT'); // No alpha here, we want exact string
  119. $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
  120. if (! $res > 0) $error++;
  121. if (! $error)
  122. {
  123. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  124. }
  125. else
  126. {
  127. setEventMessages($langs->trans("Error"), null, 'errors');
  128. }
  129. }
  130. if ($action == 'setdefaultduration')
  131. {
  132. $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION",$value,'chaine',0,'',$conf->entity);
  133. if (! $res > 0) $error++;
  134. if (! $error)
  135. {
  136. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  137. }
  138. else
  139. {
  140. setEventMessages($langs->trans("Error"), null, 'errors');
  141. }
  142. }
  143. if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
  144. {
  145. $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity);
  146. if (! $res > 0) $error++;
  147. if (! $error)
  148. {
  149. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  150. }
  151. else
  152. {
  153. setEventMessages($langs->trans("Error"), null, 'errors');
  154. }
  155. }
  156. // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
  157. if ($action == 'setModuleOptions')
  158. {
  159. $post_size=count($_POST);
  160. $db->begin();
  161. for($i=0;$i < $post_size;$i++)
  162. {
  163. if (array_key_exists('param'.$i,$_POST))
  164. {
  165. $param=GETPOST("param".$i,'alpha');
  166. $value=GETPOST("value".$i,'alpha');
  167. if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
  168. if (! $res > 0) $error++;
  169. }
  170. }
  171. if (! $error)
  172. {
  173. $db->commit();
  174. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  175. }
  176. else
  177. {
  178. $db->rollback();
  179. setEventMessages($langs->trans("Error"), null, 'errors');
  180. }
  181. }
  182. // Activate a model
  183. if ($action == 'set')
  184. {
  185. $ret = addDocumentModel($value, $type, $label, $scandir);
  186. }
  187. else if ($action == 'del')
  188. {
  189. $ret = delDocumentModel($value, $type);
  190. if ($ret > 0)
  191. {
  192. if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF',$conf->entity);
  193. }
  194. }
  195. else if ($action == 'setdoc')
  196. {
  197. if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
  198. {
  199. $conf->global->PROPALE_ADDON_PDF = $value;
  200. }
  201. // On active le modele
  202. $ret = delDocumentModel($value, $type);
  203. if ($ret > 0)
  204. {
  205. $ret = addDocumentModel($value, $type, $label, $scandir);
  206. }
  207. }
  208. else if ($action == 'setmod')
  209. {
  210. // TODO Verifier si module numerotation choisi peut etre active
  211. // par appel methode canBeActivated
  212. dolibarr_set_const($db, "PROPALE_ADDON",$value,'chaine',0,'',$conf->entity);
  213. }
  214. /*
  215. * View
  216. */
  217. $form=new Form($db);
  218. $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
  219. llxHeader('',$langs->trans("PropalSetup"));
  220. //if ($mesg) print $mesg;
  221. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  222. print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup');
  223. $head = propal_admin_prepare_head();
  224. dol_fiche_head($head, 'general', $langs->trans("Proposals"), -1, 'propal');
  225. /*
  226. * Module numerotation
  227. */
  228. print load_fiche_titre($langs->trans("ProposalsNumberingModules"),'','');
  229. print '<table class="noborder" width="100%">';
  230. print '<tr class="liste_titre">';
  231. print '<td>'.$langs->trans("Name")."</td>\n";
  232. print '<td>'.$langs->trans("Description")."</td>\n";
  233. print '<td class="nowrap">'.$langs->trans("Example")."</td>\n";
  234. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  235. print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  236. print '</tr>'."\n";
  237. clearstatcache();
  238. foreach ($dirmodels as $reldir)
  239. {
  240. $dir = dol_buildpath($reldir."core/modules/propale/");
  241. if (is_dir($dir))
  242. {
  243. $handle = opendir($dir);
  244. if (is_resource($handle))
  245. {
  246. $var=true;
  247. while (($file = readdir($handle))!==false)
  248. {
  249. if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php')
  250. {
  251. $file = substr($file, 0, dol_strlen($file)-4);
  252. require_once $dir.$file.'.php';
  253. $module = new $file;
  254. // Show modules according to features level
  255. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
  256. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
  257. if ($module->isEnabled())
  258. {
  259. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  260. print $module->info();
  261. print '</td>';
  262. // Show example of numbering module
  263. print '<td class="nowrap">';
  264. $tmp=$module->getExample();
  265. if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
  266. elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
  267. else print $tmp;
  268. print '</td>'."\n";
  269. print '<td align="center">';
  270. if ($conf->global->PROPALE_ADDON == "$file")
  271. {
  272. print img_picto($langs->trans("Activated"),'switch_on');
  273. }
  274. else
  275. {
  276. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
  277. print img_picto($langs->trans("Disabled"),'switch_off');
  278. print '</a>';
  279. }
  280. print '</td>';
  281. $propal=new Propal($db);
  282. $propal->initAsSpecimen();
  283. // Info
  284. $htmltooltip='';
  285. $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  286. $propal->type=0;
  287. $nextval=$module->getNextValue($mysoc,$propal);
  288. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  289. $htmltooltip.=''.$langs->trans("NextValue").': ';
  290. if ($nextval) {
  291. if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
  292. $nextval = $langs->trans($nextval);
  293. $htmltooltip.=$nextval.'<br>';
  294. } else {
  295. $htmltooltip.=$langs->trans($module->error).'<br>';
  296. }
  297. }
  298. print '<td align="center">';
  299. print $form->textwithpicto('',$htmltooltip,1,0);
  300. print '</td>';
  301. print "</tr>\n";
  302. }
  303. }
  304. }
  305. closedir($handle);
  306. }
  307. }
  308. }
  309. print "</table><br>\n";
  310. /*
  311. * Document templates generators
  312. */
  313. print load_fiche_titre($langs->trans("ProposalsPDFModules"),'','');
  314. // Load array def with activated templates
  315. $def = array();
  316. $sql = "SELECT nom";
  317. $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
  318. $sql.= " WHERE type = '".$type."'";
  319. $sql.= " AND entity = ".$conf->entity;
  320. $resql=$db->query($sql);
  321. if ($resql)
  322. {
  323. $i = 0;
  324. $num_rows=$db->num_rows($resql);
  325. while ($i < $num_rows)
  326. {
  327. $array = $db->fetch_array($resql);
  328. array_push($def, $array[0]);
  329. $i++;
  330. }
  331. }
  332. else
  333. {
  334. dol_print_error($db);
  335. }
  336. print "<table class=\"noborder\" width=\"100%\">\n";
  337. print "<tr class=\"liste_titre\">\n";
  338. print " <td>".$langs->trans("Name")."</td>\n";
  339. print " <td>".$langs->trans("Description")."</td>\n";
  340. print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
  341. print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
  342. print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
  343. print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
  344. print "</tr>\n";
  345. clearstatcache();
  346. $var=true;
  347. foreach ($dirmodels as $reldir)
  348. {
  349. foreach (array('','/doc') as $valdir)
  350. {
  351. $dir = dol_buildpath($reldir."core/modules/propale".$valdir);
  352. if (is_dir($dir))
  353. {
  354. $handle=opendir($dir);
  355. if (is_resource($handle))
  356. {
  357. while (($file = readdir($handle))!==false)
  358. {
  359. $filelist[]=$file;
  360. }
  361. closedir($handle);
  362. arsort($filelist);
  363. foreach($filelist as $file)
  364. {
  365. if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
  366. {
  367. if (file_exists($dir.'/'.$file))
  368. {
  369. $name = substr($file, 4, dol_strlen($file) -16);
  370. $classname = substr($file, 0, dol_strlen($file) -12);
  371. require_once $dir.'/'.$file;
  372. $module = new $classname($db);
  373. $modulequalified=1;
  374. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
  375. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
  376. if ($modulequalified)
  377. {
  378. $var = !$var;
  379. print '<tr class="oddeven"><td width="100">';
  380. print (empty($module->name)?$name:$module->name);
  381. print "</td><td>\n";
  382. if (method_exists($module,'info')) print $module->info($langs);
  383. else print $module->description;
  384. print '</td>';
  385. // Active
  386. if (in_array($name, $def))
  387. {
  388. print '<td align="center">'."\n";
  389. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
  390. print img_picto($langs->trans("Enabled"),'switch_on');
  391. print '</a>';
  392. print '</td>';
  393. }
  394. else
  395. {
  396. print "<td align=\"center\">\n";
  397. print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  398. print "</td>";
  399. }
  400. // Defaut
  401. print "<td align=\"center\">";
  402. if ($conf->global->PROPALE_ADDON_PDF == "$name")
  403. {
  404. print img_picto($langs->trans("Default"),'on');
  405. }
  406. else
  407. {
  408. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
  409. }
  410. print '</td>';
  411. // Info
  412. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  413. $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
  414. if ($module->type == 'pdf')
  415. {
  416. $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  417. }
  418. $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  419. $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
  420. $htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
  421. $htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
  422. $htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
  423. //$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
  424. //$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
  425. $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark,1,1);
  426. print '<td align="center">';
  427. print $form->textwithpicto('',$htmltooltip,1,0);
  428. print '</td>';
  429. // Preview
  430. print '<td align="center">';
  431. if ($module->type == 'pdf')
  432. {
  433. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
  434. }
  435. else
  436. {
  437. print img_object($langs->trans("PreviewNotAvailable"),'generic');
  438. }
  439. print '</td>';
  440. print "</tr>\n";
  441. }
  442. }
  443. }
  444. }
  445. }
  446. }
  447. }
  448. }
  449. print '</table>';
  450. print '<br>';
  451. /*
  452. * Other options
  453. */
  454. print load_fiche_titre($langs->trans("OtherOptions"),'','');
  455. print "<table class=\"noborder\" width=\"100%\">";
  456. print "<tr class=\"liste_titre\">";
  457. print "<td>".$langs->trans("Parameter")."</td>\n";
  458. print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
  459. print "<td>&nbsp;</td>\n";
  460. print "</tr>";
  461. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  462. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  463. print "<input type=\"hidden\" name=\"action\" value=\"setdefaultduration\">";
  464. print '<tr class="oddeven">';
  465. print '<td>'.$langs->trans("DefaultProposalDurationValidity").'</td>';
  466. print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".$conf->global->PROPALE_VALIDITY_DURATION."\"></td>";
  467. print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
  468. print '</tr>';
  469. print '</form>';
  470. /*
  471. $var=! $var;
  472. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  473. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  474. print '<input type="hidden" name="action" value="setusecustomercontactasrecipient">';
  475. print '<tr class="oddeven"><td>';
  476. print $langs->trans("UseCustomerContactAsPropalRecipientIfExist");
  477. print '</td><td width="60" align="center">';
  478. print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1);
  479. print '</td><td align="right">';
  480. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  481. print "</td></tr>\n";
  482. print '</form>';
  483. */
  484. $substitutionarray=pdf_getSubstitutionArray($langs);
  485. $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
  486. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  487. foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
  488. $htmltext.='</i>';
  489. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  490. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  491. print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
  492. print '<tr class="oddeven"><td colspan="2">';
  493. print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
  494. $variablename='PROPOSAL_FREE_TEXT';
  495. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
  496. {
  497. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
  498. }
  499. else
  500. {
  501. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  502. $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
  503. print $doleditor->Create();
  504. }
  505. print '</td><td align="right">';
  506. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  507. print "</td></tr>\n";
  508. print '</form>';
  509. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  510. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  511. print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
  512. print '<tr class="oddeven"><td>';
  513. print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
  514. print '</td><td>';
  515. print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
  516. print '</td><td align="right">';
  517. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  518. print "</td></tr>\n";
  519. print '</form>';
  520. /* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
  521. if ($conf->banque->enabled)
  522. {
  523. print '<tr class="oddeven"><td>';
  524. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp</td><td align="right">';
  525. if (! empty($conf->use_javascript_ajax))
  526. {
  527. print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL');
  528. }
  529. else
  530. {
  531. if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL))
  532. {
  533. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  534. }
  535. else
  536. {
  537. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  538. }
  539. }
  540. print '</td></tr>';
  541. }
  542. else
  543. {
  544. print '<tr class="oddeven"><td>';
  545. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  546. }
  547. */
  548. print '</table>';
  549. /*
  550. * Directory
  551. */
  552. print '<br>';
  553. print load_fiche_titre($langs->trans("PathToDocuments"),'','');
  554. print "<table class=\"noborder\" width=\"100%\">\n";
  555. print "<tr class=\"liste_titre\">\n";
  556. print " <td>".$langs->trans("Name")."</td>\n";
  557. print " <td>".$langs->trans("Value")."</td>\n";
  558. print "</tr>\n";
  559. print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
  560. print "</table>\n<br>";
  561. /*
  562. * Notifications
  563. */
  564. print load_fiche_titre($langs->trans("Notifications"),'','');
  565. print '<table class="noborder" width="100%">';
  566. print '<tr class="liste_titre">';
  567. print '<td>'.$langs->trans("Parameter").'</td>';
  568. print '<td align="center" width="60"></td>';
  569. print '<td width="80">&nbsp;</td>';
  570. print "</tr>\n";
  571. print '<tr class="oddeven"><td colspan="2">';
  572. print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
  573. print '</td><td align="right">';
  574. print "</td></tr>\n";
  575. print '</table>';
  576. llxFooter();
  577. $db->close();