Le code de synchro LDAP sur les users mis en triggers
This commit is contained in:
parent
7dd3725e50
commit
1e5d35fb88
@ -104,33 +104,51 @@ class InterfaceDemo
|
|||||||
// Users
|
// Users
|
||||||
if ($action == 'USER_CREATE')
|
if ($action == 'USER_CREATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'USER_MODIFY')
|
elseif ($action == 'USER_MODIFY')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'USER_NEW_PASSWORD')
|
elseif ($action == 'USER_NEW_PASSWORD')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'USER_DISABLE')
|
elseif ($action == 'USER_DISABLE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'USER_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Companies
|
// Companies
|
||||||
elseif ($action == 'COMPANY_CREATE')
|
elseif ($action == 'COMPANY_CREATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'COMPANY_MODIFY')
|
elseif ($action == 'COMPANY_MODIFY')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'COMPANY_DELETE')
|
elseif ($action == 'COMPANY_DELETE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contacts
|
||||||
|
elseif ($action == 'CONTACT_CREATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'CONTACT_MODIFY')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'CONTACT_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Products
|
// Products
|
||||||
@ -283,12 +301,6 @@ class InterfaceDemo
|
|||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not found
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
208
htdocs/includes/triggers/interface_ldap.class.php
Normal file
208
htdocs/includes/triggers/interface_ldap.class.php
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* 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$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/includes/triggers/interface_ldap.class.php
|
||||||
|
\ingroup core
|
||||||
|
\brief Fichier de gestion des triggers LDAP
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\class InterfaceLdap
|
||||||
|
\brief Classe des fonctions triggers des actions de synchro LDAP
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InterfaceLdap
|
||||||
|
{
|
||||||
|
var $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Constructeur.
|
||||||
|
* \param DB Handler d'accès base
|
||||||
|
*/
|
||||||
|
function InterfaceLdap($DB)
|
||||||
|
{
|
||||||
|
$this->db = $DB ;
|
||||||
|
|
||||||
|
$this->name = "Ldap";
|
||||||
|
$this->family = "ldap";
|
||||||
|
$this->description = "Les triggers de ce composant permettent d'effectuer les synchro de Dolibarr vers un annuaire LDAP";
|
||||||
|
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi nom du lot de triggers
|
||||||
|
* \return string Nom du lot de triggers
|
||||||
|
*/
|
||||||
|
function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi descriptif du lot de triggers
|
||||||
|
* \return string Descriptif du lot de triggers
|
||||||
|
*/
|
||||||
|
function getDesc()
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi version du lot de triggers
|
||||||
|
* \return string Version du lot de triggers
|
||||||
|
*/
|
||||||
|
function getVersion()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
|
if ($this->version == 'experimental') return $langs->trans("Experimental");
|
||||||
|
elseif ($this->version == 'dolibarr') return DOL_VERSION;
|
||||||
|
elseif ($this->version) return $this->version;
|
||||||
|
else return $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
|
||||||
|
* D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers
|
||||||
|
* \param action Code de l'evenement
|
||||||
|
* \param object Objet concerné
|
||||||
|
* \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
|
||||||
|
*/
|
||||||
|
function run_trigger($action,$object,$user,$langs,$conf)
|
||||||
|
{
|
||||||
|
// Mettre ici le code à exécuter en réaction de l'action
|
||||||
|
// Les données de l'action sont stockées dans $object
|
||||||
|
|
||||||
|
if (! $conf->ldap->enabled) return 0; // Module non actif
|
||||||
|
|
||||||
|
// Users
|
||||||
|
if ($action == 'USER_CREATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
||||||
|
{
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$info=$object->_load_ldap_info();
|
||||||
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
|
$ldap->add($dn,$info,$user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'USER_MODIFY')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
||||||
|
{
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$info=$object->_load_ldap_info();
|
||||||
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
|
$ldap->update($dn,$info,$user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($action == 'USER_NEW_PASSWORD')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'USER_DISABLE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'USER_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
||||||
|
{
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$info=$object->_load_ldap_info();
|
||||||
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
|
$ldap->delete($dn,$info,$user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contacts
|
||||||
|
elseif ($action == 'CONTACT_CREATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'CONTACT_MODIFY')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'CONTACT_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Members
|
||||||
|
elseif ($action == 'MEMBER_CREATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_VALIDATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_SUBSCRIPTION')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_MODIFY')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_RESILIATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not found
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -94,6 +94,9 @@ class InterfaceNotification
|
|||||||
*/
|
*/
|
||||||
function run_trigger($action,$object,$user,$langs,$conf)
|
function run_trigger($action,$object,$user,$langs,$conf)
|
||||||
{
|
{
|
||||||
|
// Mettre ici le code à exécuter en réaction de l'action
|
||||||
|
// Les données de l'action sont stockées dans $object
|
||||||
|
|
||||||
// Si module notification non actif, on ne fait rien
|
// Si module notification non actif, on ne fait rien
|
||||||
if (! $conf->notification->enabled) return 0;
|
if (! $conf->notification->enabled) return 0;
|
||||||
|
|
||||||
@ -101,7 +104,7 @@ class InterfaceNotification
|
|||||||
|
|
||||||
if ($action == 'BILL_VALIDATE')
|
if ($action == 'BILL_VALIDATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
$action_notify = 2;
|
$action_notify = 2;
|
||||||
$ref = sanitize_string($object->ref);
|
$ref = sanitize_string($object->ref);
|
||||||
@ -112,9 +115,9 @@ class InterfaceNotification
|
|||||||
$notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf);
|
$notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'FICHEINTER_VALIDATE')
|
elseif ($action == 'FICHEINTER_VALIDATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
$action_notify = 1;
|
$action_notify = 1;
|
||||||
$ref = sanitize_string($object->ref);
|
$ref = sanitize_string($object->ref);
|
||||||
@ -125,9 +128,9 @@ class InterfaceNotification
|
|||||||
$notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
|
$notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'ORDER_SUPPLIER_VALIDATE')
|
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
$action_notify = 3;
|
$action_notify = 3;
|
||||||
$ref = sanitize_string($object->ref);
|
$ref = sanitize_string($object->ref);
|
||||||
@ -138,6 +141,14 @@ class InterfaceNotification
|
|||||||
$notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
|
$notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If not found
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ class InterfaceWebCal
|
|||||||
// Actions
|
// Actions
|
||||||
if ($action == 'ACTION_CREATE')
|
if ($action == 'ACTION_CREATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
// Initialisation donnees (date,duree,texte,desc)
|
// Initialisation donnees (date,duree,texte,desc)
|
||||||
@ -141,9 +141,9 @@ class InterfaceWebCal
|
|||||||
$this->desc=$libellecal;
|
$this->desc=$libellecal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'COMPANY_CREATE')
|
elseif ($action == 'COMPANY_CREATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
// Initialisation donnees (date,duree,texte,desc)
|
// Initialisation donnees (date,duree,texte,desc)
|
||||||
@ -157,9 +157,9 @@ class InterfaceWebCal
|
|||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'CONTRACT_VALIDATE')
|
elseif ($action == 'CONTRACT_VALIDATE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
// Initialisation donnees (date,duree,texte,desc)
|
// Initialisation donnees (date,duree,texte,desc)
|
||||||
@ -169,9 +169,9 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("ContractValidatedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("ContractValidatedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'CONTRACT_CANCEL')
|
elseif ($action == 'CONTRACT_CANCEL')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$this->date=time();
|
$this->date=time();
|
||||||
@ -180,9 +180,9 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("ContractCanceledInDolibarr",$object->ref);
|
$this->desc=$langs->trans("ContractCanceledInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'CONTRACT_CLOSE')
|
elseif ($action == 'CONTRACT_CLOSE')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$this->date=time();
|
$this->date=time();
|
||||||
@ -191,18 +191,9 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("ContractClosedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("ContractClosedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
|
elseif ($action == 'PROPAL_VALIDATE')
|
||||||
if ($action == 'PROPAL_CREATE')
|
|
||||||
{
|
{
|
||||||
// Pas interessant
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
|
||||||
if ($action == 'PROPAL_MODIFY')
|
|
||||||
{
|
|
||||||
// Etat brouillon pas interessant
|
|
||||||
}
|
|
||||||
if ($action == 'PROPAL_VALIDATE')
|
|
||||||
{
|
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$this->date=time();
|
$this->date=time();
|
||||||
@ -211,7 +202,7 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("PropalValidatedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("PropalValidatedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'PROPAL_CLOSE_SIGNED')
|
elseif ($action == 'PROPAL_CLOSE_SIGNED')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -222,7 +213,7 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("PropalClosedSignedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("PropalClosedSignedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'PROPAL_CLOSE_REFUSED')
|
elseif ($action == 'PROPAL_CLOSE_REFUSED')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -234,15 +225,7 @@ class InterfaceWebCal
|
|||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'BILL_CREATE')
|
elseif ($action == 'BILL_VALIDATE')
|
||||||
{
|
|
||||||
// Etat brouillon pas interessant
|
|
||||||
}
|
|
||||||
if ($action == 'BILL_MODIFY')
|
|
||||||
{
|
|
||||||
// Pas interessant
|
|
||||||
}
|
|
||||||
if ($action == 'BILL_VALIDATE')
|
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -253,7 +236,7 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("InvoiceValidatedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("InvoiceValidatedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'BILL_PAYED')
|
elseif ($action == 'BILL_PAYED')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -264,7 +247,7 @@ class InterfaceWebCal
|
|||||||
$this->desc=$langs->trans("InvoicePayedInDolibarr",$object->ref);
|
$this->desc=$langs->trans("InvoicePayedInDolibarr",$object->ref);
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
if ($action == 'BILL_CANCELED')
|
elseif ($action == 'BILL_CANCELED')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -300,6 +283,14 @@ class InterfaceWebCal
|
|||||||
$this->desc.="\n".$langs->trans("AmountTTC").': '.$object->total;
|
$this->desc.="\n".$langs->trans("AmountTTC").': '.$object->total;
|
||||||
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
|
||||||
}
|
}
|
||||||
|
// If not found
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Ajoute entrée dans webcal
|
// Ajoute entrée dans webcal
|
||||||
if ($this->date)
|
if ($this->date)
|
||||||
|
|||||||
@ -603,7 +603,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_syslog("ldap.class::add dn=".$dn." info=".join(',',$info));
|
dolibarr_syslog("Ldap.class::add dn=".$dn." info=".join(',',$info));
|
||||||
|
|
||||||
//print_r($info);
|
//print_r($info);
|
||||||
$result=@ldap_add($this->connection, $dn, $info);
|
$result=@ldap_add($this->connection, $dn, $info);
|
||||||
@ -627,7 +627,7 @@ class Ldap
|
|||||||
$dn=utf8_encode($dn);
|
$dn=utf8_encode($dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_syslog("ldap.class::delete Delete LDAP entry dn=".$dn);
|
dolibarr_syslog("Ldap.class::delete Delete LDAP entry dn=".$dn);
|
||||||
|
|
||||||
$result=@ldap_delete($this->connection, $dn);
|
$result=@ldap_delete($this->connection, $dn);
|
||||||
|
|
||||||
@ -791,7 +791,7 @@ class Ldap
|
|||||||
$checkDn=utf8_decode($checkDn);
|
$checkDn=utf8_decode($checkDn);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_syslog("ldap.class::search checkDn=".$checkDn." filter=".$filter);
|
dolibarr_syslog("Ldap.class::search checkDn=".$checkDn." filter=".$filter);
|
||||||
|
|
||||||
// if the directory is AD, then bind first with the search user first
|
// if the directory is AD, then bind first with the search user first
|
||||||
if ($this->serverType == "activedirectory") {
|
if ($this->serverType == "activedirectory") {
|
||||||
|
|||||||
@ -37,8 +37,6 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class User
|
\class User
|
||||||
@ -587,18 +585,6 @@ class User
|
|||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
// \todo Mettre en trigger
|
|
||||||
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
|
||||||
{
|
|
||||||
$ldap=new Ldap();
|
|
||||||
$ldap->connect_bind();
|
|
||||||
|
|
||||||
$info=$this->_load_ldap_info();
|
|
||||||
$dn=$this->_load_ldap_dn($info);
|
|
||||||
|
|
||||||
$ldap->delete($dn,$info,$user);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -670,18 +656,6 @@ class User
|
|||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
// \todo Mettre en trigger
|
|
||||||
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
|
||||||
{
|
|
||||||
$ldap=new Ldap();
|
|
||||||
$ldap->connect_bind();
|
|
||||||
|
|
||||||
$info=$this->_load_ldap_info();
|
|
||||||
$dn=$this->_load_ldap_dn($info);
|
|
||||||
|
|
||||||
$ldap->add($dn,$info,$user);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -878,18 +852,6 @@ class User
|
|||||||
$result=$interface->run_triggers('USER_MODIFY',$this,$user,$lang,$conf);
|
$result=$interface->run_triggers('USER_MODIFY',$this,$user,$lang,$conf);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
// \todo Mettre en trigger
|
|
||||||
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
|
|
||||||
{
|
|
||||||
$ldap=new Ldap();
|
|
||||||
$ldap->connect_bind();
|
|
||||||
|
|
||||||
$info=$this->_load_ldap_info();
|
|
||||||
$dn=$this->_load_ldap_dn($info);
|
|
||||||
|
|
||||||
$ldap->update($dn,$info,$user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user