diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 36d85366805..dfe848808c8 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -224,7 +224,7 @@ if (empty($reshook))
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
if ($ret < 0)
{
- $mesg='
'.$object->error.'
';
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
@@ -237,7 +237,7 @@ if (empty($reshook))
$ret=$object->addline_batch($batch_line[$i]);
if ($ret < 0)
{
- $mesg=''.$object->error.'
';
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
@@ -249,14 +249,14 @@ if (empty($reshook))
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
if ($ret <= 0)
{
- $mesg=''.$object->error.'
';
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
else
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'
';
+ setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip")), null, 'errors');
$error++;
}
@@ -287,7 +287,7 @@ if (empty($reshook))
}
else
{
- $mesg=$object->error;
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -337,19 +337,18 @@ if (empty($reshook))
}
else
{
- $langs->load("errors");
- setEventMessages($langs->trans($object->error), null, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
-
- else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
+ // TODO add alternative status
+ /*else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
{
$result = $object->setStatut(0);
if ($result < 0)
{
- $mesg = $object->error;
+ setEventMessages($object->error, $object->errors, 'errors');
}
- }
+ }*/
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
{
@@ -360,7 +359,7 @@ if (empty($reshook))
$result=$object->set_date_livraison($user,$datedelivery);
if ($result < 0)
{
- $mesg=''.$object->error.'
';
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -485,8 +484,6 @@ if ($action == 'create')
setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
}
- dol_htmloutput_mesg($mesg);
-
if ($origin)
{
$classname = ucfirst($origin);
@@ -928,8 +925,6 @@ else if ($id || $ref)
if ($object->id > 0)
{
- dol_htmloutput_mesg($mesg);
-
if (!empty($object->origin))
{
$typeobject = $object->origin;
@@ -943,8 +938,6 @@ else if ($id || $ref)
$head=shipping_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending');
- dol_htmloutput_mesg($mesg);
-
/*
* Confirmation de la suppression
*/
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index d7bfc9aed98..08b53bf9e25 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1068,6 +1068,7 @@ class Expedition extends CommonObject
break;
}
}
+ if ($error) break; // break for loop incase of error
}
}
}
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 561b38977ac..dde89bfb6e5 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -139,15 +139,15 @@ class MouvementStock extends CommonObject
$obj = $this->db->fetch_object($resql);
if ($this->db->jdate($obj->eatby) != $eatby)
{
- $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby);
- dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby));
+ $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
+ dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
$this->db->rollback();
return -3;
}
if ($this->db->jdate($obj->sellby) != $sellby)
{
- $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby);
- dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby));
+ $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
+ dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
$this->db->rollback();
return -3;
}