Merge pull request #8738 from atm-quentin/NEW_triggers_commercial_add
NEW triggers add commercial and del commercial
This commit is contained in:
commit
8d3fff5568
@ -1911,6 +1911,11 @@ class Societe extends CommonObject
|
||||
*/
|
||||
function add_commercial(User $user, $commid)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->id > 0 && $commid > 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux";
|
||||
@ -1926,6 +1931,12 @@ class Societe extends CommonObject
|
||||
{
|
||||
dol_syslog(get_class($this)."::add_commercial Erreur");
|
||||
}
|
||||
else {
|
||||
$this->context=array('commercial_modified'=>$commid);
|
||||
|
||||
$result=$this->call_trigger('COMPANY_LINK_SALE_REPRESENTATIVE',$user);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1938,6 +1949,12 @@ class Societe extends CommonObject
|
||||
*/
|
||||
function del_commercial(User $user, $commid)
|
||||
{
|
||||
$error=0;
|
||||
$this->context=array('commercial_modified'=>$commid);
|
||||
|
||||
$result=$this->call_trigger('COMPANY_UNLINK_SALE_REPRESENTATIVE',$user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if ($this->id > 0 && $commid > 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux ";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user