From 0e0582c16f536045062cb866e8145da29e49670f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 9 Nov 2012 19:23:46 +0100 Subject: [PATCH] Fix: avoid conflicts with external module if triggers used --- htdocs/adherents/class/adherent.class.php | 13 ++++++++----- htdocs/contact/class/contact.class.php | 9 ++++++--- htdocs/product/class/product.class.php | 13 ++++++++----- htdocs/societe/class/societe.class.php | 13 ++++++++----- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 5709fcb7647..86eb5af261e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -470,11 +470,14 @@ class Adherent extends CommonObject $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } } else if ($reshook < 0) $error++; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bf0f5057179..6be129c8b06 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -271,10 +271,13 @@ class Contact extends CommonObject $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result=$this->insertExtraFields(); - if ($result < 0) + if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $error++; + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } } } else if ($reshook < 0) $error++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d6290ce6345..209d5bbe39c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -497,11 +497,14 @@ class Product extends CommonObject $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } } else if ($reshook < 0) $error++; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d978b2cc59d..4e608f817ff 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -580,11 +580,14 @@ class Societe extends CommonObject $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } } else if ($reshook < 0) $error++;