|
@@ -81,7 +81,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
// Users
|
|
|
if ($action == 'USER_CREATE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -98,7 +98,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'USER_MODIFY') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -177,7 +177,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'USER_NEW_PASSWORD') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -212,7 +212,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
} elseif ($action == 'USER_DELETE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -229,7 +229,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
/*} elseif ($action == 'USER_SETINGROUP') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -263,7 +263,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'USER_REMOVEFROMGROUP') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -298,7 +298,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
} elseif ($action == 'USERGROUP_CREATE') {
|
|
|
// Groupes
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -320,7 +320,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'USERGROUP_MODIFY') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -353,7 +353,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'USERGROUP_DELETE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
|
|
+ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -439,7 +439,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
} elseif ($action == 'MEMBER_CREATE') {
|
|
|
// Members
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -450,7 +450,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
$result = $ldap->add($dn, $info, $user);
|
|
|
|
|
|
// For member type
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
if ($object->typeid > 0) {
|
|
|
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
|
|
$membertype = new AdherentType($this->db);
|
|
@@ -482,7 +482,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_VALIDATE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
// If status field is setup to be synchronized
|
|
|
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) {
|
|
|
$ldap = new Ldap();
|
|
@@ -503,7 +503,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_SUBSCRIPTION') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
// If subscriptions fields are setup to be synchronized
|
|
|
if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE
|
|
|
|| $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT
|
|
@@ -528,7 +528,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_MODIFY') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -557,7 +557,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
|
|
|
|
|
|
// For member type
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
|
|
|
|
|
/*
|
|
@@ -616,7 +616,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_NEW_PASSWORD') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
// If password field is setup to be synchronized
|
|
|
if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) {
|
|
|
$ldap = new Ldap();
|
|
@@ -637,7 +637,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_RESILIATE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
// If status field is setup to be synchronized
|
|
|
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) {
|
|
|
$ldap = new Ldap();
|
|
@@ -658,7 +658,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_DELETE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -669,7 +669,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
$result = $ldap->delete($dn);
|
|
|
|
|
|
// For member type
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
if ($object->typeid > 0) {
|
|
|
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
|
|
|
|
@@ -706,7 +706,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
} elseif ($action == 'MEMBER_TYPE_CREATE') {
|
|
|
// Members types
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -728,7 +728,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_TYPE_MODIFY') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|
|
@@ -765,7 +765,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
|
|
}
|
|
|
} elseif ($action == 'MEMBER_TYPE_DELETE') {
|
|
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
|
|
- if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
|
|
+ if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
|
|
$ldap = new Ldap();
|
|
|
$result = $ldap->connect_bind();
|
|
|
|