Merge pull request #6529 from dolibarr95/patch-4
NEW : Create a trigger for company create RIB
This commit is contained in:
commit
7662ddc2fc
@ -70,7 +70,7 @@ class CompanyBankAccount extends Account
|
|||||||
function create(User $user = null, $notrigger=0)
|
function create(User $user = null, $notrigger=0)
|
||||||
{
|
{
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
$error = 0;
|
||||||
// Correct default_rib to be sure to have always one default
|
// Correct default_rib to be sure to have always one default
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".$this->socid." AND default_rib = 1";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".$this->socid." AND default_rib = 1";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -89,8 +89,30 @@ class CompanyBankAccount extends Account
|
|||||||
if ($this->db->affected_rows($resql))
|
if ($this->db->affected_rows($resql))
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('COMPANY_RIB_CREATE',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
if(! $error )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user