commande.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <?php
  2. /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2013 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 Andre Cianfarani <acianfa@free.fr>
  7. * Copyright (C) 2005-2014 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. * Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
  11. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. */
  26. /**
  27. * \file htdocs/admin/commande.php
  28. * \ingroup commande
  29. * \brief Setup page of module Order
  30. */
  31. require '../main.inc.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
  35. $langs->load("admin");
  36. $langs->load("errors");
  37. $langs->load("orders");
  38. $langs->load('other');
  39. if (! $user->admin) accessforbidden();
  40. $action = GETPOST('action','alpha');
  41. $value = GETPOST('value','alpha');
  42. $label = GETPOST('label','alpha');
  43. $scandir = GETPOST('scandir','alpha');
  44. $type = 'order';
  45. /*
  46. * Actions
  47. */
  48. if ($action == 'updateMask')
  49. {
  50. $maskconstorder=GETPOST('maskconstorder','alpha');
  51. $maskorder=GETPOST('maskorder','alpha');
  52. if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'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. else if ($action == 'specimen')
  64. {
  65. $modele=GETPOST('module','alpha');
  66. $commande = new Commande($db);
  67. $commande->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/commande/doc/pdf_".$modele.".modules.php",0);
  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($commande,$langs) > 0)
  86. {
  87. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
  88. return;
  89. }
  90. else
  91. {
  92. setEventMessages($module->error, null, '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. // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
  103. if ($action == 'setModuleOptions')
  104. {
  105. $post_size=count($_POST);
  106. $db->begin();
  107. for($i=0;$i < $post_size;$i++)
  108. {
  109. if (array_key_exists('param'.$i,$_POST))
  110. {
  111. $param=GETPOST("param".$i,'alpha');
  112. $value=GETPOST("value".$i,'alpha');
  113. if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
  114. if (! $res > 0) $error++;
  115. }
  116. }
  117. if (! $error)
  118. {
  119. $db->commit();
  120. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  121. }
  122. else
  123. {
  124. $db->rollback();
  125. setEventMessages($langs->trans("Error"), null, 'errors');
  126. }
  127. }
  128. // Activate a model
  129. else if ($action == 'set')
  130. {
  131. $ret = addDocumentModel($value, $type, $label, $scandir);
  132. }
  133. else if ($action == 'del')
  134. {
  135. $ret = delDocumentModel($value, $type);
  136. if ($ret > 0)
  137. {
  138. if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity);
  139. }
  140. }
  141. // Set default model
  142. else if ($action == 'setdoc')
  143. {
  144. if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
  145. {
  146. // The constant that was read before the new set
  147. // We therefore requires a variable to have a coherent view
  148. $conf->global->COMMANDE_ADDON_PDF = $value;
  149. }
  150. // On active le modele
  151. $ret = delDocumentModel($value, $type);
  152. if ($ret > 0)
  153. {
  154. $ret = addDocumentModel($value, $type, $label, $scandir);
  155. }
  156. }
  157. else if ($action == 'setmod')
  158. {
  159. // TODO Check if numbering module chosen can be activated
  160. // by calling method canBeActivated
  161. dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
  162. }
  163. else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
  164. {
  165. $draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
  166. $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
  167. if (! $res > 0) $error++;
  168. if (! $error)
  169. {
  170. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  171. }
  172. else
  173. {
  174. setEventMessages($langs->trans("Error"), null, 'errors');
  175. }
  176. }
  177. else if ($action == 'set_ORDER_FREE_TEXT')
  178. {
  179. $freetext = GETPOST("ORDER_FREE_TEXT"); // No alpha here, we want exact string
  180. $res = dolibarr_set_const($db, "ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
  181. if (! $res > 0) $error++;
  182. if (! $error)
  183. {
  184. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  185. }
  186. else
  187. {
  188. setEventMessages($langs->trans("Error"), null, 'errors');
  189. }
  190. }
  191. // Activate Set Shippable Icon In List
  192. else if ($action=="setshippableiconinlist") {
  193. $setshippableiconinlist = GETPOST('value','int');
  194. $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity);
  195. if (! $res > 0) $error++;
  196. if (! $error) {
  197. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  198. } else {
  199. setEventMessages($langs->trans("Error"), null, 'errors');
  200. }
  201. }
  202. // Activate ask for payment bank
  203. else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
  204. {
  205. $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
  206. if (! $res > 0) $error++;
  207. if (! $error)
  208. {
  209. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  210. }
  211. else
  212. {
  213. setEventMessages($langs->trans("Error"), null, 'errors');
  214. }
  215. }
  216. // Activate ask for warehouse
  217. else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
  218. {
  219. $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
  220. if (! $res > 0) $error++;
  221. if (! $error)
  222. {
  223. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  224. }
  225. else
  226. {
  227. setEventMessages($langs->trans("Error"), null, 'errors');
  228. }
  229. }
  230. /*
  231. * View
  232. */
  233. $form=new Form($db);
  234. $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
  235. llxHeader("",$langs->trans("OrdersSetup"));
  236. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  237. print load_fiche_titre($langs->trans("OrdersSetup"),$linkback,'title_setup');
  238. $head = order_admin_prepare_head();
  239. dol_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order');
  240. /*
  241. * Orders Numbering model
  242. */
  243. print load_fiche_titre($langs->trans("OrdersNumberingModules"),'','');
  244. print '<table class="noborder" width="100%">';
  245. print '<tr class="liste_titre">';
  246. print '<td>'.$langs->trans("Name").'</td>';
  247. print '<td>'.$langs->trans("Description").'</td>';
  248. print '<td class="nowrap">'.$langs->trans("Example").'</td>';
  249. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  250. print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  251. print '</tr>'."\n";
  252. clearstatcache();
  253. foreach ($dirmodels as $reldir)
  254. {
  255. $dir = dol_buildpath($reldir."core/modules/commande/");
  256. if (is_dir($dir))
  257. {
  258. $handle = opendir($dir);
  259. if (is_resource($handle))
  260. {
  261. $var=true;
  262. while (($file = readdir($handle))!==false)
  263. {
  264. if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
  265. {
  266. $file = substr($file, 0, dol_strlen($file)-4);
  267. require_once $dir.$file.'.php';
  268. $module = new $file($db);
  269. // Show modules according to features level
  270. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
  271. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
  272. if ($module->isEnabled())
  273. {
  274. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  275. print $module->info();
  276. print '</td>';
  277. // Show example of numbering model
  278. print '<td class="nowrap">';
  279. $tmp=$module->getExample();
  280. if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
  281. elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
  282. else print $tmp;
  283. print '</td>'."\n";
  284. print '<td align="center">';
  285. if ($conf->global->COMMANDE_ADDON == $file)
  286. {
  287. print img_picto($langs->trans("Activated"),'switch_on');
  288. }
  289. else
  290. {
  291. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
  292. print img_picto($langs->trans("Disabled"),'switch_off');
  293. print '</a>';
  294. }
  295. print '</td>';
  296. $commande=new Commande($db);
  297. $commande->initAsSpecimen();
  298. // Info
  299. $htmltooltip='';
  300. $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  301. $commande->type=0;
  302. $nextval=$module->getNextValue($mysoc,$commande);
  303. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  304. $htmltooltip.=''.$langs->trans("NextValue").': ';
  305. if ($nextval) {
  306. if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
  307. $nextval = $langs->trans($nextval);
  308. $htmltooltip.=$nextval.'<br>';
  309. } else {
  310. $htmltooltip.=$langs->trans($module->error).'<br>';
  311. }
  312. }
  313. print '<td align="center">';
  314. print $form->textwithpicto('',$htmltooltip,1,0);
  315. print '</td>';
  316. print "</tr>\n";
  317. }
  318. }
  319. }
  320. closedir($handle);
  321. }
  322. }
  323. }
  324. print "</table><br>\n";
  325. /*
  326. * Document templates generators
  327. */
  328. print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
  329. // Load array def with activated templates
  330. $def = array();
  331. $sql = "SELECT nom";
  332. $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
  333. $sql.= " WHERE type = '".$type."'";
  334. $sql.= " AND entity = ".$conf->entity;
  335. $resql=$db->query($sql);
  336. if ($resql)
  337. {
  338. $i = 0;
  339. $num_rows=$db->num_rows($resql);
  340. while ($i < $num_rows)
  341. {
  342. $array = $db->fetch_array($resql);
  343. array_push($def, $array[0]);
  344. $i++;
  345. }
  346. }
  347. else
  348. {
  349. dol_print_error($db);
  350. }
  351. print "<table class=\"noborder\" width=\"100%\">\n";
  352. print "<tr class=\"liste_titre\">\n";
  353. print '<td>'.$langs->trans("Name").'</td>';
  354. print '<td>'.$langs->trans("Description").'</td>';
  355. print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
  356. print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
  357. print '<td align="center" width="38">'.$langs->trans("ShortInfo").'</td>';
  358. print '<td align="center" width="38">'.$langs->trans("Preview").'</td>';
  359. print "</tr>\n";
  360. clearstatcache();
  361. $var=true;
  362. foreach ($dirmodels as $reldir)
  363. {
  364. foreach (array('','/doc') as $valdir)
  365. {
  366. $dir = dol_buildpath($reldir."core/modules/commande".$valdir);
  367. if (is_dir($dir))
  368. {
  369. $handle=opendir($dir);
  370. if (is_resource($handle))
  371. {
  372. while (($file = readdir($handle))!==false)
  373. {
  374. $filelist[]=$file;
  375. }
  376. closedir($handle);
  377. arsort($filelist);
  378. foreach($filelist as $file)
  379. {
  380. if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
  381. {
  382. if (file_exists($dir.'/'.$file))
  383. {
  384. $name = substr($file, 4, dol_strlen($file) -16);
  385. $classname = substr($file, 0, dol_strlen($file) -12);
  386. require_once $dir.'/'.$file;
  387. $module = new $classname($db);
  388. $modulequalified=1;
  389. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
  390. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
  391. if ($modulequalified)
  392. {
  393. $var = !$var;
  394. print '<tr class="oddeven"><td width="100">';
  395. print (empty($module->name)?$name:$module->name);
  396. print "</td><td>\n";
  397. if (method_exists($module,'info')) print $module->info($langs);
  398. else print $module->description;
  399. print '</td>';
  400. // Active
  401. if (in_array($name, $def))
  402. {
  403. print '<td align="center">'."\n";
  404. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
  405. print img_picto($langs->trans("Enabled"),'switch_on');
  406. print '</a>';
  407. print '</td>';
  408. }
  409. else
  410. {
  411. print '<td align="center">'."\n";
  412. print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  413. print "</td>";
  414. }
  415. // Default
  416. print '<td align="center">';
  417. if ($conf->global->COMMANDE_ADDON_PDF == $name)
  418. {
  419. print img_picto($langs->trans("Default"),'on');
  420. }
  421. else
  422. {
  423. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
  424. }
  425. print '</td>';
  426. // Info
  427. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  428. $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
  429. if ($module->type == 'pdf')
  430. {
  431. $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  432. }
  433. $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  434. $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
  435. $htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
  436. $htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
  437. $htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
  438. //$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
  439. //$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
  440. $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
  441. print '<td align="center">';
  442. print $form->textwithpicto('',$htmltooltip,1,0);
  443. print '</td>';
  444. // Preview
  445. print '<td align="center">';
  446. if ($module->type == 'pdf')
  447. {
  448. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
  449. }
  450. else
  451. {
  452. print img_object($langs->trans("PreviewNotAvailable"),'generic');
  453. }
  454. print '</td>';
  455. print "</tr>\n";
  456. }
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. }
  464. print '</table>';
  465. print "<br>";
  466. /*
  467. * Other options
  468. */
  469. print load_fiche_titre($langs->trans("OtherOptions"),'','');
  470. print '<table class="noborder" width="100%">';
  471. print '<tr class="liste_titre">';
  472. print '<td>'.$langs->trans("Parameter").'</td>';
  473. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  474. print "<td>&nbsp;</td>\n";
  475. print "</tr>\n";
  476. $var=true;
  477. $substitutionarray=pdf_getSubstitutionArray($langs);
  478. $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
  479. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  480. foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
  481. $htmltext.='</i>';
  482. $var=! $var;
  483. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  484. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  485. print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
  486. print '<tr class="oddeven"><td colspan="2">';
  487. print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
  488. $variablename='ORDER_FREE_TEXT';
  489. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
  490. {
  491. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
  492. }
  493. else
  494. {
  495. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  496. $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
  497. print $doleditor->Create();
  498. }
  499. print '</td><td align="right">';
  500. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  501. print "</td></tr>\n";
  502. print '</form>';
  503. //Use draft Watermark
  504. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  505. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  506. print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
  507. print '<tr class="oddeven"><td>';
  508. print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
  509. print '</td><td>';
  510. print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
  511. print '</td><td align="right">';
  512. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  513. print "</td></tr>\n";
  514. print '</form>';
  515. // Shippable Icon in List
  516. /* Kept as hidden feature for the moment, result seems bugged.
  517. Whet is definition of "shippable" according to all different STOCK_CALCULATE_... options ?
  518. print '<tr class="oddeven">';
  519. print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
  520. print '<td>&nbsp</td>';
  521. print '<td align="center">';
  522. if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
  523. print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=0">';
  524. print img_picto($langs->trans("Activated"),'switch_on');
  525. } else {
  526. print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=1">';
  527. print img_picto($langs->trans("Disabled"),'switch_off');
  528. }
  529. print '</a></td>';
  530. print '</tr>';
  531. /* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
  532. /*
  533. // Ask for payment bank during order
  534. if ($conf->banque->enabled)
  535. {
  536. print '<tr class="oddeven"><td>';
  537. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
  538. if (! empty($conf->use_javascript_ajax))
  539. {
  540. print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER');
  541. }
  542. else
  543. {
  544. if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER))
  545. {
  546. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  547. }
  548. else
  549. {
  550. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  551. }
  552. }
  553. print '</td></tr>';
  554. }
  555. else
  556. {
  557. print '<tr class="oddeven"><td>';
  558. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  559. }
  560. // Ask for warehouse during order
  561. if ($conf->stock->enabled)
  562. {
  563. print '<tr class="oddeven"><td>';
  564. print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
  565. if (! empty($conf->use_javascript_ajax))
  566. {
  567. print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
  568. }
  569. else
  570. {
  571. if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
  572. {
  573. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  574. }
  575. else
  576. {
  577. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  578. }
  579. }
  580. print '</td></tr>';
  581. }
  582. else
  583. {
  584. print '<tr class="oddeven"><td>';
  585. print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  586. }
  587. */
  588. print '</table>';
  589. print '<br>';
  590. /*
  591. * Notifications
  592. */
  593. print load_fiche_titre($langs->trans("Notifications"),'','');
  594. print '<table class="noborder" width="100%">';
  595. print '<tr class="liste_titre">';
  596. print '<td>'.$langs->trans("Parameter").'</td>';
  597. print '<td align="center" width="60"></td>';
  598. print '<td width="80">&nbsp;</td>';
  599. print "</tr>\n";
  600. print '<tr class="oddeven"><td colspan="2">';
  601. print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
  602. print '</td><td align="right">';
  603. print "</td></tr>\n";
  604. print '</table>';
  605. llxFooter();
  606. $db->close();