diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index d5c3fe12fec..7354912147e 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -273,6 +273,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { $error++; $errmsg=$adh->error; + $errmsgs=$adh->errors; } if (! $error) @@ -297,21 +298,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid; $sql.=" WHERE rowid=".$crowid; - dol_syslog("Adherent::cotisation sql=".$sql); + dol_syslog("card_subscriptions::cotisation sql=".$sql); $resql = $db->query($sql); if (! $resql) { - $error=$db->lasterror(); + $error++; + $errmsg=$db->lasterror(); } } else { - $error=$acct->error; + $error++; + $errmsg=$acct->error; } } else { - $error=$acct->error; + $error++; + $errmsg=$acct->error; } } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a26a7dfba67..98f5a0072ae 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1202,7 +1202,10 @@ class Adherent extends CommonObject $result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers + } + if (! $error) + { $this->db->commit(); return $rowid; } diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 6ed82912ca8..f53eb509657 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -73,12 +73,12 @@ class Cotisation extends CommonObject } $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)"; - $sql.= " VALUES (".$this->fk_adherent.", ".$this->db->idate(mktime()).","; - $sql.= " ".$this->db->idate($this->dateh).","; - $sql.= " ".$this->db->idate($this->datef).","; + $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate(mktime())."',"; + $sql.= " '".$this->db->idate($this->dateh)."',"; + $sql.= " '".$this->db->idate($this->datef)."',"; $sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')"; - dol_syslog("Cotisation::create sql=".$sql); + dol_syslog(get_class($this)."::create sql=".$sql); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index f99e7cd698f..1b4c124f019 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -37,11 +37,11 @@ class Interfaces /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function Interfaces($DB) + function Interfaces($db) { - $this->db = $DB ; + $this->db = $db; } /**