diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 6fefd35ef98..9443b52ff54 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -100,7 +100,7 @@ class Skeleton_class // extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return $this->id; @@ -153,7 +153,7 @@ class Skeleton_class // extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -229,7 +229,7 @@ class Skeleton_class // extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index f0741ec4faa..a7a07d00f6c 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -140,6 +140,7 @@ class ActionComm include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ACTION_CREATE',$this,$author,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 0dfe17ea986..bb0314aa5a2 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -402,7 +402,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -734,7 +734,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1228,7 +1228,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1274,7 +1274,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1316,7 +1316,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 1b74e62f659..bdfdff374eb 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -295,6 +295,7 @@ class Commande extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -582,6 +583,7 @@ class Commande extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1984,6 +1986,7 @@ class Commande extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -2450,6 +2453,7 @@ class CommandeLigne include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINEORDER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -2542,6 +2546,7 @@ class CommandeLigne include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINEORDER_INSERT',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 8b545affe63..989584b27ad 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -119,7 +119,7 @@ class Contact extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return $this->id; @@ -194,7 +194,7 @@ class Contact extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTACT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -605,7 +605,7 @@ class Contact extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 47a4aefcadf..0ddbe2207da 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -115,6 +115,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_SERVICE_ACTIVATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -155,6 +156,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_SERVICE_CLOSE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -189,6 +191,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_CLOSE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -220,6 +223,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -252,6 +256,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_CANCEL',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -504,7 +509,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers if (! $error) @@ -624,6 +629,7 @@ class Contrat extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 1d101e6ddc7..c8885867f1a 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -304,6 +304,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -780,6 +781,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -916,6 +918,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -947,6 +950,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -991,6 +995,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1202,6 +1207,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1573,6 +1579,7 @@ class Facture extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result = $interface->run_triggers('LINEBILL_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -3040,6 +3047,7 @@ class FactureLigne include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php index b500a6af36b..784fc2a788b 100644 --- a/htdocs/fichinter/fichinter.class.php +++ b/htdocs/fichinter/fichinter.class.php @@ -227,6 +227,7 @@ class Fichinter extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php index 289c4da6fbc..c05ba69f444 100644 --- a/htdocs/fourn/facture/paiementfourn.class.php +++ b/htdocs/fourn/facture/paiementfourn.class.php @@ -173,7 +173,7 @@ class PaiementFourn include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } } diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 75f15b59d05..8a8f61a4e67 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -235,6 +235,7 @@ class CommandeFournisseur extends Commande include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers dolibarr_syslog("CommandeFournisseur::valid Success"); @@ -282,6 +283,7 @@ class CommandeFournisseur extends Commande include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; @@ -470,6 +472,7 @@ class CommandeFournisseur extends Commande include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $subject = "Votre commande ".$this->ref." a été approuvée"; @@ -620,6 +623,7 @@ class CommandeFournisseur extends Commande include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers dolibarr_syslog("CommandeFournisseur::Create : Success"); @@ -956,6 +960,7 @@ class CommandeFournisseur extends Commande include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers dolibarr_syslog("CommandeFournisseur::delete : Success"); diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php b/htdocs/includes/triggers/interface_all_Demo.class.php index c47cf3d4fcb..321a317ca7d 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php +++ b/htdocs/includes/triggers/interface_all_Demo.class.php @@ -96,7 +96,7 @@ class InterfaceDemo * \param user Objet user * \param lang Objet lang * \param conf Objet conf - * \return int <0 si ko, 0 si aucune action faite, >0 si ok + * \return int <0 if fatal error, 0 si nothing done, >0 if ok */ function run_trigger($action,$object,$user,$langs,$conf) { diff --git a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php index 89c8a820738..218b4e61fc4 100644 --- a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php +++ b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php @@ -14,14 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php \ingroup core \brief Fichier de gestion des triggers LDAP + \version $Id$ */ require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); diff --git a/htdocs/interfaces.class.php b/htdocs/interfaces.class.php index 2e507d7c914..d72999d1f87 100644 --- a/htdocs/interfaces.class.php +++ b/htdocs/interfaces.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify @@ -15,14 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** - \file htdocs/interfaces.class.php - \ingroup core - \brief Fichier de la classe de gestion des triggers + \file htdocs/interfaces.class.php + \ingroup core + \brief Fichier de la classe de gestion des triggers + \version $Id$ */ diff --git a/htdocs/lib/menubase.class.php b/htdocs/lib/menubase.class.php index 4a583243765..f93ae5e9585 100644 --- a/htdocs/lib/menubase.class.php +++ b/htdocs/lib/menubase.class.php @@ -14,13 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/lib/menubase.class.php \ingroup core + \version $Id$ \brief File of class to manage menu entries \remarks Initialy built by build_class_from_table on 2008-01-12 14:19 */ @@ -135,13 +134,6 @@ class Menubase { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu"); - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; - // Fin appel triggers - return $this->id; } else @@ -209,16 +201,6 @@ class Menubase return -1; } - if (! $notrigger) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; - // Fin appel triggers - } - return 1; } @@ -313,13 +295,6 @@ class Menubase return -1; } - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; - // Fin appel triggers - return 1; } diff --git a/htdocs/oscommerce_ws/produits/osc_categories.class.php b/htdocs/oscommerce_ws/produits/osc_categories.class.php index bc8689c7087..626e2956d07 100644 --- a/htdocs/oscommerce_ws/produits/osc_categories.class.php +++ b/htdocs/oscommerce_ws/produits/osc_categories.class.php @@ -98,7 +98,7 @@ class Osc_Categorie include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->id = $newid; @@ -148,7 +148,7 @@ class Osc_Categorie include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -293,7 +293,7 @@ class Osc_Categorie include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return 1; diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index 27662e1b9c5..b9be8720e96 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -178,7 +178,7 @@ class Paiement include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } } diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 81060ebfc07..46e5ce4395c 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -585,6 +585,7 @@ class Propal extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PROPAL_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -999,6 +1000,7 @@ class Propal extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PROPAL_VALIDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -1298,6 +1300,7 @@ class Propal extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PROPAL_CLOSE_SIGNED',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } else @@ -1308,6 +1311,7 @@ class Propal extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PROPAL_CLOSE_REFUSED',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -2001,6 +2005,7 @@ class Propal extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('PROPAL_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index adb00a94f44..6d679dad3f2 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -180,6 +180,7 @@ class Societe include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('COMPANY_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers dolibarr_syslog("Societe::Create success id=".$this->id); @@ -453,6 +454,7 @@ class Societe include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('COMPANY_MODIFY',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -743,6 +745,7 @@ class Societe include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('COMPANY_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); diff --git a/htdocs/user.class.php b/htdocs/user.class.php index de0bb6e36d5..4dbbafec074 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -587,39 +587,39 @@ class User extends CommonObject * \brief Change statut d'un utilisateur * \return int <0 si ko, >0 si ok */ - function setstatus($statut) - { - $error=0; - - $this->db->begin(); - - // Desactive utilisateur - $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql.= " SET statut = ".$statut; - $sql.= " WHERE rowid = ".$this->id; - $result = $this->db->query($sql); - - if ($result) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_DISABLE',$this,$user,$lang,$conf); - if ($result < 0) $error++; - // Fin appel triggers - } - - if ($error) - { - $this->db->rollback(); - return -$error; - } - else - { - $this->db->commit(); - return 1; - } - } + function setstatus($statut) + { + $error=0; + + $this->db->begin(); + + // Desactive utilisateur + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; + $sql.= " SET statut = ".$statut; + $sql.= " WHERE rowid = ".$this->id; + $result = $this->db->query($sql); + + if ($result) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('USER_DISABLE',$this,$user,$lang,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + if ($error) + { + $this->db->rollback(); + return -$error; + } + else + { + $this->db->commit(); + return 1; + } + } /** @@ -660,7 +660,7 @@ class User extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('USER_DELETE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -748,7 +748,7 @@ class User extends CommonObject include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface = new Interfaces($this->db); $result = $interface->run_triggers('USER_CREATE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/usergroup.class.php b/htdocs/usergroup.class.php index 2c5f2645366..9f04bf135d2 100644 --- a/htdocs/usergroup.class.php +++ b/htdocs/usergroup.class.php @@ -367,7 +367,7 @@ class UserGroup include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('USER_DELETE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers $this->db->commit(); @@ -404,7 +404,7 @@ class UserGroup include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('GROUP_CREATE',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers return $this->id; @@ -444,7 +444,7 @@ class UserGroup include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); $result=$interface->run_triggers('GROUP_MODIFY',$this,$user,$lang,$conf); - if ($result < 0) $error++; + if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers }