2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2015-09-16 22:04:03 +02:00
parent 7d8013b371
commit 313d9ddacd
5 changed files with 30 additions and 14 deletions

View File

@@ -452,13 +452,15 @@ abstract class CommonObject
// Check parameters
if ($fk_socpeople <= 0)
{
$this->error=$langs->trans("ErrorWrongValueForParameter","1");
$langs->load("errors");
$this->error=$langs->trans("ErrorWrongValueForParameterX","1");
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
return -1;
}
if (! $type_contact)
{
$this->error=$langs->trans("ErrorWrongValueForParameter","2");
$langs->load("errors");
$this->error=$langs->trans("ErrorWrongValueForParameterX","2");
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
return -2;
}
@@ -486,7 +488,7 @@ abstract class CommonObject
}
$datecreate = dol_now();
$this->db->begin();
// Insertion dans la base
@@ -504,7 +506,11 @@ abstract class CommonObject
if (! $notrigger)
{
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
if ($result < 0) { $this->db->rollback(); return -1; }
if ($result < 0)
{
$this->db->rollback();
return -1;
}
}
$this->db->commit();