From cf175b0777ff553348a2a0662fde3a221e175470 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Sep 2017 15:40:36 +0200 Subject: [PATCH] Use return code on activateAll and closeAll --- htdocs/contrat/class/contrat.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9d6f4cce856..9a5edc845b4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -252,7 +252,7 @@ class Contrat extends CommonObject * * @param User $user Object User making action * @param int|string $date_start Date start (now if empty) - * @return void + * @return int <0 if KO, >0 if OK */ function activateAll($user, $date_start='') { @@ -287,19 +287,21 @@ class Contrat extends CommonObject if ($ok) { $this->db->commit(); + return 0; } else { dol_print_error($this->db,'Error in activateAll function'); $this->db->rollback(); + return -1; } } /** * Close all lines of a contract * - * @param User $user Object User making action - * @return void + * @param User $user Object User making action + * @return int <0 if KO, >0 if OK */ function closeAll($user) { @@ -335,11 +337,13 @@ class Contrat extends CommonObject if ($ok) { $this->db->commit(); + return 1; } else { dol_print_error($this->db,'Error in closeAll function'); $this->db->rollback(); + return -1; } }