Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into mko559

This commit is contained in:
Maxime Kohlhaas 2012-10-25 07:56:30 +02:00
commit 6ffa8532c5
53 changed files with 594 additions and 204 deletions

View File

@ -245,6 +245,7 @@ print '</form>';
print '</div>';
print '<br>';
/*

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
*
* 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
@ -49,7 +49,7 @@ if ($action == 'setvalue' && $user->admin)
{
$error=0;
$db->begin();
if (! dolibarr_set_const($db, 'LDAP_USER_DN',GETPOST("user"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FILTER_CONNECTION',GETPOST("filterconnection"),'chaine',0,'',$conf->entity)) $error++;
@ -66,6 +66,7 @@ if ($action == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
// This one must be after the others
$valkey='';
@ -247,9 +248,17 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked="checked"':'')."></td>";
print '</tr>';
// Description
// Title
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_TITLE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked="checked"':'')."></td>";
print '</tr>';
// Note
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Note").'</td><td>';
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked="checked"':'')."></td>";
@ -287,10 +296,19 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass);
}
elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
{
$butlabel=$langs->trans("LDAPTestSearch");
$testlabel='testsearchuser';
$key=$conf->global->LDAP_KEY_USERS;
$dn=$conf->global->LDAP_USER_DN;
$objectclass=$conf->global->LDAP_USER_OBJECT_CLASS;
show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass);
}
if (function_exists("ldap_connect"))
{
if ($_GET["action"] == 'testuser')
if ($action == 'testuser')
{
// Creation objet
$object=new User($db);
@ -339,6 +357,87 @@ if (function_exists("ldap_connect"))
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
}
}
if ($action == 'testsearchuser')
{
// Creation objet
$object=new User($db);
$object->initAsSpecimen();
// TODO Mutualize code following with other ldap_xxxx.php pages
// Test synchro
$ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
$required_fields = array(
$conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
$conf->global->LDAP_FIELD_PASSWORD,
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_SID
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
if (is_array($ldapusers))
{
$liste=array();
foreach ($ldapusers as $key => $ldapuser)
{
// Define the label string for this user
$label='';
foreach ($required_fields as $value)
{
if ($value)
{
$label.=$value."=".$ldapuser[$value]." ";
}
}
$liste[$key] = $label;
}
}
else
{
$mesg='<div class="error">'.$ldap->error.'</div>';
}
print "<br>\n";
print "LDAP search for user:<br>\n";
print "search: *<br>\n";
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<br>\n";
print "required_fields: ".join(',',$required_fields)."<br>\n";
print "=> ".count($liste)." records<br>\n";
print "\n<br>";
}
else
{
print img_picto('','error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'<br>';
}
}
}
dol_htmloutput_mesg($mesg);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -268,6 +268,7 @@ $h++;
dol_fiche_head($head, $mode, $langs->trans("Modules"));
$var=true;
if ($mode != 'marketplace')
{
@ -286,7 +287,6 @@ if ($mode != 'marketplace')
// Show list of modules
$var=true;
$oldfamily='';
$familylib=array(

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -73,7 +73,7 @@ class box_members extends ModeleBoxes
if ($user->rights->societe->lire)
{
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -109,7 +109,8 @@ class ExtraFields
}
/**
* Add a new optionnal attribute
* Add a new optionnal attribute.
* This is a private method. For public method, use addExtraField.
*
* @param string $attrname code of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')

View File

@ -169,7 +169,7 @@ class Ldap
if ($this->serverType == "activedirectory")
{
$result=$this->setReferrals();
dol_syslog("Ldap::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser,LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser,LOG_DEBUG);
$this->result=$this->bindauth($this->searchUser,$this->searchPassword);
if ($this->result)
{
@ -187,7 +187,7 @@ class Ldap
// Try in auth mode
if ($this->searchUser && $this->searchPassword)
{
dol_syslog("Ldap::connect_bind try bindauth on ".$host." user=".$this->searchUser,LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser,LOG_DEBUG);
$this->result=$this->bindauth($this->searchUser,$this->searchPassword);
if ($this->result)
{
@ -203,7 +203,7 @@ class Ldap
// Try in anonymous
if (! $this->bind)
{
dol_syslog("Ldap::connect_bind try bind on ".$host,LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG);
$result=$this->bind();
if ($result)
{
@ -225,13 +225,13 @@ class Ldap
if ($connected)
{
$return=$connected;
dol_syslog("Ldap::connect_bind return=".$return, LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind return=".$return, LOG_DEBUG);
}
else
{
$this->error='Failed to connect to LDAP'.($this->error?': '.$this->error:'');
$return=-1;
dol_syslog("Ldap::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
}
return $return;
}
@ -419,7 +419,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::modify dn=".$dn." info=".join(',',$info));
dol_syslog(get_class($this)."::modify dn=".$dn." info=".join(',',$info));
// Check parameters
if (! $this->connection)
@ -447,13 +447,13 @@ class Ldap
if ($result)
{
dol_syslog("Ldap::modify successfull", LOG_DEBUG);
dol_syslog(get_class($this)."::modify successfull", LOG_DEBUG);
return 1;
}
else
{
$this->error=@ldap_error($this->connection);
dol_syslog("Ldap::modify failed: ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::modify failed: ".$this->error, LOG_ERR);
return -1;
}
}
@ -472,7 +472,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::update dn=".$dn." olddn=".$olddn);
dol_syslog(get_class($this)."::update dn=".$dn." olddn=".$olddn);
// Check parameters
if (! $this->connection)
@ -501,13 +501,13 @@ class Ldap
if ($result <= 0)
{
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error;
dol_syslog("Ldap::update ".$this->error,LOG_ERR);
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
//print_r($info);
return -1;
}
else
{
dol_syslog("Ldap::update done successfully");
dol_syslog(get_class($this)."::update done successfully");
return 1;
}
}
@ -524,7 +524,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::delete Delete LDAP entry dn=".$dn);
dol_syslog(get_class($this)."::delete Delete LDAP entry dn=".$dn);
// Check parameters
if (! $this->connection)
@ -638,7 +638,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::addAttribute dn=".$dn." info=".join(',',$info));
dol_syslog(get_class($this)."::addAttribute dn=".$dn." info=".join(',',$info));
// Check parameters
if (! $this->connection)
@ -666,13 +666,13 @@ class Ldap
if ($result)
{
dol_syslog("Ldap::add_attribute successfull", LOG_DEBUG);
dol_syslog(get_class($this)."::add_attribute successfull", LOG_DEBUG);
return 1;
}
else
{
$this->error=@ldap_error($this->connection);
dol_syslog("Ldap::add_attribute failed: ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::add_attribute failed: ".$this->error, LOG_ERR);
return -1;
}
}
@ -690,7 +690,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::updateAttribute dn=".$dn." info=".join(',',$info));
dol_syslog(get_class($this)."::updateAttribute dn=".$dn." info=".join(',',$info));
// Check parameters
if (! $this->connection)
@ -718,13 +718,13 @@ class Ldap
if ($result)
{
dol_syslog("Ldap::updateAttribute successfull", LOG_DEBUG);
dol_syslog(get_class($this)."::updateAttribute successfull", LOG_DEBUG);
return 1;
}
else
{
$this->error=@ldap_error($this->connection);
dol_syslog("Ldap::updateAttribute failed: ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::updateAttribute failed: ".$this->error, LOG_ERR);
return -1;
}
}
@ -742,7 +742,7 @@ class Ldap
{
global $conf;
dol_syslog("Ldap::deleteAttribute dn=".$dn." info=".join(',',$info));
dol_syslog(get_class($this)."::deleteAttribute dn=".$dn." info=".join(',',$info));
// Check parameters
if (! $this->connection)
@ -770,13 +770,13 @@ class Ldap
if ($result)
{
dol_syslog("Ldap::deleteAttribute successfull", LOG_DEBUG);
dol_syslog(get_class($this)."::deleteAttribute successfull", LOG_DEBUG);
return 1;
}
else
{
$this->error=@ldap_error($this->connection);
dol_syslog("Ldap::deleteAttribute failed: ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::deleteAttribute failed: ".$this->error, LOG_ERR);
return -1;
}
}
@ -872,21 +872,21 @@ class Ldap
* @param string $search Valeur champ cle recherche, sinon '*' pour tous.
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
* @param string $useridentifier Name of key field (Ex: uid)
* @param array $attributeArray Array of fields required (Ex: sn,userPassword)
* @param int $activefilter 1=utilise le champ this->filter comme filtre
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
* @param int $activefilter 1=use field this->filter as filter instead of parameter $search
* @return array Array of [id_record][ldap_field]=value
*/
function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0)
{
$fulllist=array();
dol_syslog("Ldap::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).")");
dol_syslog(get_class($this)."::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).")");
// if the directory is AD, then bind first with the search user first
if ($this->serverType == "activedirectory")
{
$this->bindauth($this->searchUser, $this->searchPassword);
dol_syslog("Ldap::bindauth serverType=activedirectory searchUser=".$this->searchUser);
dol_syslog(get_class($this)."::bindauth serverType=activedirectory searchUser=".$this->searchUser);
}
// Define filter
@ -910,14 +910,14 @@ class Ldap
{
// Return list with required fields
$attributeArray=array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails)
dol_syslog("Ldap::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter. " attributeArray=(".join(',',$attributeArray).")");
dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter. " attributeArray=(".join(',',$attributeArray).")");
//var_dump($attributeArray);
$this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
}
else
{
// Return list with fields selected by default
dol_syslog("Ldap::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter);
dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter);
$this->result = @ldap_search($this->connection, $userDn, $filter);
}
if (!$this->result)
@ -1075,7 +1075,7 @@ class Ldap
*/
function search($checkDn, $filter)
{
dol_syslog("Ldap::search checkDn=".$checkDn." filter=".$filter);
dol_syslog(get_class($this)."::search checkDn=".$checkDn." filter=".$filter);
$checkDn=$this->convFromOutputCharset($checkDn,$this->ldapcharset);
$filter=$this->convFromOutputCharset($filter,$this->ldapcharset);
@ -1124,7 +1124,7 @@ class Ldap
$i=0;
while ($i <= 2)
{
dol_syslog("Ldap::fetch search with searchDN=".$searchDN." filter=".$filter);
dol_syslog(get_class($this)."::fetch search with searchDN=".$searchDN." filter=".$filter);
$this->result = @ldap_search($this->connection, $searchDN, $filter);
if ($this->result)
{
@ -1136,7 +1136,7 @@ class Ldap
else
{
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
dol_syslog("Ldap::fetch search fails");
dol_syslog(get_class($this)."::fetch search fails");
return -1;
}

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -83,6 +84,7 @@ class modAccounting extends DolibarrModules
// Permissions
$this->rights = array();
$this->rights_class = 'accounting';
$r=0;
$this->rights[$r][0] = 50401;
$this->rights[$r][1] = 'Lire le plan de compte';
@ -90,6 +92,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'plancompte';
$this->rights[$r][5] = 'lire';
$r++;
$this->rights[$r][0] = 50402;
$this->rights[$r][1] = 'Creer/modifier un plan de compte';
@ -97,6 +100,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'plancompte';
$this->rights[$r][5] = 'creer';
$r++;
$this->rights[$r][0] = 50403;
$this->rights[$r][1] = 'Cloturer plan de compte';
@ -104,6 +108,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'plancompte';
$this->rights[$r][5] = 'cloturer';
$r++;
$this->rights[$r][0] = 50411;
$this->rights[$r][1] = 'Lire les mouvements comptables';
@ -111,6 +116,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'mouvements';
$this->rights[$r][5] = 'lire';
$r++;
$this->rights[$r][0] = 50412;
$this->rights[$r][1] = 'Creer/modifier/annuler les mouvements comptables';
@ -118,6 +124,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvements';
$this->rights[$r][5] = 'creer';
$r++;
$this->rights[$r][0] = 50415;
$this->rights[$r][1] = 'Lire CA, bilans, resultats, journaux, grands livres';
@ -125,6 +132,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'comptarapport';
$this->rights[$r][5] = 'lire';
$r++;
}

View File

@ -70,9 +70,9 @@ class modLdap extends DolibarrModules
0=>array('LDAP_SERVER_TYPE','chaine','openldap','',0),
1=>array('LDAP_SERVER_PROTOCOLVERSION','chaine','3','',0),
2=>array('LDAP_SERVER_HOST','chaine','localhost','',0),
3=>array('LDAP_USER_DN','chaine','ou=users,dc=my-domain,dc=com','',0),
4=>array('LDAP_GROUP_DN','chaine','ou=groups,dc=my-domain,dc=com','',0),
5=>array('LDAP_FILTER_CONNECTION','chaine','&(objectClass=user)(objectCategory=person)','',0),
3=>array('LDAP_USER_DN','chaine','ou=users,dc=example,dc=com','',0),
4=>array('LDAP_GROUP_DN','chaine','ou=groups,dc=example,dc=com','',0),
5=>array('LDAP_FILTER_CONNECTION','chaine','&(objectClass=inetOrgPerson)','',0),
6=>array('LDAP_FIELD_LOGIN','chaine','uid','',0),
7=>array('LDAP_FIELD_FULLNAME','chaine','cn','',0),
8=>array('LDAP_FIELD_NAME','chaine','sn','',0),

View File

@ -110,7 +110,7 @@ class InterfaceLdapsynchro
if ($action == 'USER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -129,7 +129,7 @@ class InterfaceLdapsynchro
elseif ($action == 'USER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -160,7 +160,7 @@ class InterfaceLdapsynchro
elseif ($action == 'USER_NEW_PASSWORD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -195,7 +195,7 @@ class InterfaceLdapsynchro
elseif ($action == 'USER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -214,7 +214,7 @@ class InterfaceLdapsynchro
elseif ($action == 'USER_SETINGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -252,7 +252,7 @@ class InterfaceLdapsynchro
elseif ($action == 'USER_REMOVEFROMGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -291,7 +291,7 @@ class InterfaceLdapsynchro
// Groupes
elseif ($action == 'GROUP_CREATE')
{
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -313,7 +313,7 @@ class InterfaceLdapsynchro
}
elseif ($action == 'GROUP_MODIFY')
{
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();
@ -343,7 +343,7 @@ class InterfaceLdapsynchro
}
elseif ($action == 'GROUP_DELETE')
{
if (! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
$ldap=new Ldap();
$ldap->connect_bind();

View File

@ -9,7 +9,6 @@
// START - Lines generated via autotranslator.php tool.
// Reference language: en_US
CHARSET=UTF-8
MenuManager=قائمة مدير
ErrorLoginAlreadyExists=ادخل ٪ ق موجود بالفعل.
ErrorGroupAlreadyExists=المجموعة ٪ ق موجود بالفعل.
ErrorFailToDeleteFile=فشل إزالة الملف <b>'٪ ق.</b>

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2012-09-08 17:16:45).
// Reference language: en_US -> bg_BG
CHARSET=UTF-8
MenuManager=Меню мениджър
Error=Грешка
Errors=Грешки
ErrorBadEMail=EMail %s не е

View File

@ -1,6 +1,5 @@
# Dolibarr language file - ca_ES - errors
CHARSET=UTF-8
MenuManager=Gestor de menú
# Errors=
Error=Error
Errors=Errors

View File

@ -60,15 +60,9 @@ ErrorRecordHasChildren=Det lykkedes ikke at slette poster, da det har nogle Chil
// STOP - Lines generated via parser
// START - Lines generated via autotranslator.php tool (2009-08-13 20:39:59).
// START - Lines generated via autotranslator.php tool (2010-07-17 11:19:38).
// Reference language: en_US
MenuManager=Menu manager
ErrorUrlNotValid=Adressen på webstedet er forkert
// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:39:59).
// START - Lines generated via autotranslator.php tool (2010-07-17 11:19:38).
// Reference language: en_US
Error=Fejl
Errors=Fejl
ErrorBadEMail=EMail %s er forkert

View File

@ -51,7 +51,6 @@ ErrorRefAlreadyExists=Die Nr. für den Erstellungsvorgang ist bereits vergeben
ErrorPleaseTypeBankTransactionReportName=Bitte geben Sie den Bankbeleg zu dieser Transaktion ein (Format MMYYYY oder TTMMYYYY)
ErrorRecordHasChildren=Kann diesen Eintrag nicht löschen da er noch über Kindelemente verfügt.
MenuManager=Menüverwaltung
ErrorUrlNotValid=Die angegebene Website-Adresse ist ungültig
Error=Fehler

View File

@ -7,8 +7,6 @@
CHARSET=UTF-8
MenuManager=Menü Verwaltung
# Errors
Error=Fehler
Errors=Fehler

View File

@ -487,12 +487,12 @@ LDAPServerUseTLS=Use TLS
LDAPServerUseTLSExample=Your LDAP server use TLS
LDAPServerDn=Server DN
LDAPAdminDn=Administrator DN
LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com)
LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com)
LDAPPassword=Administrator password
LDAPUserDn=Users' DN
LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com)
LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com)
LDAPGroupDn=Groups' DN
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com)
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com)
LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/)
LDAPServerDnExample=Complete DN (ex: dc=company,dc=com)
LDAPPasswordExample=Admin password
@ -504,9 +504,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization
LDAPDnMemberActive=Members' synchronization
LDAPDnMemberActiveExample=Activated/Unactivated synchronization
LDAPContactDn=Dolibarr contacts' DN
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com)
LDAPMemberDn=Dolibarr member's DN
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com)
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com)
LDAPMemberObjectClassList=List of objectClass
LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPUserObjectClassList=List of objectClass
@ -516,7 +516,7 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes (
LDAPContactObjectClassList=List of objectClass
LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPMemberTypeDn=Dolibarr member's type DN
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com)
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com)
LDAPTestConnect=Test LDAP connection
LDAPTestSynchroContact=Test contact's synchronization
LDAPTestSynchroUser=Test user's synchronization
@ -550,7 +550,7 @@ LDAPFieldCommonNameExample=Example : cn
LDAPFieldName=Name
LDAPFieldNameExample=Example : sn
LDAPFieldFirstName=First name
LDAPFieldFirstNameExample=Example : givenname
LDAPFieldFirstNameExample=Example : givenName
LDAPFieldMail=Email address
LDAPFieldMailExample=Example : mail
LDAPFieldPhone=Professional phone number

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2011-06-26 15:35:22).
// Reference language: en_US -> el_GR
CHARSET=UTF-8
MenuManager=Διευθυντής Μενού
Error=Σφάλμα
Errors=Λάθη
ErrorBadEMail=%s email είναι λάθος

View File

@ -1049,14 +1049,14 @@ LDAPServerUseTLS=Use TLS
LDAPServerUseTLSExample=Your LDAP server use TLS
LDAPServerDn=Server DN
LDAPAdminDn=Administrator DN
LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com)
LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com)
LDAPPassword=Administrator password
LDAPUserDn=Users' DN
LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com)
LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com)
LDAPGroupDn=Groups' DN
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com)
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com)
LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/)
LDAPServerDnExample=Complete DN (ex: dc=company,dc=com)
LDAPServerDnExample=Complete DN (ex: dc=example,dc=com)
LDAPPasswordExample=Admin password
LDAPDnSynchroActive=Users and groups synchronization
LDAPDnSynchroActiveExample=LDAP to Dolibarr or Dolibarr to LDAP synchronization
@ -1066,9 +1066,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization
LDAPDnMemberActive=Members' synchronization
LDAPDnMemberActiveExample=Activated/Unactivated synchronization
LDAPContactDn=Dolibarr contacts' DN
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com)
LDAPMemberDn=Dolibarr members DN
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com)
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com)
LDAPMemberObjectClassList=List of objectClass
LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPUserObjectClassList=List of objectClass
@ -1078,12 +1078,13 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes (
LDAPContactObjectClassList=List of objectClass
LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPMemberTypeDn=Dolibarr members type DN
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com)
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com)
LDAPTestConnect=Test LDAP connection
LDAPTestSynchroContact=Test contacts synchronization
LDAPTestSynchroUser=Test user synchronization
LDAPTestSynchroGroup=Test group synchronization
LDAPTestSynchroMember=Test member synchronization
LDAPTestSearch= Test a LDAP search
LDAPSynchroOK=Synchronization test successful
LDAPSynchroKO=Failed synchronization test
LDAPSynchroKOMayBePermissions=Failed synchronization test. Check that connexion to server is correctly configured and allows LDAP udpates
@ -1093,8 +1094,8 @@ LDAPBindOK=Connect/Authentificate to LDAP server sucessfull (Server=%s, Port=%s,
LDAPBindKO=Connect/Authentificate to LDAP server failed (Server=%s, Port=%s, Admin=%s, Password=%s)
LDAPUnbindSuccessfull=Disconnect successfull
LDAPUnbindFailed=Disconnect failed
LDAPConnectToDNSuccessfull=Connection au DN (%s) r�ussie
LDAPConnectToDNFailed=Connection au DN (%s) �chou�e
LDAPConnectToDNSuccessfull=Connection to DN (%s) successful
LDAPConnectToDNFailed=Connection to DN (%s) failed
LDAPSetupForVersion3=LDAP server configured for version 3
LDAPSetupForVersion2=LDAP server configured for version 2
LDAPDolibarrMapping=Dolibarr Mapping
@ -1105,7 +1106,7 @@ LDAPFilterConnection=Search filter
LDAPFilterConnectionExample=Example : &(objectClass=inetOrgPerson)
LDAPFieldLoginSamba=Login (samba, activedirectory)
LDAPFieldLoginSambaExample=Example : samaccountname
LDAPFieldFullname=First name
LDAPFieldFullname=Full name
LDAPFieldFullnameExample=Example : cn
LDAPFieldPassword=Password
LDAPFieldPasswordNotCrypted=Password not crypted
@ -1116,7 +1117,7 @@ LDAPFieldCommonNameExample=Example : cn
LDAPFieldName=Name
LDAPFieldNameExample=Example : sn
LDAPFieldFirstName=First name
LDAPFieldFirstNameExample=Example : givenname
LDAPFieldFirstNameExample=Example : givenName
LDAPFieldMail=Email address
LDAPFieldMailExample=Example : mail
LDAPFieldPhone=Professional phone number
@ -1146,6 +1147,8 @@ LDAPFieldCompanyExample=Example : o
LDAPFieldSid=SID
LDAPFieldSidExample=Example : objectsid
LDAPFieldEndLastSubscription=Date of subscription end
LDAPFieldTitle=Post/Function
LDAPFieldTitleExample=Example: title
LDAPParametersAreStillHardCoded=LDAP parametres are still hardcoded (in contact class)
LDAPSetupNotComplete=LDAP setup not complete (go on others tabs)
LDAPNoUserOrPasswordProvidedAccessIsReadOnly=No administrator or password provided. LDAP access will be anonymous and in read only mode.

View File

@ -1,10 +1,13 @@
# Dolibarr language file - en_US - errors
CHARSET=UTF-8
MenuManager=Menu manager
# No errors
NoErrorCommitIsDone=No error, we commit
# Errors
Error=Error
Errors=Errors
ErrorButCommitIsDone=Errors found but we validate despite this
ErrorBadEMail=EMail %s is wrong
ErrorBadUrl=Url %s is wrong
ErrorLoginAlreadyExists=Login %s already exists.

View File

@ -582,6 +582,7 @@ CloneMainAttributes=Clone object with its main attributes
PDFMerge=PDF Merge
Merge=Merge
PrintContentArea=Show page to print main content area
MenuManager=Menu manager
NoMenu=No sub-menu
WarningYouAreInMaintenanceMode=Warning, you are in a maintenance mode, so only login <b>%s</b> is allowed to use application at the moment.
CoreErrorTitle=System error

View File

@ -1,6 +1,5 @@
# Dolibarr language file - es_ES - errors
CHARSET=UTF-8
MenuManager=Gestor de menú
# Errors
Error=Error
Errors=Errores

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2012-02-29 22:15:30).
// Reference language: en_US -> et_EE
CHARSET=UTF-8
MenuManager=Menüü juht
Error=Viga
Errors=Vead
ErrorBadEMail=E-post %s on vale

View File

@ -9,7 +9,6 @@
// START - Lines generated via autotranslator.php tool.
// Reference language: en_US
CHARSET=UTF-8
MenuManager=قائمة مدير
ErrorLoginAlreadyExists=ادخل ٪ ق موجود بالفعل.
ErrorGroupAlreadyExists=المجموعة ٪ ق موجود بالفعل.
ErrorFailToDeleteFile=فشل إزالة الملف <b>'٪ ق.</b>

View File

@ -60,13 +60,7 @@ ErrorRecordHasChildren=Poistaminen ei onnistunut kirjaa, koska se on noin lapsen
// START - Lines generated via autotranslator.php tool (2009-08-13 20:45:19).
// Reference language: en_US
MenuManager=Valikko johtaja
ErrorUrlNotValid=Www-sivuston osoite on virheellinen
// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:45:19).
// START - Lines generated via autotranslator.php tool (2010-07-17 11:26:22).
// Reference language: en_US
Error=Virhe
Errors=Virheet
ErrorBadEMail=EMail %s on väärä

View File

@ -1091,6 +1091,7 @@ LDAPTestSynchroContact= Tester synchronisation contacts
LDAPTestSynchroUser= Tester synchronisation utilisateur
LDAPTestSynchroGroup= Tester synchronisation groupe
LDAPTestSynchroMember= Tester synchronisation adhérent
LDAPTestSearch= Tester une recherche LDAP
LDAPSynchroOK= Test de synchronisation réalisé avec succès
LDAPSynchroKO= Échec du test de synchronisation
LDAPSynchroKOMayBePermissions= Echec du test de synchronisation. Vérifier que la connexion au serveur est correctement configurée et permet les mises à jour LDAP
@ -1123,7 +1124,7 @@ LDAPFieldCommonNameExample= Exemple : cn
LDAPFieldName= Nom
LDAPFieldNameExample= Exemple : sn
LDAPFieldFirstName= Prénom
LDAPFieldFirstNameExample= Exemple : givenname
LDAPFieldFirstNameExample= Exemple : givenName
LDAPFieldMail= Email
LDAPFieldMailExample= Exemple : mail
LDAPFieldPhone= Téléphone professionnel
@ -1153,6 +1154,8 @@ LDAPFieldCompanyExample= Exemple : o
LDAPFieldSid= SID
LDAPFieldSidExample= Exemple : objectsid
LDAPFieldEndLastSubscription= Date fin validité adhésion
LDAPFieldTitle=Poste/Fonction
LDAPFieldTitleExample=Exemple: title
LDAPParametersAreStillHardCoded= Les paramètres LDAP sont codés en dur (dans classe contact)
LDAPSetupNotComplete= Configuration LDAP incomplète (à compléter sur les autres onglets)
LDAPNoUserOrPasswordProvidedAccessIsReadOnly= Administrateur ou mot de passe non renseigné. Les accès LDAP seront donc anonymes et en lecture seule.

View File

@ -1,10 +1,13 @@
# Dolibarr language file - fr_FR - errors
CHARSET=UTF-8
MenuManager=Gestionnaire de menu
# No errors
NoErrorCommitIsDone=Pas d'erreur, on valide
# Errors
Error=Erreur
Errors=Erreurs
ErrorButCommitIsDone=Erreurs trouvées mais on valide malgré tout
ErrorBadEMail=e-mail %s invalide
ErrorBadUrl=Url %s invalide
ErrorLoginAlreadyExists=Le login %s existe déjà.

View File

@ -584,6 +584,7 @@ CloneMainAttributes=Cloner l'objet avec ces attributs principaux
PDFMerge=Fusion PDF
Merge=Fusion
PrintContentArea=Afficher page d'impression de la zone centrale
MenuManager=Gestionnaire de menu
NoMenu=Aucun sous-menu
WarningYouAreInMaintenanceMode=Attention, vous êtes en mode maintenance, aussi seul le login <b>%s</b> est autorisé à utiliser l'application en ce moment.
CoreErrorTitle=Erreur système

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2012-03-10 15:14:54).
// Reference language: en_US -> he_IL
CHARSET=UTF-8
MenuManager=תפריט מנהל
Error=שגיאה
Errors=שגיאות
ErrorBadEMail=%s אימייל הוא בסדר

View File

@ -13,7 +13,6 @@ ErrorLoginDisabled=A fiók le van tiltva
// START - Lines generated via autotranslator.php tool (2012-02-29 16:13:31).
// Reference language: en_US -> hu_HU
MenuManager=Menükezelőben
Error=Hiba
Errors=Hibák
ErrorBadEMail=E-mail %s rossz

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2010-06-30 00:15:29).
// Reference language: en_US
CHARSET=UTF-8
MenuManager=Valmynd framkvæmdastjóri
Error=Villa
Errors=Villur
ErrorBadEMail=Netfang %s er rangt

View File

@ -106,7 +106,6 @@ ErrorUrlNotValid =L'indirizzo del sito è errato
ErrorUserCannotBeDelete =L'utente non può essere eliminato. Probabilmente è necessario al funzionamento di Dolibarr.
ErrorWebServerUserHasNotPermission =L'account utente <b>%s</b> utilizzato per eseguire il server web non ha i permessi necessari
ErrorWrongValueForField =Valore errato nel campo numero <b>%s</b> (il valore <b>'%s'</b>non corrisponde alla regex <b>%s</b>)
MenuManager =Gestore dei menu
UserCannotBeDelete =L'utente non può essere eliminato. Forse è associato ad alcuni elementi di Dolibarr.
WarningAllowUrlFopenMustBeOn =Il parametro <b>allow_url_fopen</b> deve essere impostato su <b>on</b> nel file <b>php.ini</b> perché questo modulo funzioni correttamente. È necessario modificare questo file manualmente.
WarningBookmarkAlreadyExists =Un segnalibro per questo link (URL) o con lo stesso titolo esiste già.

View File

@ -15,7 +15,6 @@ WarningUntilDirRemoved=すべてのセキュリティ警告は、(のみの管
// START - Lines generated via autotranslator.php tool (2012-02-29 16:41:06).
// Reference language: en_US -> ja_JP
MenuManager=メニューマネージャ
Error=エラー
Errors=エラー
ErrorBadEMail=メールして%sが間違っている

View File

@ -732,14 +732,14 @@ LDAPServerUseTLS=Use TLS
LDAPServerUseTLSExample=Your LDAP server use TLS
LDAPServerDn=Server DN
LDAPAdminDn=Administrator DN
LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com)
LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com)
LDAPPassword=Administrator password
LDAPUserDn=Users' DN
LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com)
LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com)
LDAPGroupDn=Groups' DN
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com)
LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com)
LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/)
LDAPServerDnExample=Complete DN (ex: dc=company,dc=com)
LDAPServerDnExample=Complete DN (ex: dc=example,dc=com)
LDAPPasswordExample=Admin password
LDAPDnSynchroActive=Users and groups synchronization
LDAPDnSynchroActiveExample=LDAP to Dolibarr or Dolibarr to LDAP synchronization
@ -749,9 +749,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization
LDAPDnMemberActive=Members' synchronization
LDAPDnMemberActiveExample=Activated/Unactivated synchronization
LDAPContactDn=Dolibarr contacts' DN
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com)
LDAPMemberDn=Dolibarr members' DN
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com)
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com)
LDAPMemberObjectClassList=List of objectClass
LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPUserObjectClassList=List of objectClass
@ -761,7 +761,7 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes (
LDAPContactObjectClassList=List of objectClass
LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
LDAPMemberTypeDn=Dolibarr member's type DN
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com)
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com)
LDAPTestConnect=Test LDAP connection
LDAPTestSynchroContact=Test contact's synchronization
LDAPTestSynchroUser=Test user's synchronization
@ -799,7 +799,7 @@ LDAPFieldCommonNameExample=Example : cn
LDAPFieldName=Name
LDAPFieldNameExample=Example : sn
LDAPFieldFirstName=Firstname
LDAPFieldFirstNameExample=Example : givenname
LDAPFieldFirstNameExample=Example : givenName
LDAPFieldMail=Email address
LDAPFieldMailExample=Example : mail
LDAPFieldPhone=Professional phone number

View File

@ -44,7 +44,6 @@ ErrorLDAPMakeManualTest=En .ldif fil er opprettet i mappen %s. Prøv å lese den
// START - Lines generated via autotranslator.php tool (2010-07-17 11:45:17).
// Reference language: en_US
MenuManager=Meny manager
Error=Feil
Errors=Feil
ErrorBadEMail=E-post %s er feil

View File

@ -1,6 +1,5 @@
# Dolibarr language file - nl_NL - errors
CHARSET = UTF-8
MenuManager = Menubeheer
Error = Fout
Errors = Fouten
ErrorBadEMail = Ongeldige e-mail %s

View File

@ -62,7 +62,6 @@ ErrorRecordHasChildren=Nie można usunąć rekordy, ponieważ ma pewne Childs.
// START - Lines generated via autotranslator.php tool (2009-08-13 21:07:31).
// Reference language: en_US
MenuManager=Menu menedżera
ErrorUrlNotValid=Adres strony internetowej jest nieprawidłowy
Error=Błąd
Errors=Błędy

View File

@ -1,6 +1,5 @@
# Dolibarr language file - pt_BR rev. 0.0 - errors
CHARSET=UTF-8
MenuManager=Gerente de menu
ErrorLoginAlreadyExists=o login %s já existe.
ErrorGroupAlreadyExists=o grupo %s já existe.
ErrorDuplicateTrigger=um Arquivo trigger de Nome '<b>%s</b>' está utilizado. Elimine o duplicado da pasta '<b>%s</b>'.

View File

@ -1,6 +1,5 @@
# Dolibarr language file - pt_PT - errors
CHARSET=UTF-8
MenuManager=Gestor de menu
ErrorLoginAlreadyExists=O login %s já existe.
ErrorGroupAlreadyExists=O grupo %s já existe.
ErrorDuplicateTrigger=Um Ficheiro trigger de Nome '<b>%s</b>' está utilizado. Elimine o duplicado da pasta '<b>%s</b>'.

View File

@ -60,7 +60,6 @@ ErrorRecordHasChildren=Nu a reuşit să ştergeţi înregistrări, deoarece aces
// START - Lines generated via autotranslator.php tool (2009-08-13 21:12:07).
// Reference language: en_US
MenuManager=Meniu manager
ErrorUrlNotValid=Site-ul este incorect adresa
// STOP - Lines generated via autotranslator.php tool (2009-08-13 21:12:07).

View File

@ -54,7 +54,6 @@ ErrorCantSaveADoneUserWithZeroPercentage=Не удается сохранить
ErrorRefAlreadyExists=Ссылки, используемые для создания, уже существует.
ErrorPleaseTypeBankTransactionReportName=Введите название банка, где получение сделки (в формате ГГГГММ или ГГГГММДД)
ErrorRecordHasChildren=Не удается удалить записи, поскольку он имеет некоторые хлеб.
MenuManager=Меню менеджера
ErrorUrlNotValid=Адрес веб-сайта, является неверным
Error=Ошибка
Errors=Ошибки

View File

@ -1046,7 +1046,7 @@ LDAPFieldCommonNameExample = Example : cn
LDAPFieldName = Name
LDAPFieldNameExample = Example : sn
LDAPFieldFirstName = First name
LDAPFieldFirstNameExample = Example : givenname
LDAPFieldFirstNameExample = Example : givenName
LDAPFieldMail = Email address
LDAPFieldMailExample = Example : mail
LDAPFieldPhone = Professional phone number

View File

@ -1,6 +1,5 @@
# Dolibarr language file - en_US - errors =
CHARSET = UTF-8
MenuManager = Upravljanje z meniji
Error = Napaka
Errors = Napake
ErrorBadEMail = EMail %s je napačen

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2010-08-27 08:47:44).
// Reference language: en_US
CHARSET=UTF-8
MenuManager=Meny chef
Error=Fel
Errors=Fel
ErrorBadEMail=EMail %s är fel

View File

@ -5,7 +5,6 @@
*/
// Reference language: en_US -> TR errors
CHARSET=UTF-8
MenuManager=Menü yöneticisi
# Hatalar
Error=Hata

View File

@ -8,7 +8,6 @@
// START - Lines generated via autotranslator.php tool (2010-06-08 21:22:55).
// Reference language: en_US
CHARSET=UTF-8
MenuManager=菜单管理
Error=错误
Errors=错误
ErrorBadEMail=电子邮件s是错误的

View File

@ -87,9 +87,6 @@ class User extends CommonObject
var $photo;
var $lang;
//! Liste des entrepots auquel a acces l'utilisateur
var $entrepots;
var $rights; // Array of permissions user->rights->permx
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
private $_tab_loaded=array(); // Array of cache of already loaded permissions
@ -800,7 +797,7 @@ class User extends CommonObject
// Set default rights
if ($this->set_default_rights() < 0)
{
$this->error=$this->db->error();
$this->error='ErrorFailedToSetDefaultRightOfUser';
$this->db->rollback();
return -5;
}

View File

@ -350,7 +350,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$message.='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'</div>';
}
else
{
{
$message.='<div class="error">'.$edituser->error.'</div>';
}
}
@ -462,6 +462,7 @@ if ($action == 'adduserldap')
$selecteduser = $_POST['users'];
$required_fields = array(
$conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN,
@ -472,6 +473,8 @@ if ($action == 'adduserldap')
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_SID);
$ldap = new Ldap();
@ -532,7 +535,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print "<br>";
print "<br>";
dol_htmloutput_errors($message);
dol_htmloutput_mesg($message);
if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr'))
{
@ -545,18 +548,30 @@ if (($action == 'create') || ($action == 'adduserldap'))
$result = $ldap->connect_bind();
if ($result >= 0)
{
$required_fields=array($conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA);
$required_fields=array(
$conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
$conf->global->LDAP_FIELD_PASSWORD,
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_SID
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
if (is_array($ldapusers))
{
$liste=array();
@ -586,27 +601,27 @@ if (($action == 'create') || ($action == 'adduserldap'))
}
// Si la liste des users est rempli, on affiche la liste deroulante
if (is_array($liste))
print "\n\n<!-- Form liste LDAP debut -->\n";
print '<form name="add_user_ldap" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table width="100%" class="border"><tr>';
print '<td width="160">';
print $langs->trans("LDAPUsers");
print '</td>';
print '<td>';
print '<input type="hidden" name="action" value="adduserldap">';
if (is_array($liste) && count($liste))
{
print "\n\n<!-- Form liste LDAP debut -->\n";
print '<form name="add_user_ldap" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table width="100%" class="border"><tr>';
print '<td width="160">';
print $langs->trans("LDAPUsers");
print '</td>';
print '<td>';
print '<input type="hidden" name="action" value="adduserldap">';
print $form->selectarray('users', $liste, '', 1);
print '</td><td align="center">';
print '<input type="submit" class="button" value="'.$langs->trans('Get').'">';
print '</td></tr></table>';
print '</form>';
print "\n<!-- Form liste LDAP fin -->\n\n";
print '<br>';
}
print '</td><td align="center">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Get')).'"'.(count($liste)?'':' disabled="disabled"').'>';
print '</td></tr></table>';
print '</form>';
print "\n<!-- Form liste LDAP fin -->\n\n";
print '<br>';
}
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="createuser">';

View File

@ -220,7 +220,6 @@ function getUser($authentication,$id,$ref='',$ref_ext='')
'statut' => $user->statut,
'photo' => $user->photo,
'lang' => $user->lang,
'entrepots' => $user->entrepots,
//'rights' => $user->rights,
'canvas' => $user->canvas
)

2
scripts/members/sync_members_dolibarr2ldap.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
/*
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*

100
scripts/members/sync_members_ldap2dolibarr.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
/*
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
@ -48,18 +48,53 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
$langs->load("main");
$langs->load("main");
$langs->load("errors");
// List of fields to get from LDAP
$required_fields = array(
$conf->global->LDAP_KEY_MEMBERS,
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
$conf->global->LDAP_FIELD_PASSWORD,
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_PHONE_PERSO,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_ADDRESS,
$conf->global->LDAP_FIELD_ZIP,
$conf->global->LDAP_FIELD_TOWN,
$conf->global->LDAP_FIELD_COUNTRY,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_BIRTHDATE,
$conf->global->LDAP_FIELD_MEMBER_STATUS,
$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION,
// Subscriptions
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE,
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT,
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE,
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement")));
if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
if ($argv[3]) $conf->global->LDAP_SERVER_HOST=$argv[2];
print "***** $script_file ($version) *****\n";
if (! isset($argv[1]) || ! is_numeric($argv[1])) {
print "Usage: $script_file id_member_type\n";
if (! isset($argv[2]) || ! is_numeric($argv[2])) {
print "Usage: $script_file (nocommitiferror|commitiferror) id_member_type [ldapserverhost]\n";
exit;
}
$typeid=$argv[1];
$typeid=$argv[2];
if ($argv[1] == 'commitiferror') $forcecommit=1;
print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails
@ -77,15 +112,17 @@ print "host=".$conf->db->host."\n";
print "port=".$conf->db->port."\n";
print "login=".$conf->db->user."\n";
print "database=".$conf->db->name."\n";
print "----- Options:\n";
print "commitiferror=".$forcecommit."\n";
print "Mapped LDAP fields=".join(',',$required_fields)."\n";
print "\n";
print "Press a key to confirm...\n";
print "Press a key to confirm...";
$input = trim(fgets(STDIN));
print "Warning, this operation may result in data loss if it failed.\n";
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (! $conf->global->LDAP_MEMBER_DN)
if (empty($conf->global->LDAP_MEMBER_DN))
{
print $langs->trans("Error").': '.$langs->trans("LDAP setup for members not defined inside Dolibarr");
exit(1);
@ -134,42 +171,9 @@ if ($result >= 0)
$justthese=array();
// On d<>sactive la synchro Dolibarr vers LDAP
// We disable synchro Dolibarr-LDAP
$conf->global->LDAP_MEMBER_ACTIVE=0;
// Liste des champs a r<>cup<75>rer de LDAP
$required_fields = array(
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
$conf->global->LDAP_FIELD_PASSWORD,
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_PHONE_PERSO,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_ADDRESS,
$conf->global->LDAP_FIELD_ZIP,
$conf->global->LDAP_FIELD_TOWN,
$conf->global->LDAP_FIELD_COUNTRY,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_BIRTHDATE,
$conf->global->LDAP_FIELD_MEMBER_STATUS,
$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION,
// Subscriptions
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE,
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT,
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE,
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement")));
$ldaprecords = $ldap->getRecords('*',$conf->global->LDAP_MEMBER_DN, $conf->global->LDAP_KEY_MEMBERS, $required_fields, 0);
if (is_array($ldaprecords))
{
@ -301,6 +305,7 @@ if ($result >= 0)
print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
$db->rollback();
}
print "\n";
}
else
{
@ -318,7 +323,14 @@ else
return $error;
function dolValidElement($element) {
/**
* Function to say if a value is empty or not
*
* @param string $element Value to test
* @return boolean True of false
*/
function dolValidElement($element)
{
return (trim($element) != '');
}

2
scripts/user/sync_groups_dolibarr2ldap.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
/*
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*

2
scripts/user/sync_users_dolibarr2ldap.php Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
/*
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*

View File

@ -0,0 +1,282 @@
#!/usr/bin/php
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2012 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file scripts/user/sync_users_ldap2dolibarr.php
* \ingroup ldap member
* \brief Script to update users into Dolibarr from LDAP
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You ar usingr PH for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Main
$version='1.14';
@set_time_limit(0);
$error=0;
$forcecommit=0;
require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
$langs->load("main");
$langs->load("errors");
// List of fields to get from LDAP
$required_fields = array(
$conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_FULLNAME,
$conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN,
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
$conf->global->LDAP_FIELD_PASSWORD,
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_MOBILE,
//$conf->global->LDAP_FIELD_ADDRESS,
//$conf->global->LDAP_FIELD_ZIP,
//$conf->global->LDAP_FIELD_TOWN,
//$conf->global->LDAP_FIELD_COUNTRY,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE,
$conf->global->LDAP_FIELD_DESCRIPTION,
$conf->global->LDAP_FIELD_SID
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement")));
if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
print "***** $script_file ($version) *****\n";
if (! isset($argv[1])) {
//print "Usage: $script_file (nocommitiferror|commitiferror) [id_group]\n";
print "Usage: $script_file (nocommitiferror|commitiferror) [ldapserverhost]\n";
exit;
}
$groupid=$argv[3];
if ($argv[1] == 'commitiferror') $forcecommit=1;
print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails
print "\n";
print "----- Synchronize all records from LDAP database:\n";
print "host=".$conf->global->LDAP_SERVER_HOST."\n";
print "port=".$conf->global->LDAP_SERVER_PORT."\n";
print "login=".$conf->global->LDAP_ADMIN_DN."\n";
print "pass=".preg_replace('/./i','*',$conf->global->LDAP_ADMIN_PASS)."\n";
print "DN to extract=".$conf->global->LDAP_USER_DN."\n";
print 'Filter=('.$conf->global->LDAP_KEY_USERS.'=*)'."\n";
print "----- To Dolibarr database:\n";
print "type=".$conf->db->type."\n";
print "host=".$conf->db->host."\n";
print "port=".$conf->db->port."\n";
print "login=".$conf->db->user."\n";
print "database=".$conf->db->name."\n";
print "----- Options:\n";
print "commitiferror=".$forcecommit."\n";
print "Mapped LDAP fields=".join(',',$required_fields)."\n";
print "\n";
print "Press a key to confirm...";
$input = trim(fgets(STDIN));
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (empty($conf->global->LDAP_USER_DN))
{
print $langs->trans("Error").': '.$langs->trans("LDAP setup for users not defined inside Dolibarr");
exit(1);
}
// Charge tableau de correspondance des pays
$hashlib2rowid=array();
$countries=array();
$sql = "SELECT rowid, code, libelle, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
$sql.= " WHERE active = 1";
$sql.= " ORDER BY code ASC";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
//print 'Load cache for country '.strtolower($obj->libelle).' rowid='.$obj->rowid."\n";
$hashlib2rowid[strtolower($obj->libelle)]=$obj->rowid;
$countries[$obj->rowid]=array('rowid' => $obj->rowid, 'label' => $obj->libelle, 'code' => $obj->code);
}
$i++;
}
}
}
else
{
dol_print_error($db);
exit;
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result >= 0)
{
$justthese=array();
// We disable synchro Dolibarr-LDAP
$conf->global->LDAP_SYNCHRO_ACTIVE=0;
$ldaprecords = $ldap->getRecords('*',$conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 0);
if (is_array($ldaprecords))
{
$db->begin();
// Warning $ldapuser has a key in lowercase
foreach ($ldaprecords as $key => $ldapuser)
{
$fuser = new User($db);
// Propriete membre
$fuser->firstname=$ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME];
$fuser->lastname=$ldapuser[$conf->global->LDAP_FIELD_NAME];
$fuser->login=$ldapuser[$conf->global->LDAP_FIELD_LOGIN];
$fuser->pass=$ldapuser[$conf->global->LDAP_FIELD_PASSWORD];
$fuser->pass_indatabase_crypted=$ldapuser[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED];
//$user->societe;
/*
$fuser->address=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS];
$fuser->zip=$ldapuser[$conf->global->LDAP_FIELD_ZIP];
$fuser->town=$ldapuser[$conf->global->LDAP_FIELD_TOWN];
$fuser->country=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY];
$fuser->country_id=$countries[$hashlib2rowid[strtolower($fuser->country)]]['rowid'];
$fuser->country_code=$countries[$hashlib2rowid[strtolower($fuser->country)]]['code'];
*/
$fuser->office_phone=$ldapuser[$conf->global->LDAP_FIELD_PHONE];
$fuser->user_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE];
$fuser->office_fax=$ldapuser[$conf->global->LDAP_FIELD_FAX];
$fuser->email=$ldapuser[$conf->global->LDAP_FIELD_MAIL];
$fuser->job=$ldapuser[$conf->global->LDAP_FIELD_TITLE];
$fuser->note=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION];
$fuser->admin=0;
$fuser->societe_id=0;
$fuser->contact_id=0;
$fuser->fk_member=0;
$fuser->statut=1;
/*if (isset($ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS]))
{
$fuser->datec=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
$fuser->datevalid=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
$fuser->statut=$ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS];
}*/
//if ($fuser->statut > 1) $fuser->statut=1;
//print_r($ldapuser);
// Group of user
// We should use here $groupid
// Creation member
print $langs->transnoentities("UserCreate").' # '.$key.': login='.$fuser->login.', fullname='.$fuser->getFullName($langs);
$fuser_id=$fuser->create($user);
if ($fuser_id > 0)
{
print ' --> Created member id='.$fuser_id.' login='.$fuser->login;
}
else
{
$error++;
print ' --> '.$fuser_id.' '.$fuser->error;
}
print "\n";
//print_r($fuser);
}
if (! $error || $forcecommit)
{
if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
$db->commit();
}
else
{
print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone",$error)."\n";
$db->rollback();
}
print "\n";
}
else
{
dol_print_error('',$ldap->error);
$error++;
}
}
else
{
dol_print_error('',$ldap->error);
$error++;
}
return $error;
/**
* Function to say if a value is empty or not
*
* @param string $element Value to test
* @return boolean True of false
*/
function dolValidElement($element)
{
return (trim($element) != '');
}
?>