commande.php 23 KB

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