stock.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <?php
  2. /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
  7. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/admin/stock.php
  24. * \ingroup stock
  25. * \brief Page d'administration/configuration du module gestion de stock
  26. */
  27. require '../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("admin", "stocks"));
  31. // Securit check
  32. if (!$user->admin) accessforbidden();
  33. $action = GETPOST('action','alpha');
  34. /*
  35. * Actions
  36. */
  37. if($action)
  38. {
  39. $db->begin();
  40. if ($action == 'STOCK_SUPPORTS_SERVICES')
  41. {
  42. $res = dolibarr_set_const($db, "STOCK_SUPPORTS_SERVICES", GETPOST('STOCK_SUPPORTS_SERVICES','alpha'),'chaine',0,'',$conf->entity);
  43. }
  44. if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
  45. {
  46. $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
  47. }
  48. if ($action == 'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') {
  49. $res = dolibarr_set_const($db, "STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", GETPOST('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity);
  50. }
  51. if ($action == 'STOCK_ALLOW_NEGATIVE_TRANSFER')
  52. {
  53. $res = dolibarr_set_const($db, "STOCK_ALLOW_NEGATIVE_TRANSFER", GETPOST('STOCK_ALLOW_NEGATIVE_TRANSFER','alpha'),'chaine',0,'',$conf->entity);
  54. }
  55. // Mode of stock decrease
  56. if ($action == 'STOCK_CALCULATE_ON_BILL'
  57. || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
  58. || $action == 'STOCK_CALCULATE_ON_SHIPMENT'
  59. || $action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE')
  60. {
  61. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
  62. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
  63. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
  64. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", '','chaine',0,'',$conf->entity);
  65. if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
  66. if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
  67. if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
  68. if ($action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", GETPOST('STOCK_CALCULATE_ON_SHIPMENT_CLOSE','alpha'),'chaine',0,'',$conf->entity);
  69. }
  70. // Mode of stock increase
  71. if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
  72. || $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
  73. || $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
  74. {
  75. //Use variable cause empty(GETPOST()) do not work with php version < 5.4
  76. $valdispatch=GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha');
  77. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
  78. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
  79. $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
  80. if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
  81. if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
  82. if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $valdispatch,'chaine',0,'',$conf->entity);
  83. if (empty($valdispatch)) {
  84. $res=dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", '','chaine',0,'',$conf->entity);
  85. }
  86. }
  87. if($action == 'SUPPLIER_ORDER_USE_DISPATCH_STATUS') {
  88. $res = dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", GETPOST('SUPPLIER_ORDER_USE_DISPATCH_STATUS','alpha'),'chaine',0,'',$conf->entity);
  89. }
  90. if($action == 'STOCK_USE_VIRTUAL_STOCK') {
  91. $res = dolibarr_set_const($db, "STOCK_USE_VIRTUAL_STOCK", GETPOST('STOCK_USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
  92. }
  93. if($action == 'STOCK_MUST_BE_ENOUGH_FOR_INVOICE') {
  94. $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_INVOICE", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_INVOICE','alpha'),'chaine',0,'',$conf->entity);
  95. }
  96. if($action == 'STOCK_MUST_BE_ENOUGH_FOR_ORDER') {
  97. $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_ORDER", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_ORDER','alpha'),'chaine',0,'',$conf->entity);
  98. }
  99. if($action == 'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT') {
  100. $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
  101. }
  102. if($action == 'INDEPENDANT_SUBPRODUCT_STOCK') {
  103. $res = dolibarr_set_const($db, "INDEPENDANT_SUBPRODUCT_STOCK", GETPOST('INDEPENDANT_SUBPRODUCT_STOCK','alpha'),'chaine',0,'',$conf->entity);
  104. }
  105. if (! $res > 0) $error++;
  106. if (! $error)
  107. {
  108. $db->commit();
  109. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  110. }
  111. else
  112. {
  113. $db->rollback();
  114. setEventMessages($langs->trans("Error"), null, 'errors');
  115. }
  116. }
  117. /*
  118. * View
  119. */
  120. llxHeader('',$langs->trans("StockSetup"));
  121. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  122. print load_fiche_titre($langs->trans("StockSetup"),$linkback,'title_setup');
  123. $form=new Form($db);
  124. $disabled='';
  125. if (! empty($conf->productbatch->enabled))
  126. {
  127. $langs->load("productbatch");
  128. $disabled=' disabled';
  129. print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
  130. }
  131. //if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
  132. //{
  133. print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
  134. print '<br>';
  135. //}
  136. // Title rule for stock decrease
  137. print '<table class="noborder" width="100%">';
  138. print '<tr class="liste_titre">';
  139. print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
  140. print " <td align=\"right\">&nbsp;</td>\n";
  141. print '</tr>'."\n";
  142. $found=0;
  143. print '<tr class="oddeven">';
  144. print '<td>'.$langs->trans("DeStockOnBill").'</td>';
  145. print '<td align="right">';
  146. if (! empty($conf->facture->enabled))
  147. {
  148. print "<form method=\"post\" action=\"stock.php\">";
  149. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  150. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_BILL\">";
  151. print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
  152. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  153. print "</form>\n";
  154. }
  155. else
  156. {
  157. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
  158. }
  159. print "</td>\n</tr>\n";
  160. $found++;
  161. print '<tr class="oddeven">';
  162. print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
  163. print '<td align="right">';
  164. if (! empty($conf->commande->enabled))
  165. {
  166. print "<form method=\"post\" action=\"stock.php\">";
  167. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  168. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_VALIDATE_ORDER\">";
  169. print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
  170. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  171. print "</form>\n";
  172. }
  173. else
  174. {
  175. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
  176. }
  177. print "</td>\n</tr>\n";
  178. $found++;
  179. //if (! empty($conf->expedition->enabled))
  180. //{
  181. print '<tr class="oddeven">';
  182. print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
  183. print '<td align="right">';
  184. if (! empty($conf->expedition->enabled))
  185. {
  186. print "<form method=\"post\" action=\"stock.php\">";
  187. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  188. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT\">";
  189. print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
  190. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  191. print "</form>\n";
  192. }
  193. else
  194. {
  195. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
  196. }
  197. print "</td>\n</tr>\n";
  198. $found++;
  199. print '<tr class="oddeven">';
  200. print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
  201. print '<td align="right">';
  202. if (! empty($conf->expedition->enabled))
  203. {
  204. print "<form method=\"post\" action=\"stock.php\">";
  205. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  206. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT_CLOSE\">";
  207. print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,1,$disabled);
  208. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  209. print "</form>\n";
  210. }
  211. else
  212. {
  213. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
  214. }
  215. print "</td>\n</tr>\n";
  216. $found++;
  217. /*if (! $found)
  218. {
  219. print '<tr class="oddeven">';
  220. print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
  221. print "</tr>\n";
  222. }*/
  223. print '</table>';
  224. print '<br>';
  225. // Title rule for stock increase
  226. print '<table class="noborder" width="100%">';
  227. print '<tr class="liste_titre">';
  228. print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
  229. print " <td align=\"right\">&nbsp;</td>\n";
  230. print '</tr>'."\n";
  231. $found=0;
  232. print '<tr class="oddeven">';
  233. print '<td>'.$langs->trans("ReStockOnBill").'</td>';
  234. print '<td align="right">';
  235. if (! empty($conf->fournisseur->enabled))
  236. {
  237. print "<form method=\"post\" action=\"stock.php\">";
  238. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  239. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_BILL\">";
  240. print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
  241. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  242. print "</form>\n";
  243. }
  244. else
  245. {
  246. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
  247. }
  248. print "</td>\n</tr>\n";
  249. $found++;
  250. print '<tr class="oddeven">';
  251. print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
  252. print '<td align="right">';
  253. if (! empty($conf->fournisseur->enabled))
  254. {
  255. print "<form method=\"post\" action=\"stock.php\">";
  256. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  257. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER\">";
  258. print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
  259. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  260. print "</form>\n";
  261. }
  262. else
  263. {
  264. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
  265. }
  266. print "</td>\n</tr>\n";
  267. $found++;
  268. print '<tr class="oddeven">';
  269. print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
  270. print '<td align="right">';
  271. if (! empty($conf->fournisseur->enabled))
  272. {
  273. print "<form method=\"post\" action=\"stock.php\">";
  274. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  275. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
  276. print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
  277. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
  278. print "</form>\n";
  279. }
  280. else
  281. {
  282. print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
  283. }
  284. print "</td>\n</tr>\n";
  285. $found++;
  286. /*if (! $found)
  287. {
  288. print '<tr class="oddeven">';
  289. print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
  290. print "</tr>\n";
  291. }*/
  292. print '</table>';
  293. print '<br>';
  294. print '<table class="noborder" width="100%">';
  295. print '<tr class="liste_titre">';
  296. print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
  297. print " <td align=\"right\">&nbsp;</td>\n";
  298. print '</tr>'."\n";
  299. print '<tr class="oddeven">';
  300. print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
  301. print '<td align="right">';
  302. print "<form method=\"post\" action=\"stock.php\">";
  303. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  304. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
  305. print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1);
  306. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  307. print '</form>';
  308. print "</td>\n";
  309. print "</tr>\n";
  310. // Option to force stock to be enough before adding a line into document
  311. if($conf->invoice->enabled)
  312. {
  313. print '<tr class="oddeven">';
  314. print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
  315. print '<td align="right">';
  316. print "<form method=\"post\" action=\"stock.php\">";
  317. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  318. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
  319. print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
  320. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  321. print '</form>';
  322. print "</td>\n";
  323. print "</tr>\n";
  324. }
  325. if($conf->order->enabled)
  326. {
  327. print '<tr class="oddeven">';
  328. print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
  329. print '<td align="right">';
  330. print "<form method=\"post\" action=\"stock.php\">";
  331. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  332. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
  333. print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
  334. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  335. print '</form>';
  336. print "</td>\n";
  337. print "</tr>\n";
  338. }
  339. if($conf->expedition->enabled)
  340. {
  341. print '<tr class="oddeven">';
  342. print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
  343. print '<td align="right">';
  344. print "<form method=\"post\" action=\"stock.php\">";
  345. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  346. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
  347. print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
  348. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  349. print '</form>';
  350. print "</td>\n";
  351. print "</tr>\n";
  352. }
  353. print '</table>';
  354. print '<br>';
  355. $virtualdiffersfromphysical=0;
  356. if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
  357. || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
  358. ) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
  359. if ($virtualdiffersfromphysical)
  360. {
  361. print '<table class="noborder" width="100%">';
  362. print '<tr class="liste_titre">';
  363. print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
  364. print " <td align=\"right\">&nbsp;</td>\n";
  365. print '</tr>'."\n";
  366. print '<tr class="oddeven">';
  367. print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
  368. print '<td align="right">';
  369. print "<form method=\"post\" action=\"stock.php\">";
  370. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  371. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
  372. print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK",$conf->global->STOCK_USE_VIRTUAL_STOCK,1);
  373. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  374. print '</form>';
  375. print "</td>\n";
  376. print "</tr>\n";
  377. print '</table>';
  378. print '<br>';
  379. }
  380. print '<table class="noborder" width="100%">';
  381. print '<tr class="liste_titre">';
  382. print " <td>".$langs->trans("Other")."</td>\n";
  383. print " <td align=\"right\">&nbsp;</td>\n";
  384. print '</tr>'."\n";
  385. print '<tr class="oddeven">';
  386. print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
  387. print '<td align="right">';
  388. print "<form method=\"post\" action=\"stock.php\">";
  389. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  390. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
  391. print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
  392. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  393. print '</form>';
  394. print "</td>\n";
  395. print "</tr>\n";
  396. print '<tr class="oddeven">';
  397. print '<td>';
  398. print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
  399. print '</td>';
  400. print '<td align="right">';
  401. print "<form method=\"post\" action=\"stock.php\">";
  402. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  403. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_SUPPORTS_SERVICES\">";
  404. print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1);
  405. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  406. print '</form>';
  407. print "</td>\n";
  408. print "</tr>\n";
  409. print '<tr class="oddeven">';
  410. print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
  411. print '<td align="right">';
  412. print "<form method=\"post\" action=\"stock.php\">";
  413. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  414. print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
  415. print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
  416. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  417. print '</form>';
  418. print "</td>\n";
  419. print "</tr>\n";
  420. if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
  421. print '<tr class="oddeven">';
  422. print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
  423. print '<td align="right">';
  424. print "<form method=\"post\" action=\"stock.php\">";
  425. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  426. print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
  427. print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
  428. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  429. print "</form>\n";
  430. print "</td>\n</tr>\n";
  431. }
  432. print '</table>';
  433. print '<br>';
  434. if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
  435. {
  436. print '<table class="noborder" width="100%">';
  437. print '<tr class="liste_titre">';
  438. print '<td>'.$langs->trans("Inventory").'</td>'."\n";
  439. print '<td align="center" width="20">&nbsp;</td>';
  440. print '<td align="center">&nbsp;</td>'."\n";
  441. // Example with a yes / no select
  442. print '<tr class="oddeven">';
  443. print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
  444. print '<td align="center" width="20">&nbsp;</td>';
  445. print '<td align="right" width="300">';
  446. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  447. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  448. print '<input type="hidden" name="action" value="set_INVENTORY_DISABLE_VIRTUAL">';
  449. print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1);
  450. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  451. print '</form>';
  452. print '</td></tr>';
  453. // Example with a yes / no select
  454. print '<tr class="oddeven">';
  455. print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
  456. print '<td align="center" width="20">&nbsp;</td>';
  457. print '<td align="right" width="300">';
  458. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  459. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  460. print '<input type="hidden" name="action" value="set_INVENTORY_USE_MIN_PA_IF_NO_LAST_PA">';
  461. print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1);
  462. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  463. print '</form>';
  464. print '</td></tr>';
  465. // Example with a yes / no select
  466. print '<tr class="oddeven">';
  467. print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
  468. print '<td align="center" width="20">&nbsp;</td>';
  469. print '<td align="right" width="300">';
  470. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  471. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  472. print '<input type="hidden" name="action" value="set_INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT">';
  473. print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1);
  474. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  475. print '</form>';
  476. print '</td></tr>';
  477. print '</table>';
  478. }
  479. /* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
  480. If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
  481. if ($conf->global->PRODUIT_SOUSPRODUITS)
  482. {
  483. print '<tr class="oddeven">';
  484. print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
  485. print '<td align="right">';
  486. print "<form method=\"post\" action=\"stock.php\">";
  487. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  488. print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
  489. print $form->selectyesno("INDEPENDANT_SUBPRODUCT_STOCK",$conf->global->INDEPENDANT_SUBPRODUCT_STOCK,1);
  490. print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
  491. print '</form>';
  492. print "</td>\n";
  493. print "</tr>\n";
  494. }
  495. */
  496. // End of page
  497. llxFooter();
  498. $db->close();