Skip to content
Snippets Groups Projects
Commit 5b190371 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7

parents f89d74d6 0187a9a4
No related branches found
No related tags found
No related merge requests found
...@@ -134,6 +134,7 @@ class InterfaceDemo extends DolibarrTriggers ...@@ -134,6 +134,7 @@ class InterfaceDemo extends DolibarrTriggers
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_REFUSE':
case 'ORDER_SUPPLIER_CANCEL': case 'ORDER_SUPPLIER_CANCEL':
case 'ORDER_SUPPLIER_SENTBYMAIL': case 'ORDER_SUPPLIER_SENTBYMAIL':
case 'ORDER_SUPPLIER_DISPATCH':
case 'LINEORDER_SUPPLIER_DISPATCH': case 'LINEORDER_SUPPLIER_DISPATCH':
case 'LINEORDER_SUPPLIER_CREATE': case 'LINEORDER_SUPPLIER_CREATE':
case 'LINEORDER_SUPPLIER_UPDATE': case 'LINEORDER_SUPPLIER_UPDATE':
......
...@@ -1275,9 +1275,10 @@ class CommandeFournisseur extends CommonOrder ...@@ -1275,9 +1275,10 @@ class CommandeFournisseur extends CommonOrder
* @param date $sellby sell-by date * @param date $sellby sell-by date
* @param string $batch Lot number * @param string $batch Lot number
* @param int $fk_commandefourndet Id of supplier order line * @param int $fk_commandefourndet Id of supplier order line
* @param int $notrigger 1 = notrigger
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet='') function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0)
{ {
global $conf; global $conf;
$error = 0; $error = 0;
......
...@@ -81,7 +81,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece ...@@ -81,7 +81,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
$fk_commandefourndet = "fk_commandefourndet_".$reg[1]; $fk_commandefourndet = "fk_commandefourndet_".$reg[1];
if (GETPOST($ent,'int') > 0) if (GETPOST($ent,'int') > 0)
{ {
$result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int')); $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger);
} }
else else
{ {
...@@ -98,7 +98,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece ...@@ -98,7 +98,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
$lot = "lot_number_".$reg[1]."_".$reg[2]; $lot = "lot_number_".$reg[1]."_".$reg[2];
$dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']); $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']);
$dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']); $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']);
$fk_commandefourndet = "fk_commandefourndet_".$reg[1]."_".$reg[2];
if (! (GETPOST($ent,'int') > 0)) if (! (GETPOST($ent,'int') > 0))
{ {
dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); dol_syslog('No dispatch for line '.$key.' as no warehouse choosed');
...@@ -110,15 +110,17 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece ...@@ -110,15 +110,17 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
dol_syslog('No dispatch for line '.$key.' as qty is not set or eat-by date are not set'); dol_syslog('No dispatch for line '.$key.' as qty is not set or eat-by date are not set');
$text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').'' .($reg[1]-1); $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').'' .($reg[1]-1);
setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors');
} else { }
$result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), $dDLC, $dDLUO, GETPOST($lot)); else
{
$result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), $dDLC, $dDLUO, GETPOST($lot), GETPOST($fk_commandefourndet, 'int'), $notrigger);
} }
} }
} }
if (! $notrigger) if (! $notrigger && ($result >= 0))
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
// Call trigger // Call trigger
...@@ -126,7 +128,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece ...@@ -126,7 +128,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
// End call triggers // End call triggers
} }
if ($result > 0) if ($result >= 0)
{ {
$db->commit(); $db->commit();
...@@ -138,6 +140,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece ...@@ -138,6 +140,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$langs->trans($commande->error).'</div>'; $mesg='<div class="error">'.$langs->trans($commande->error).'</div>';
setEventMessage($mesg);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment