From 5a3fc00b4c28e96d0e57f637a73ff013e16f9324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Jun 2014 13:32:17 +0200 Subject: [PATCH] Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler --- htdocs/commande/class/commande.class.php | 11 +++++------ htdocs/commande/fiche.php | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) 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'); + } } }