Fix: Better error management

This commit is contained in:
Laurent Destailleur 2011-10-25 02:08:42 +02:00
parent 7f5aeea9b8
commit 8418a5e7f5

View File

@ -126,10 +126,15 @@ class ActionComm extends CommonObject
// Get id from code // Get id from code
$cactioncomm=new CActionComm($this->db); $cactioncomm=new CActionComm($this->db);
$result=$cactioncomm->fetch($this->type_code); $result=$cactioncomm->fetch($this->type_code);
if ($result) if ($result > 0)
{ {
$this->type_id=$cactioncomm->id; $this->type_id=$cactioncomm->id;
} }
else if ($result == 0)
{
$this->error='Failed to get record with code AC_OTH from dictionnary "type of events"';
return -1;
}
else else
{ {
$this->error=$cactioncomm->error; $this->error=$cactioncomm->error;