dolibarr  7.0.0-beta
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@capnetworks.com>
5  * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2013-2017 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 $langs->load("admin");
32 $langs->load("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">'.$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\" width=\"160\">&nbsp;</td>\n";
164 print '</tr>'."\n";
165 $var=true;
166 
167 $found=0;
168 
169 
170 print '<tr class="oddeven">';
171 print '<td>'.$langs->trans("DeStockOnBill").'</td>';
172 print '<td align="right">';
173 if (! empty($conf->facture->enabled))
174 {
175  print "<form method=\"post\" action=\"stock.php\">";
176  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
177  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_BILL\">";
178  print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
179  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
180  print "</form>\n";
181 }
182 else
183 {
184  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
185 }
186 print "</td>\n</tr>\n";
187 $found++;
188 
189 
190 print '<tr class="oddeven">';
191 print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
192 print '<td align="right">';
193 if (! empty($conf->commande->enabled))
194 {
195  print "<form method=\"post\" action=\"stock.php\">";
196  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
197  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_VALIDATE_ORDER\">";
198  print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
199  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
200  print "</form>\n";
201 }
202 else
203 {
204  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
205 }
206 print "</td>\n</tr>\n";
207 $found++;
208 
209 //if (! empty($conf->expedition->enabled))
210 //{
211 
212 print '<tr class="oddeven">';
213 print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
214 print '<td align="right">';
215 if (! empty($conf->expedition->enabled))
216 {
217  print "<form method=\"post\" action=\"stock.php\">";
218  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
219  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT\">";
220  print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
221  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
222  print "</form>\n";
223 }
224 else
225 {
226  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
227 }
228 print "</td>\n</tr>\n";
229 $found++;
230 
231 
232 print '<tr class="oddeven">';
233 print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
234 print '<td align="right">';
235 if (! empty($conf->expedition->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_SHIPMENT_CLOSE\">";
240  print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,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("Module80Name"));
247 }
248 print "</td>\n</tr>\n";
249 $found++;
250 
251 /*if (! $found)
252 {
253 
254  print '<tr class="oddeven">';
255  print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
256  print "</tr>\n";
257 }*/
258 
259 print '</table>';
260 
261 print '<br>';
262 
263 // Title rule for stock increase
264 print '<table class="noborder" width="100%">';
265 print '<tr class="liste_titre">';
266 print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
267 print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
268 print '</tr>'."\n";
269 $var=true;
270 
271 $found=0;
272 
273 
274 print '<tr class="oddeven">';
275 print '<td>'.$langs->trans("ReStockOnBill").'</td>';
276 print '<td align="right">';
277 if (! empty($conf->fournisseur->enabled))
278 {
279  print "<form method=\"post\" action=\"stock.php\">";
280  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
281  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_BILL\">";
282  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
283  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
284  print "</form>\n";
285 }
286 else
287 {
288  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
289 }
290 print "</td>\n</tr>\n";
291 $found++;
292 
293 
294 
295 print '<tr class="oddeven">';
296 print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
297 print '<td align="right">';
298 if (! empty($conf->fournisseur->enabled))
299 {
300  print "<form method=\"post\" action=\"stock.php\">";
301  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
302  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER\">";
303  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
304  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
305  print "</form>\n";
306 }
307 else
308 {
309  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
310 }
311 print "</td>\n</tr>\n";
312 $found++;
313 
314 
315 print '<tr class="oddeven">';
316 print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
317 print '<td align="right">';
318 if (! empty($conf->fournisseur->enabled))
319 {
320  print "<form method=\"post\" action=\"stock.php\">";
321  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
322  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
323  print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
324  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
325  print "</form>\n";
326 }
327 else
328 {
329  print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
330 }
331 print "</td>\n</tr>\n";
332 $found++;
333 
334 /*if (! $found)
335 {
336 
337  print '<tr class="oddeven">';
338  print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
339  print "</tr>\n";
340 }*/
341 
342 print '</table>';
343 
344 print '<br>';
345 print '<table class="noborder" width="100%">';
346 print '<tr class="liste_titre">';
347 print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
348 print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
349 print '</tr>'."\n";
350 
351 
352 print '<tr class="oddeven">';
353 print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
354 print '<td align="right">';
355 print "<form method=\"post\" action=\"stock.php\">";
356 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
357 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
358 print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1);
359 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
360 print '</form>';
361 print "</td>\n";
362 print "</tr>\n";
363 
364 // Option to force stock to be enough before adding a line into document
365 if($conf->invoice->enabled) {
366  $var = !$var;
367  print '<tr class="oddeven">';
368  print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
369  print '<td align="right">';
370  print "<form method=\"post\" action=\"stock.php\">";
371  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
372  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
373  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
374  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
375  print '</form>';
376  print "</td>\n";
377  print "</tr>\n";
378 }
379 
380 if($conf->order->enabled) {
381  $var = !$var;
382  print '<tr class="oddeven">';
383  print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
384  print '<td align="right">';
385  print "<form method=\"post\" action=\"stock.php\">";
386  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
387  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
388  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
389  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
390  print '</form>';
391  print "</td>\n";
392  print "</tr>\n";
393 }
394 
395 if($conf->expedition->enabled) {
396  $var = !$var;
397  print '<tr class="oddeven">';
398  print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
399  print '<td align="right">';
400  print "<form method=\"post\" action=\"stock.php\">";
401  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
402  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
403  print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
404  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
405  print '</form>';
406  print "</td>\n";
407  print "</tr>\n";
408 }
409 print '</table>';
410 
411 
412 print '<br>';
413 
414 $virtualdiffersfromphysical=0;
415 if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
416  || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
417  ) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
418 
419 if ($virtualdiffersfromphysical)
420 {
421  print '<table class="noborder" width="100%">';
422  print '<tr class="liste_titre">';
423  print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
424  print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
425  print '</tr>'."\n";
426  $var = !$var;
427  print '<tr class="oddeven">';
428  print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
429  print '<td align="right">';
430  print "<form method=\"post\" action=\"stock.php\">";
431  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
432  print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
433  print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK",$conf->global->STOCK_USE_VIRTUAL_STOCK,1);
434  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
435  print '</form>';
436  print "</td>\n";
437  print "</tr>\n";
438  print '</table>';
439  print '<br>';
440 }
441 
442 
443 print '<table class="noborder" width="100%">';
444 
445 print '<tr class="liste_titre">';
446 print " <td>".$langs->trans("Other")."</td>\n";
447 print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
448 print '</tr>'."\n";
449 
450 print '<tr class="oddeven">';
451 print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
452 print '<td class="width100" align="right">';
453 print "<form method=\"post\" action=\"stock.php\">";
454 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
455 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
456 print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
457 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
458 print '</form>';
459 print "</td>\n";
460 print "</tr>\n";
461 
462 print '<tr class="oddeven">';
463 print '<td>';
464 print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")).'</td>';
465 print '<td align="right">';
466 print "<form method=\"post\" action=\"stock.php\">";
467 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
468 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_SUPPORTS_SERVICES\">";
469 print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1);
470 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
471 print '</form>';
472 print "</td>\n";
473 print "</tr>\n";
474 
475 print '<tr class="oddeven">';
476 print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
477 print '<td align="right">';
478 print "<form method=\"post\" action=\"stock.php\">";
479 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
480 print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
481 print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
482 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
483 print '</form>';
484 print "</td>\n";
485 print "</tr>\n";
486 
487 if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
488 
489  print '<tr class="oddeven">';
490  print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
491  print '<td align="right">';
492  print "<form method=\"post\" action=\"stock.php\">";
493  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
494  print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
495  print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
496  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
497  print "</form>\n";
498  print "</td>\n</tr>\n";
499 }
500 
501 print '</table>';
502 
503 print '<br>';
504 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
505 {
506  print '<table class="noborder" width="100%">';
507  print '<tr class="liste_titre">';
508  print '<td>'.$langs->trans("Inventory").'</td>'."\n";
509  print '<td align="center" width="20">&nbsp;</td>';
510  print '<td align="center" width="100">&nbsp;</td>'."\n";
511 
512  // Example with a yes / no select
513  print '<tr class="oddeven">';
514  print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
515  print '<td align="center" width="20">&nbsp;</td>';
516  print '<td align="right" width="300">';
517  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
518  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
519  print '<input type="hidden" name="action" value="set_INVENTORY_DISABLE_VIRTUAL">';
520  print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1);
521  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
522  print '</form>';
523  print '</td></tr>';
524 
525  // Example with a yes / no select
526  print '<tr class="oddeven">';
527  print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
528  print '<td align="center" width="20">&nbsp;</td>';
529  print '<td align="right" width="300">';
530  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
531  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
532  print '<input type="hidden" name="action" value="set_INVENTORY_USE_MIN_PA_IF_NO_LAST_PA">';
533  print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1);
534  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
535  print '</form>';
536  print '</td></tr>';
537 
538  // Example with a yes / no select
539  print '<tr class="oddeven">';
540  print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
541  print '<td align="center" width="20">&nbsp;</td>';
542  print '<td align="right" width="300">';
543  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
544  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
545  print '<input type="hidden" name="action" value="set_INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT">';
546  print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1);
547  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
548  print '</form>';
549  print '</td></tr>';
550 
551  print '</table>';
552 }
553 
554 /* 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.
555 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.
556 if ($conf->global->PRODUIT_SOUSPRODUITS)
557 {
558 
559 
560  print '<tr class="oddeven">';
561  print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
562  print '<td align="right">';
563  print "<form method=\"post\" action=\"stock.php\">";
564  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
565  print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
566  print $form->selectyesno("INDEPENDANT_SUBPRODUCT_STOCK",$conf->global->INDEPENDANT_SUBPRODUCT_STOCK,1);
567  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
568  print '</form>';
569  print "</td>\n";
570  print "</tr>\n";
571 }
572 */
573 
574 
575 llxFooter();
576 
577 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
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:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
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')
Show information for admin users or standard users.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91