dolibarr  9.0.0
stock.php
Go to the documentation of this file.
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 
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("admin", "stocks"));
33 
34 // Securit check
35 if (!$user->admin) accessforbidden();
36 
37 $action = GETPOST('action','alpha');
38 
39 
40 /*
41  * Actions
42  */
43 
44 if($action)
45 {
46  $db->begin();
47 
48  if ($action == 'STOCK_SUPPORTS_SERVICES')
49  {
50  $res = dolibarr_set_const($db, "STOCK_SUPPORTS_SERVICES", GETPOST('STOCK_SUPPORTS_SERVICES','alpha'),'chaine',0,'',$conf->entity);
51  }
52  if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
53  {
54  $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
55  }
56  if ($action == 'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') {
57  $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);
58  }
59  if ($action == 'STOCK_ALLOW_NEGATIVE_TRANSFER')
60  {
61  $res = dolibarr_set_const($db, "STOCK_ALLOW_NEGATIVE_TRANSFER", GETPOST('STOCK_ALLOW_NEGATIVE_TRANSFER','alpha'),'chaine',0,'',$conf->entity);
62  }
63  // Mode of stock decrease
64  if ($action == 'STOCK_CALCULATE_ON_BILL'
65  || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
66  || $action == 'STOCK_CALCULATE_ON_SHIPMENT'
67  || $action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE')
68  {
69  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
70  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
71  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
72  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", '','chaine',0,'',$conf->entity);
73  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);
74  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);
75  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);
76  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);
77  }
78  // Mode of stock increase
79  if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
80  || $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
81  || $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
82  {
83  //Use variable cause empty(GETPOST()) do not work with php version < 5.4
84  $valdispatch=GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha');
85 
86  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
87  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
88  $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
89  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);
90  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);
91  if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $valdispatch,'chaine',0,'',$conf->entity);
92  if (empty($valdispatch)) {
93  $res=dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", '','chaine',0,'',$conf->entity);
94  }
95  }
96 
97  if($action == 'SUPPLIER_ORDER_USE_DISPATCH_STATUS') {
98  $res = dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", GETPOST('SUPPLIER_ORDER_USE_DISPATCH_STATUS','alpha'),'chaine',0,'',$conf->entity);
99  }
100 
101  if($action == 'STOCK_USE_VIRTUAL_STOCK') {
102  $res = dolibarr_set_const($db, "STOCK_USE_VIRTUAL_STOCK", GETPOST('STOCK_USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
103  }
104 
105  if($action == 'STOCK_MUST_BE_ENOUGH_FOR_INVOICE') {
106  $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_INVOICE", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_INVOICE','alpha'),'chaine',0,'',$conf->entity);
107  }
108  if($action == 'STOCK_MUST_BE_ENOUGH_FOR_ORDER') {
109  $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_ORDER", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_ORDER','alpha'),'chaine',0,'',$conf->entity);
110  }
111  if($action == 'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT') {
112  $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
113  }
114  if($action == 'INDEPENDANT_SUBPRODUCT_STOCK') {
115  $res = dolibarr_set_const($db, "INDEPENDANT_SUBPRODUCT_STOCK", GETPOST('INDEPENDANT_SUBPRODUCT_STOCK','alpha'),'chaine',0,'',$conf->entity);
116  }
117 
118  if (! $res > 0) $error++;
119 
120  if (! $error)
121  {
122  $db->commit();
123  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
124  }
125  else
126  {
127  $db->rollback();
128  setEventMessages($langs->trans("Error"), null, 'errors');
129  }
130 }
131 
132 
133 /*
134  * View
135  */
136 
137 llxHeader('',$langs->trans("StockSetup"));
138 
139 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
140 print load_fiche_titre($langs->trans("StockSetup"),$linkback,'title_setup');
141 
142 $form=new Form($db);
143 
144 
145 $disabled='';
146 if (! empty($conf->productbatch->enabled))
147 {
148  $langs->load("productbatch");
149  $disabled=' disabled';
150  print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
151 }
152 
153 //if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
154 //{
155 print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
156 print '<br>';
157 //}
158 
159 // Title rule for stock decrease
160 print '<table class="noborder" width="100%">';
161 print '<tr class="liste_titre">';
162 print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
163 print " <td align=\"right\">&nbsp;</td>\n";
164 print '</tr>'."\n";
165 
166 $found=0;
167 
168 print '<tr class="oddeven">';
169 print '<td>'.$langs->trans("DeStockOnBill").'</td>';
170 print '<td align="right">';
171 if (! empty($conf->facture->enabled))
172 {
173  print "<form method=\"post\" action=\"stock.php\">";
174  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
175  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_BILL\">";
176  print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
177  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
178  print "</form>\n";
179 }
180 else
181 {
182  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
183 }
184 print "</td>\n</tr>\n";
185 $found++;
186 
187 
188 print '<tr class="oddeven">';
189 print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
190 print '<td align="right">';
191 if (! empty($conf->commande->enabled))
192 {
193  print "<form method=\"post\" action=\"stock.php\">";
194  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
195  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_VALIDATE_ORDER\">";
196  print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
197  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
198  print "</form>\n";
199 }
200 else
201 {
202  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
203 }
204 print "</td>\n</tr>\n";
205 $found++;
206 
207 //if (! empty($conf->expedition->enabled))
208 //{
209 
210 print '<tr class="oddeven">';
211 print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
212 print '<td align="right">';
213 if (! empty($conf->expedition->enabled))
214 {
215  print "<form method=\"post\" action=\"stock.php\">";
216  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
217  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT\">";
218  print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
219  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
220  print "</form>\n";
221 }
222 else
223 {
224  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
225 }
226 print "</td>\n</tr>\n";
227 $found++;
228 
229 
230 print '<tr class="oddeven">';
231 print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
232 print '<td align="right">';
233 if (! empty($conf->expedition->enabled))
234 {
235  print "<form method=\"post\" action=\"stock.php\">";
236  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
237  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT_CLOSE\">";
238  print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,1,$disabled);
239  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
240  print "</form>\n";
241 }
242 else
243 {
244  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
245 }
246 print "</td>\n</tr>\n";
247 $found++;
248 
249 /*if (! $found)
250 {
251 
252  print '<tr class="oddeven">';
253  print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
254  print "</tr>\n";
255 }*/
256 
257 print '</table>';
258 
259 print '<br>';
260 
261 // Title rule for stock increase
262 print '<table class="noborder" width="100%">';
263 print '<tr class="liste_titre">';
264 print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
265 print " <td align=\"right\">&nbsp;</td>\n";
266 print '</tr>'."\n";
267 
268 $found=0;
269 
270 print '<tr class="oddeven">';
271 print '<td>'.$langs->trans("ReStockOnBill").'</td>';
272 print '<td align="right">';
273 if (! empty($conf->fournisseur->enabled))
274 {
275  print "<form method=\"post\" action=\"stock.php\">";
276  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
277  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_BILL\">";
278  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
279  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
280  print "</form>\n";
281 }
282 else
283 {
284  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
285 }
286 print "</td>\n</tr>\n";
287 $found++;
288 
289 
290 
291 print '<tr class="oddeven">';
292 print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
293 print '<td align="right">';
294 if (! empty($conf->fournisseur->enabled))
295 {
296  print "<form method=\"post\" action=\"stock.php\">";
297  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
298  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER\">";
299  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
300  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
301  print "</form>\n";
302 }
303 else
304 {
305  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
306 }
307 print "</td>\n</tr>\n";
308 $found++;
309 
310 
311 print '<tr class="oddeven">';
312 print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
313 print '<td align="right">';
314 if (! empty($conf->fournisseur->enabled))
315 {
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_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
319  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
320  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
321  print "</form>\n";
322 }
323 else
324 {
325  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
326 }
327 print "</td>\n</tr>\n";
328 $found++;
329 
330 /*if (! $found)
331 {
332 
333  print '<tr class="oddeven">';
334  print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
335  print "</tr>\n";
336 }*/
337 
338 print '</table>';
339 
340 print '<br>';
341 print '<table class="noborder" width="100%">';
342 print '<tr class="liste_titre">';
343 print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
344 print " <td align=\"right\">&nbsp;</td>\n";
345 print '</tr>'."\n";
346 
347 
348 print '<tr class="oddeven">';
349 print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
350 print '<td align="right">';
351 print "<form method=\"post\" action=\"stock.php\">";
352 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
353 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
354 print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1);
355 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
356 print '</form>';
357 print "</td>\n";
358 print "</tr>\n";
359 
360 // Option to force stock to be enough before adding a line into document
361 if($conf->invoice->enabled)
362 {
363  print '<tr class="oddeven">';
364  print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
365  print '<td align="right">';
366  print "<form method=\"post\" action=\"stock.php\">";
367  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
368  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
369  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
370  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
371  print '</form>';
372  print "</td>\n";
373  print "</tr>\n";
374 }
375 
376 if($conf->order->enabled)
377 {
378  print '<tr class="oddeven">';
379  print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
380  print '<td align="right">';
381  print "<form method=\"post\" action=\"stock.php\">";
382  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
383  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
384  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
385  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
386  print '</form>';
387  print "</td>\n";
388  print "</tr>\n";
389 }
390 
391 if($conf->expedition->enabled)
392 {
393  print '<tr class="oddeven">';
394  print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
395  print '<td align="right">';
396  print "<form method=\"post\" action=\"stock.php\">";
397  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
398  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
399  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
400  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
401  print '</form>';
402  print "</td>\n";
403  print "</tr>\n";
404 }
405 print '</table>';
406 
407 print '<br>';
408 
409 $virtualdiffersfromphysical=0;
410 if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
411  || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
412  ) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
413 
414 if ($virtualdiffersfromphysical)
415 {
416  print '<table class="noborder" width="100%">';
417  print '<tr class="liste_titre">';
418  print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
419  print " <td align=\"right\">&nbsp;</td>\n";
420  print '</tr>'."\n";
421 
422  print '<tr class="oddeven">';
423  print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
424  print '<td align="right">';
425  print "<form method=\"post\" action=\"stock.php\">";
426  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
427  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
428  print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK",$conf->global->STOCK_USE_VIRTUAL_STOCK,1);
429  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
430  print '</form>';
431  print "</td>\n";
432  print "</tr>\n";
433  print '</table>';
434  print '<br>';
435 }
436 
437 
438 print '<table class="noborder" width="100%">';
439 
440 print '<tr class="liste_titre">';
441 print " <td>".$langs->trans("Other")."</td>\n";
442 print " <td align=\"right\">&nbsp;</td>\n";
443 print '</tr>'."\n";
444 
445 print '<tr class="oddeven">';
446 print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
447 print '<td align="right">';
448 print "<form method=\"post\" action=\"stock.php\">";
449 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
450 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
451 print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
452 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
453 print '</form>';
454 print "</td>\n";
455 print "</tr>\n";
456 
457 print '<tr class="oddeven">';
458 print '<td>';
459 print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
460 print '</td>';
461 print '<td align="right">';
462 print "<form method=\"post\" action=\"stock.php\">";
463 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
464 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_SUPPORTS_SERVICES\">";
465 print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1);
466 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
467 print '</form>';
468 print "</td>\n";
469 print "</tr>\n";
470 
471 print '<tr class="oddeven">';
472 print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
473 print '<td align="right">';
474 print "<form method=\"post\" action=\"stock.php\">";
475 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
476 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
477 print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
478 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
479 print '</form>';
480 print "</td>\n";
481 print "</tr>\n";
482 
483 if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
484 
485  print '<tr class="oddeven">';
486  print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
487  print '<td align="right">';
488  print "<form method=\"post\" action=\"stock.php\">";
489  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
490  print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
491  print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
492  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
493  print "</form>\n";
494  print "</td>\n</tr>\n";
495 }
496 
497 print '</table>';
498 
499 print '<br>';
500 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
501 {
502  print '<table class="noborder" width="100%">';
503  print '<tr class="liste_titre">';
504  print '<td>'.$langs->trans("Inventory").'</td>'."\n";
505  print '<td align="center" width="20">&nbsp;</td>';
506  print '<td align="center">&nbsp;</td>'."\n";
507 
508  // Example with a yes / no select
509  print '<tr class="oddeven">';
510  print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
511  print '<td align="center" width="20">&nbsp;</td>';
512  print '<td align="right" width="300">';
513  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
514  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
515  print '<input type="hidden" name="action" value="set_INVENTORY_DISABLE_VIRTUAL">';
516  print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1);
517  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
518  print '</form>';
519  print '</td></tr>';
520 
521  // Example with a yes / no select
522  print '<tr class="oddeven">';
523  print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
524  print '<td align="center" width="20">&nbsp;</td>';
525  print '<td align="right" width="300">';
526  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
527  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
528  print '<input type="hidden" name="action" value="set_INVENTORY_USE_MIN_PA_IF_NO_LAST_PA">';
529  print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1);
530  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
531  print '</form>';
532  print '</td></tr>';
533 
534  // Example with a yes / no select
535  print '<tr class="oddeven">';
536  print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
537  print '<td align="center" width="20">&nbsp;</td>';
538  print '<td align="right" width="300">';
539  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
540  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
541  print '<input type="hidden" name="action" value="set_INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT">';
542  print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1);
543  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
544  print '</form>';
545  print '</td></tr>';
546 
547  print '</table>';
548 }
549 
550 /* 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.
551 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.
552 if ($conf->global->PRODUIT_SOUSPRODUITS)
553 {
554 
555 
556  print '<tr class="oddeven">';
557  print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
558  print '<td align="right">';
559  print "<form method=\"post\" action=\"stock.php\">";
560  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
561  print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
562  print $form->selectyesno("INDEPENDANT_SUBPRODUCT_STOCK",$conf->global->INDEPENDANT_SUBPRODUCT_STOCK,1);
563  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
564  print '</form>';
565  print "</td>\n";
566  print "</tr>\n";
567 }
568 */
569 
570 // End of page
571 llxFooter();
572 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:510
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='')
Show information for admin users or standard users.
llxHeader()
Empty header.
Definition: wrapper.php:44