diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 6c7b7bb5ff3..199b6500184 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1792,7 +1792,7 @@ class Commande extends CommonOrder
else
{
$this->db->rollback();
- $this->error=$this->db->lasterror();
+ $this->error=$line->error;
return -1;
}
}
@@ -2399,11 +2399,10 @@ class Commande extends CommonOrder
}
else
{
- $this->error=$this->db->lasterror();
- $this->errors=array($this->db->lasterror());
- $this->db->rollback();
- dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR);
- return -1;
+ $this->error=$this->line->error;
+
+ $this->db->rollback();
+ return -1;
}
}
else
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index c1a6d38a58a..666a1ea10d4 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -140,7 +140,7 @@ else if ($action == 'reopen' && $user->rights->commande->creer)
}
else
{
- $mesg='
'.$object->error.'
';
+ setEventMessage($object->error, 'errors');
}
}
}
@@ -154,9 +154,8 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm
header('Location: index.php');
exit;
}
- else
- {
- $mesg=''.$object->error.'
';
+ else {
+ setEventMessage($object->error, 'errors');
}
}
@@ -187,7 +186,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
}
else
{
- $mesg=''.$object->error.'
';
+ setEventMessage($object->error, 'errors');
}
}
@@ -445,6 +444,10 @@ else if ($action == 'add' && $user->rights->commande->creer)
else if ($action == 'classifybilled' && $user->rights->commande->creer)
{
$ret=$object->classifyBilled();
+
+ if ($ret < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
// Positionne ref commande client
@@ -1076,7 +1079,9 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer)
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer)
{
$result = $object->cloture($user);
- if ($result < 0) $mesgs=$object->errors;
+ if ($result < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider)
@@ -1097,6 +1102,10 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
if (! $error)
{
$result = $object->cancel($idwarehouse);
+
+ if ($result < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
}