New: Tous les appels triggers recuperent la liste des erreurs.

This commit is contained in:
Laurent Destailleur 2008-01-29 20:34:58 +00:00
parent e169c1fc81
commit bb767ee54c
20 changed files with 97 additions and 90 deletions

View File

@ -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;

View File

@ -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
}

View File

@ -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();

View File

@ -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
}

View File

@ -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
}

View File

@ -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();

View File

@ -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
}

View File

@ -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;

View File

@ -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
}
}

View File

@ -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");

View File

@ -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)
{

View File

@ -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");

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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$
*/

View File

@ -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;
}

View File

@ -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;

View File

@ -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
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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
}

View File

@ -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
}