Fix: Error management

This commit is contained in:
Laurent Destailleur 2012-01-11 01:52:00 +01:00
parent a93a9f75f2
commit 5ff8c2b8fa
4 changed files with 18 additions and 11 deletions

View File

@ -273,6 +273,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{ {
$error++; $error++;
$errmsg=$adh->error; $errmsg=$adh->error;
$errmsgs=$adh->errors;
} }
if (! $error) 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 ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid;
$sql.=" WHERE rowid=".$crowid; $sql.=" WHERE rowid=".$crowid;
dol_syslog("Adherent::cotisation sql=".$sql); dol_syslog("card_subscriptions::cotisation sql=".$sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) if (! $resql)
{ {
$error=$db->lasterror(); $error++;
$errmsg=$db->lasterror();
} }
} }
else else
{ {
$error=$acct->error; $error++;
$errmsg=$acct->error;
} }
} }
else else
{ {
$error=$acct->error; $error++;
$errmsg=$acct->error;
} }
} }

View File

@ -1202,7 +1202,10 @@ class Adherent extends CommonObject
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf); $result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
}
if (! $error)
{
$this->db->commit(); $this->db->commit();
return $rowid; return $rowid;
} }

View File

@ -73,12 +73,12 @@ class Cotisation extends CommonObject
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)";
$sql.= " VALUES (".$this->fk_adherent.", ".$this->db->idate(mktime()).","; $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate(mktime())."',";
$sql.= " ".$this->db->idate($this->dateh).","; $sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " ".$this->db->idate($this->datef).","; $sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')"; $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); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -37,11 +37,11 @@ class Interfaces
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function Interfaces($DB) function Interfaces($db)
{ {
$this->db = $DB ; $this->db = $db;
} }
/** /**