From 23be23238b8f1c2344932951eb760a81fb9cdc6d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 30 Dec 2004 15:20:36 +0000 Subject: [PATCH] Modification pour le no_commit --- htdocs/paiement.class.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index f6b3f59815d..ba14bddf1f8 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -107,16 +107,26 @@ class Paiement /** * \brief Création du paiement en base * \param user object utilisateur qui crée + * \param no_commit le begin et le commit sont fait par l'appelant * */ - function create($user) + function create($user, $no_commit = 0) { $sql_err = 0; /* * Insertion dans la base */ - if ($this->db->begin()) + if ($no_commit == 0) + { + $result = $this->db->begin(); + } + else + { + $result = 1; + } + + if ($result) { $total = 0; @@ -174,12 +184,18 @@ class Paiement if ( $total > 0 && $sql_err == 0 ) { - $this->db->commit(); + if ($no_commit == 0) + { + $this->db->commit(); + } return $this->id; } else { - $this->db->rollback(); + if ($no_commit == 0) + { + $this->db->rollback(); + } return -1; }