';
-//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
-//{
-print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
-//}
print ' ';
// Title rule for stock increase
@@ -217,8 +198,8 @@ if (! empty($conf->fournisseur->enabled))
print "\n\n\n";
}
@@ -231,8 +212,8 @@ if (! empty($conf->fournisseur->enabled))
print "\n\n\n";
}
if (! empty($conf->fournisseur->enabled))
@@ -244,8 +225,8 @@ if (! empty($conf->fournisseur->enabled))
print "\n\n\n";
}
@@ -334,6 +315,34 @@ if ($virtualdiffersfromphysical)
print '';
}
+
+$var=true;
+print '
';
+
+print '
';
+print "
".$langs->trans("Other")."
\n";
+print "
\n";
+print '
'."\n";
+
+$var=!$var;
+
+print "
";
+print '
'.$langs->trans("UserWarehouseAutoCreate").'
';
+
+print '
';
+print "';
+print "
\n";
+print "
\n";
+print ' ';
+print '
';
+print ' ';
+
+
llxFooter();
$db->close();
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index e079efb8ecc..ac0899c286e 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -367,6 +367,16 @@ class Conf
unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
}
+ if (! empty($conf->productbatch->enabled))
+ {
+ $this->global->STOCK_CALCULATE_ON_BILL=0;
+ $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0;
+ $this->global->STOCK_CALCULATE_ON_SHIPMENT=1;
+ $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0;
+ $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0;
+ $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1;
+ }
+
// conf->currency
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
$this->currency=$this->global->MAIN_MONNAIE;
@@ -376,7 +386,7 @@ class Conf
// By default, suppliers ojbects can be linked to all projects
$conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
-
+
// conf->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php
index 0cd30f04d22..6eb358aa99d 100644
--- a/htdocs/core/modules/modProductBatch.class.php
+++ b/htdocs/core/modules/modProductBatch.class.php
@@ -67,7 +67,7 @@ class modProductBatch extends DolibarrModules
$this->config_page_url = array();
// Dependencies
- $this->depends = array("modProduct","modStock"); // List of modules id that must be enabled if this module is enabled
+ $this->depends = array("modProduct","modStock","modExpedition","modSupplier"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index b4ca3504347..d90d4a4c80c 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -84,9 +84,24 @@ if ($id > 0 || ! empty($ref))
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('expeditioncard','globalcard'));
+
/*
* Actions
*/
+
+$warehousecanbeselectedlater=1;
+if (! empty($conf->productbatch->enabled))
+{
+ if (! (GETPOST('entrepot_id','int') > 0))
+ {
+ $langs->load("errors");
+ setEventMessage($langs->trans("WarhouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"),'errors');
+ header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.$id);
+ exit;
+ }
+}
+
+
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -593,7 +608,7 @@ if ($action == 'create')
print_fiche_titre($langs->trans("CreateASending"));
if (! $origin)
{
- $mesg='
'.$langs->trans("ErrorBadParameters").'
';
+ setEventMessage($langs->trans("ErrorBadParameters"),'errors');
}
dol_htmloutput_mesg($mesg);
@@ -771,10 +786,13 @@ if ($action == 'create')
print '';
if (! empty($conf->stock->enabled))
{
- if (empty($conf->productbatch->enabled)) {
- print '