30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
44$langs->loadLangs(array(
"admin",
"stocks"));
51$action =
GETPOST(
'action',
'aZ09');
52$value =
GETPOST(
'value',
'alpha');
53$modulepart =
GETPOST(
'modulepart',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scan_dir',
'alpha');
65include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
69if ($action ==
'update' || preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
70 if ($action ==
'update') {
72 'STOCK_CALCULATE_ON_BILL',
'STOCK_CALCULATE_ON_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_SHIPMENT',
'STOCK_CALCULATE_ON_SHIPMENT_CLOSE',
73 'STOCK_CALCULATE_ON_SUPPLIER_BILL',
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_RECEPTION',
'STOCK_CALCULATE_ON_RECEPTION_CLOSE',
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER',
74 'STOCK_DISALLOW_NEGATIVE_TRANSFER',
'STOCK_MUST_BE_ENOUGH_FOR_INVOICE',
'STOCK_MUST_BE_ENOUGH_FOR_ORDER',
'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT',
75 'STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT'
78 $arrayofcode = array($reg[1]);
82 foreach ($arrayofcode as $code) {
84 if (GETPOSTISSET($code)) {
89 if (in_array($code, array(
'STOCK_CALCULATE_ON_BILL',
'STOCK_CALCULATE_ON_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_SHIPMENT',
'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
95 if (in_array($code, array(
'STOCK_CALCULATE_ON_SUPPLIER_BILL',
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_RECEPTION',
'STOCK_CALCULATE_ON_RECEPTION_CLOSE',
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
109 header(
"Location: ".$_SERVER[
"PHP_SELF"].($page_y ?
'?page_y='.$page_y :
''));
116if ($action ==
'update' || preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
117 if ($action ==
'update') {
118 $arrayofcode = array(
119 'STOCK_CALCULATE_ON_BILL',
'STOCK_CALCULATE_ON_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_SHIPMENT',
'STOCK_CALCULATE_ON_SHIPMENT_CLOSE',
120 'STOCK_CALCULATE_ON_SUPPLIER_BILL',
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER',
'STOCK_CALCULATE_ON_RECEPTION',
'STOCK_CALCULATE_ON_RECEPTION_CLOSE',
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER',
123 $arrayofcode = array($reg[1]);
127 foreach ($arrayofcode as $code) {
131 header(
"Location: ".$_SERVER[
"PHP_SELF"].($page_y ?
'?page_y='.$page_y :
''));
138if ($action ==
'warehouse') {
139 $value =
GETPOST(
'default_warehouse',
'alpha');
149if ($action ==
'specimen') {
150 $modele =
GETPOST(
'module',
'alpha');
158 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
159 foreach ($dirmodels as $reldir) {
160 $file =
dol_buildpath($reldir.
"core/modules/stock/doc/pdf_".$modele.
".modules.php", 0);
161 if (file_exists($file)) {
162 $classname =
"pdf_".$modele;
167 if ($classname !==
'') {
170 $module =
new $classname($db);
171 '@phan-var-force ModelePDFStock $module';
173 if ($module->write_file(
$object, $langs) > 0) {
174 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=stock&file=SPECIMEN.pdf");
182 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
184} elseif ($action ==
'set') {
187} elseif ($action ==
'del') {
194} elseif ($action ==
'setdoc') {
199 $conf->global->STOCK_ADDON_PDF = $value;
214$form =
new Form($db);
215$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
217llxHeader(
'', $langs->trans(
"StockSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-stock');
219$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
220print
load_fiche_titre($langs->trans(
"StockSetup"), $linkback,
'title_setup');
226$form =
new Form($db);
230$disableStockCalculateOn = array();
235 $disableStockCalculateOn[] =
'BILL';
236 $disableStockCalculateOn[] =
'VALIDATE_ORDER';
240 $disableStockCalculateOn[] =
'SUPPLIER_BILL';
241 $disableStockCalculateOn[] =
'SUPPLIER_VALIDATE_ORDER';
243 print
info_admin($langs->trans(
'WhenProductVirtualOnOptionAreForced'));
246if (isModEnabled(
'productbatch')) {
248 $langs->load(
"productbatch");
249 $disableStockCalculateOn[] =
'BILL';
250 $disableStockCalculateOn[] =
'VALIDATE_ORDER';
254 $disableStockCalculateOn[] =
'SUPPLIER_BILL';
255 $disableStockCalculateOn[] =
'SUPPLIER_VALIDATE_ORDER';
257 $descmode =
""; $incmode =
"";
266 print
info_admin($langs->transnoentitiesnoconv(
"WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode));
270print
info_admin($langs->trans(
"IfYouUsePointOfSaleCheckModule"));
274print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
275print
'<input type="hidden" name="token" value="'.newToken().
'">';
276print
'<input type="hidden" name="action" value="update">';
277print
'<input type="hidden" name="page_y" value="">';
280print
'<div class="div-table-responsive-no-min">';
281print
'<table class="noborder centpercent">';
282print
'<tr class="liste_titre">';
283print
"<td>".$langs->trans(
"RuleForStockManagementDecrease").
"</td>\n";
284print
'<td class="right">'.$langs->trans(
"Status").
'</td>'.
"\n";
289print
'<!-- STOCK_CALCULATE_ON_BILL -->';
290print
'<tr class="oddeven">';
291print
'<td>'.$langs->trans(
"DeStockOnBill").
'</td>';
292print
'<td class="right">';
293if (isModEnabled(
'invoice')) {
294 if (
$conf->use_javascript_ajax) {
295 if (in_array(
'BILL', $disableStockCalculateOn)) {
296 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
298 print ajax_constantonoff(
'STOCK_CALCULATE_ON_BILL', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
301 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
302 print $form->selectarray(
"STOCK_CALCULATE_ON_BILL", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_BILL'));
305 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
307print
"</td>\n</tr>\n";
311print
'<!-- STOCK_CALCULATE_ON_VALIDATE_ORDER -->';
312print
'<tr class="oddeven">';
313print
'<td>'.$langs->trans(
"DeStockOnValidateOrder").
'</td>';
314print
'<td class="right">';
315if (isModEnabled(
'order')) {
316 if (
$conf->use_javascript_ajax) {
317 if (in_array(
'VALIDATE_ORDER', $disableStockCalculateOn)) {
318 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
320 print ajax_constantonoff(
'STOCK_CALCULATE_ON_VALIDATE_ORDER', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
323 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
324 print $form->selectarray(
"STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_VALIDATE_ORDER'));
327 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module25Name")).
'</span>';
329print
"</td>\n</tr>\n";
335print
'<!-- STOCK_CALCULATE_ON_SHIPMENT -->';
336print
'<tr class="oddeven">';
337print
'<td>'.$langs->trans(
"DeStockOnShipment").
'</td>';
338print
'<td class="right">';
339if (isModEnabled(
"shipping")) {
340 if (
$conf->use_javascript_ajax) {
341 if (in_array(
'SHIPMENT', $disableStockCalculateOn)) {
342 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
344 print ajax_constantonoff(
'STOCK_CALCULATE_ON_SHIPMENT', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
347 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
348 print $form->selectarray(
"STOCK_CALCULATE_ON_SHIPMENT", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_SHIPMENT'));
351 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module80Name")).
'</span>';
353print
"</td>\n</tr>\n";
356print
'<!-- STOCK_CALCULATE_ON_SHIPMENT_CLOSE -->';
357print
'<tr class="oddeven">';
358print
'<td>'.$langs->trans(
"DeStockOnShipmentOnClosing").
'</td>';
359print
'<td class="right">';
360if (isModEnabled(
"shipping")) {
361 if (
$conf->use_javascript_ajax) {
362 if (in_array(
'SHIPMENT_CLOSE', $disableStockCalculateOn)) {
363 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
365 print ajax_constantonoff(
'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
368 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
369 print $form->selectarray(
"STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'));
372 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module80Name")).
'</span>';
374print
"</td>\n</tr>\n";
385print
'<div class="div-table-responsive-no-min">';
386print
'<table class="noborder centpercent">';
387print
'<tr class="liste_titre">';
388print
"<td>".$langs->trans(
"RuleForStockManagementIncrease").
"</td>\n";
389print
'<td class="right">'.$langs->trans(
"Status").
'</td>'.
"\n";
394print
'<!-- STOCK_CALCULATE_ON_SUPPLIER_BILL -->';
395print
'<tr class="oddeven">';
396print
'<td>'.$langs->trans(
"ReStockOnBill").
'</td>';
397print
'<td class="right">';
398if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
399 if (
$conf->use_javascript_ajax) {
400 if (in_array(
'SUPPLIER_BILL', $disableStockCalculateOn)) {
401 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
403 print ajax_constantonoff(
'STOCK_CALCULATE_ON_SUPPLIER_BILL', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
406 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
407 print $form->selectarray(
"STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_BILL'));
410 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module40Name")).
'</span>';
412print
"</td>\n</tr>\n";
416print
'<!-- STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER -->';
417print
'<tr class="oddeven">';
418print
'<td>'.$langs->trans(
"ReStockOnValidateOrder").
'</td>';
419print
'<td class="right">';
420if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
421 if (
$conf->use_javascript_ajax) {
422 if (in_array(
'SUPPLIER_VALIDATE_ORDER', $disableStockCalculateOn)) {
423 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
425 print ajax_constantonoff(
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
428 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
429 print $form->selectarray(
"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'));
432 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module40Name")).
'</span>';
434print
"</td>\n</tr>\n";
437if (isModEnabled(
"reception")) {
438 print
'<!-- STOCK_CALCULATE_ON_RECEPTION -->';
439 print
'<tr class="oddeven">';
440 print
'<td>'.$langs->trans(
"StockOnReception").
'</td>';
441 print
'<td class="right">';
443 if (
$conf->use_javascript_ajax) {
444 if (in_array(
'RECEPTION', $disableStockCalculateOn)) {
445 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
447 print ajax_constantonoff(
'STOCK_CALCULATE_ON_RECEPTION', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
450 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
451 print $form->selectarray(
"STOCK_CALCULATE_ON_RECEPTION", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_RECEPTION'));
454 print
"</td>\n</tr>\n";
457 print
'<!-- STOCK_CALCULATE_ON_RECEPTION_CLOSE -->';
458 print
'<tr class="oddeven">';
459 print
'<td>'.$langs->trans(
"StockOnReceptionOnClosing").
'</td>';
460 print
'<td class="right">';
462 if (
$conf->use_javascript_ajax) {
463 if (in_array(
'RECEPTION_CLOSE', $disableStockCalculateOn)) {
464 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
466 print ajax_constantonoff(
'STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
469 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
470 print $form->selectarray(
"STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_RECEPTION_CLOSE'));
472 print
"</td>\n</tr>\n";
476 print
'<!-- STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER -->';
477 print
'<tr class="oddeven">';
478 print
'<td>'.$langs->trans(
"ReStockOnDispatchOrder").
'</td>';
479 print
'<td class="right">';
480 if (isModEnabled(
"supplier_order")) {
481 if (
$conf->use_javascript_ajax) {
482 if (in_array(
'SUPPLIER_DISPATCH_ORDER', $disableStockCalculateOn)) {
483 print
img_picto($langs->trans(
"Disabled"),
'off',
'class="opacitymedium"');
485 print ajax_constantonoff(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(),
null, 0, 0, 0, 2, 1, 0,
'',
'',
'reposition');
488 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
489 print $form->selectarray(
"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval,
getDolGlobalString(
'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'));
492 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"Module40Name")).
'</span>';
494 print
"</td>\n</tr>\n";
503print
'<div class="div-table-responsive-no-min">';
504print
'<table class="noborder centpercent">';
505print
'<tr class="liste_titre">';
506print
"<td>".$langs->trans(
"RuleForStockAvailability").
"</td>\n";
507print
'<td class="right">'.$langs->trans(
"Status").
'</td>'.
"\n";
511print
'<tr class="oddeven">';
512print
'<td>'.$langs->trans(
"WarehouseAllowNegativeTransfer").
'</td>';
513print
'<td class="right">';
514if (
$conf->use_javascript_ajax) {
515 print ajax_constantonoff(
'STOCK_DISALLOW_NEGATIVE_TRANSFER', array(),
null, 1);
517 $arrval = array(
'1' => $langs->trans(
"No"),
'0' => $langs->trans(
"Yes"));
518 print $form->selectarray(
"STOCK_DISALLOW_NEGATIVE_TRANSFER", $arrval,
getDolGlobalInt(
'STOCK_DISALLOW_NEGATIVE_TRANSFER'));
524if (isModEnabled(
'invoice')) {
525 print
'<tr class="oddeven">';
526 print
'<td>'.$langs->trans(
"StockMustBeEnoughForInvoice").
'</td>';
527 print
'<td class="right">';
528 if (
$conf->use_javascript_ajax) {
529 print ajax_constantonoff(
'STOCK_MUST_BE_ENOUGH_FOR_INVOICE');
531 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
532 print $form->selectarray(
"STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval,
getDolGlobalString(
'STOCK_MUST_BE_ENOUGH_FOR_INVOICE'));
538if (isModEnabled(
'order')) {
539 print
'<tr class="oddeven">';
540 print
'<td>'.$langs->trans(
"StockMustBeEnoughForOrder").
'</td>';
541 print
'<td class="right">';
542 if (
$conf->use_javascript_ajax) {
543 print ajax_constantonoff(
'STOCK_MUST_BE_ENOUGH_FOR_ORDER');
545 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
546 print $form->selectarray(
"STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval,
getDolGlobalString(
'STOCK_MUST_BE_ENOUGH_FOR_ORDER'));
552if (isModEnabled(
"shipping")) {
553 print
'<tr class="oddeven">';
554 print
'<td>'.$langs->trans(
"StockMustBeEnoughForShipment").
'</td>';
555 print
'<td class="right">';
556 if (
$conf->use_javascript_ajax) {
557 print ajax_constantonoff(
'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT');
559 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
560 print $form->selectarray(
"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval,
getDolGlobalString(
'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'));
570$virtualdiffersfromphysical = 0;
576 || isModEnabled(
'mrp')) {
577 $virtualdiffersfromphysical = 1;
580if ($virtualdiffersfromphysical) {
581 print
'<div class="div-table-responsive-no-min">';
582 print
'<table class="noborder centpercent">';
583 print
'<tr class="liste_titre">';
584 print
"<td>".$langs->trans(
"RuleForStockReplenishment").
" ".
img_help(1, $langs->trans(
"VirtualDiffersFromPhysical")).
"</td>\n";
585 print
'<td class="right">'.$langs->trans(
"Status").
'</td>'.
"\n";
588 print
'<tr class="oddeven">';
590 print $form->textwithpicto($langs->trans(
"UseRealStockByDefault"), $langs->trans(
"ReplenishmentCalculation"));
592 print
'<td class="right">';
593 if (
$conf->use_javascript_ajax) {
594 print ajax_constantonoff(
'STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT');
596 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
597 print $form->selectarray(
"STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval,
getDolGlobalString(
'STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT'));
607if (empty(
$conf->use_javascript_ajax)) {
609 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Save").
'">';
626$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
627$sql .=
" WHERE type = '".$db->escape($type).
"'";
628$sql .=
" AND entity = ".$conf->entity;
629$resql = $db->query($sql);
632 $num_rows = $db->num_rows($resql);
633 while ($i < $num_rows) {
634 $array = $db->fetch_array($resql);
635 if (is_array($array)) {
636 array_push($def, $array[0]);
645print
'<div class="div-table-responsive-no-min">';
646print
'<table class="noborder centpercent">'.
"\n";
647print
'<tr class="liste_titre">'.
"\n";
648print
'<td>'.$langs->trans(
"Name").
'</td>';
649print
'<td>'.$langs->trans(
"Description").
'</td>';
650print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
651print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
652print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
653print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
658foreach ($dirmodels as $reldir) {
659 foreach (array(
'',
'/doc') as $valdir) {
660 $realpath = $reldir.
"core/modules/stock".$valdir;
664 $handle = opendir($dir);
665 if (is_resource($handle)) {
667 while (($file = readdir($handle)) !==
false) {
673 foreach ($filelist as $file) {
674 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
675 if (file_exists($dir.
'/'.$file)) {
676 $name = substr($file, 4,
dol_strlen($file) - 16);
677 $classname = substr($file, 0,
dol_strlen($file) - 12);
679 require_once $dir.
'/'.$file;
680 $module =
new $classname($db);
681 '@phan-var-force ModelePDFStock $module';
683 $modulequalified = 1;
684 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
685 $modulequalified = 0;
687 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
688 $modulequalified = 0;
691 if ($modulequalified) {
692 print
'<tr class="oddeven"><td width="100">';
693 print(empty($module->name) ? $name : $module->
name);
695 if (method_exists($module,
'info')) {
696 print $module->info($langs);
698 print $module->description;
703 if (in_array($name, $def)) {
704 print
'<td class="center">'.
"\n";
705 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
706 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
710 print
'<td class="center">'.
"\n";
711 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
716 print
'<td class="center">';
718 print
img_picto($langs->trans(
"Default"),
'on');
720 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
725 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
726 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
727 if ($module->type ==
'pdf') {
728 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
730 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
732 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
733 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
734 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
737 print
'<td class="center">';
738 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
742 print
'<td class="center">';
743 if ($module->type ==
'pdf') {
744 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
746 print
img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
766print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
767print
'<input type="hidden" name="token" value="'.newToken().
'">';
768print
'<input type="hidden" name="action" value="warehouse">';
769print
'<input type="hidden" name="page_y" value="">';
773print
'<div class="div-table-responsive-no-min">';
774print
'<table class="noborder centpercent">';
776print
'<tr class="liste_titre">';
777print
"<td>".$langs->trans(
"Parameter").
"</td>\n";
778print
'<td class="right"></td>'.
"\n";
781print
'<tr class="oddeven">';
782print
'<td>'.$langs->trans(
"MainDefaultWarehouse").
'</td>';
783print
'<td class="right">';
784print $formproduct->selectWarehouses(
getDolGlobalInt(
'MAIN_DEFAULT_WAREHOUSE', -1),
'default_warehouse',
'', 1, 0, 0,
'', 0, 0, array(),
'left reposition');
785print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
789print
'<tr class="oddeven">';
790print
'<td>'.$langs->trans(
"UserDefaultWarehouse").
'</td>';
791print
'<td class="right">';
792if (
$conf->use_javascript_ajax) {
793 print ajax_constantonoff(
'MAIN_DEFAULT_WAREHOUSE_USER', array(),
null, 0, 0, 1);
795 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
796 print $form->selectarray(
"MAIN_DEFAULT_WAREHOUSE_USER", $arrval,
getDolGlobalString(
'MAIN_DEFAULT_WAREHOUSE_USER'));
802 print
'<tr class="oddeven">';
803 print
'<td>'.$langs->trans(
"UserWarehouseAutoCreate").
'</td>';
804 print
'<td class="right">';
805 if (
$conf->use_javascript_ajax) {
806 print ajax_constantonoff(
'STOCK_USERSTOCK_AUTOCREATE');
808 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
809 print $form->selectarray(
"STOCK_USERSTOCK_AUTOCREATE", $arrval,
getDolGlobalString(
'STOCK_USERSTOCK_AUTOCREATE'));
815print
'<tr class="oddeven">';
816print
'<td>'.$langs->trans(
"WarehouseAskWarehouseOnThirparty").
'</td>';
817print
'<td class="right">';
818if (
$conf->use_javascript_ajax) {
819 print ajax_constantonoff(
'SOCIETE_ASK_FOR_WAREHOUSE');
821 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
822 print $form->selectarray(
"SOCIETE_ASK_FOR_WAREHOUSE", $arrval,
getDolGlobalString(
'SOCIETE_ASK_FOR_WAREHOUSE'));
827print
'<tr class="oddeven">';
828print
'<td>'.$langs->trans(
"WarehouseAskWarehouseDuringPropal").
'</td>';
829print
'<td class="right">';
830if (
$conf->use_javascript_ajax) {
831 print ajax_constantonoff(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL');
833 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
834 print $form->selectarray(
"WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval,
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL'));
839print
'<tr class="oddeven">';
840print
'<td>'.$langs->trans(
"WarehouseAskWarehouseDuringOrder").
'</td>';
841print
'<td class="right">';
842if (
$conf->use_javascript_ajax) {
843 print ajax_constantonoff(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
845 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
846 print $form->selectarray(
"WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval,
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'));
865print
'<tr class="oddeven">';
867print $form->textwithpicto($langs->trans(
"StockSupportServices"), $langs->trans(
"StockSupportServicesDesc"));
869print
'<td class="right">';
870if (
$conf->use_javascript_ajax) {
871 print ajax_constantonoff(
'STOCK_SUPPORTS_SERVICES');
873 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
874 print $form->selectarray(
"STOCK_SUPPORTS_SERVICES", $arrval,
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES'));
880print
'<tr class="oddeven">';
881print
'<td>'.$langs->trans(
"AllowAddLimitStockByWarehouse").
'</td>';
882print
'<td class="right">';
883if (
$conf->use_javascript_ajax) {
884 print ajax_constantonoff(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE');
886 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
887 print $form->selectarray(
"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", $arrval,
getDolGlobalString(
'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE'));
892print
'<tr class="oddeven">';
893print
'<td>'.$langs->trans(
"AlwaysShowFullArbo").
'</td>';
894print
'<td class="right">';
895if (
$conf->use_javascript_ajax) {
896 print ajax_constantonoff(
'STOCK_ALWAYS_SHOW_FULL_ARBO');
898 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
899 print $form->selectarray(
"STOCK_ALWAYS_SHOW_FULL_ARBO", $arrval,
getDolGlobalString(
'STOCK_ALWAYS_SHOW_FULL_ARBO'));
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage warehouses.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stock_admin_prepare_head()
Return array head with list of tabs to view object information.