commande.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  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. $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
  234. llxHeader("",$langs->trans("OrdersSetup"));
  235. $form=new Form($db);
  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"), 0, '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. $var=!$var;
  275. print '<tr '.$bc[$var].'><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 '.$bc[$var].'><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. */
  471. print load_fiche_titre($langs->trans("OtherOptions"),'','');
  472. print '<table class="noborder" width="100%">';
  473. print '<tr class="liste_titre">';
  474. print '<td>'.$langs->trans("Parameter").'</td>';
  475. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  476. print "<td>&nbsp;</td>\n";
  477. print "</tr>\n";
  478. $var=true;
  479. $var=! $var;
  480. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  481. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  482. print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
  483. print '<tr '.$bc[$var].'><td colspan="2">';
  484. print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
  485. $variablename='ORDER_FREE_TEXT';
  486. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
  487. {
  488. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
  489. }
  490. else
  491. {
  492. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  493. $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
  494. print $doleditor->Create();
  495. }
  496. print '</td><td align="right">';
  497. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  498. print "</td></tr>\n";
  499. print '</form>';
  500. //Use draft Watermark
  501. $var=!$var;
  502. print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
  503. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  504. print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
  505. print '<tr '.$bc[$var].'><td colspan="2">';
  506. print $langs->trans("WatermarkOnDraftOrders").'<br>';
  507. print '<input size="50" class="flat" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
  508. print '</td><td align="right">';
  509. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  510. print "</td></tr>\n";
  511. print '</form>';
  512. // Shippable Icon in List
  513. $var=!$var;
  514. print "<tr ".$bc[$var].">";
  515. print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
  516. print '<td>&nbsp</td>';
  517. print '<td align="center">';
  518. if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
  519. print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=0">';
  520. print img_picto($langs->trans("Activated"),'switch_on');
  521. } else {
  522. print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=1">';
  523. print img_picto($langs->trans("Disabled"),'switch_off');
  524. }
  525. print '</a></td>';
  526. print '</tr>';
  527. // Ask for payment bank during order
  528. if ($conf->banque->enabled)
  529. {
  530. $var=!$var;
  531. print '<tr '.$bc[$var].'><td>';
  532. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
  533. if (! empty($conf->use_javascript_ajax))
  534. {
  535. print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER');
  536. }
  537. else
  538. {
  539. if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER))
  540. {
  541. 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>';
  542. }
  543. else
  544. {
  545. 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>';
  546. }
  547. }
  548. print '</td></tr>';
  549. }
  550. else
  551. {
  552. $var=!$var;
  553. print '<tr '.$bc[$var].'><td>';
  554. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  555. }
  556. // Ask for warehouse during order
  557. if ($conf->stock->enabled)
  558. {
  559. $var=!$var;
  560. print '<tr '.$bc[$var].'><td>';
  561. print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
  562. if (! empty($conf->use_javascript_ajax))
  563. {
  564. print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
  565. }
  566. else
  567. {
  568. if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
  569. {
  570. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  571. }
  572. else
  573. {
  574. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  575. }
  576. }
  577. print '</td></tr>';
  578. }
  579. else
  580. {
  581. $var=!$var;
  582. print '<tr '.$bc[$var].'><td>';
  583. print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  584. }
  585. print '</table>';
  586. print '<br>';
  587. /*
  588. * Notifications
  589. */
  590. print load_fiche_titre($langs->trans("Notifications"),'','');
  591. print '<table class="noborder" width="100%">';
  592. print '<tr class="liste_titre">';
  593. print '<td>'.$langs->trans("Parameter").'</td>';
  594. print '<td align="center" width="60"></td>';
  595. print '<td width="80">&nbsp;</td>';
  596. print "</tr>\n";
  597. print '<tr '.$bc[$var].'><td colspan="2">';
  598. print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
  599. print '</td><td align="right">';
  600. print "</td></tr>\n";
  601. print '</table>';
  602. llxFooter();
  603. $db->close();