From 4fd79a4675944cf5fd69dd12e50ff1bad41d4bc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:30:23 +0200 Subject: [PATCH 01/11] Qual: Removed deprecated field --- htdocs/user/class/user.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 27d03b7be7a..3ff5c7bd8be 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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 From 9c7b9f744f3deefad707609871d0908ad313dc94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:31:02 +0200 Subject: [PATCH 02/11] Removed deprecated field --- htdocs/webservices/server_user.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 3ae7e7ee35b..4aee9cf42b0 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -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 ) From 0d92fe2de1e18e61ebd78ed431fd559557ec25c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:32:10 +0200 Subject: [PATCH 03/11] Normalize code --- htdocs/core/class/ldap.class.php | 60 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 568b2a335f3..73304b232ee 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -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; } From ec10bf41122c8b5a850e6a9375052da577e2a88e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:33:32 +0200 Subject: [PATCH 04/11] New: Add test for synchro ldap 2 dolibarr --- htdocs/admin/ldap.php | 1 + htdocs/admin/ldap_users.php | 95 +++++++++++++++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 6cc42777343..7cb300b0384 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -245,6 +245,7 @@ print ''; print ''; +print '
'; /* diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 909364fb00e..b67fd7ae930 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent - * + * * 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++; @@ -249,7 +249,7 @@ print ''; // Description $var=!$var; -print ''.$langs->trans("LDAPFieldDescription").''; +print ''.$langs->trans("Note").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked="checked"':'').">"; @@ -287,10 +287,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 +348,84 @@ if (function_exists("ldap_connect")) print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'
'; } } + + 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_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='
'.$ldap->error.'
'; + } + + print "
\n"; + print "LDAP search for user:
\n"; + print "search: *
\n"; + print "userDN: ".$conf->global->LDAP_USER_DN."
\n"; + print "useridentifier: ".$conf->global->LDAP_KEY_USERS."
\n"; + print "required_fields: ".join(',',$required_fields)."
\n"; + print "=> ".count($liste)." records
\n"; + print "\n
"; + } + else + { + print img_picto('','error').' '; + print ''.$langs->trans("LDAPSynchroKO"); + print ': '.$ldap->error; + print '
'; + print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'
'; + } + } } dol_htmloutput_mesg($mesg); From f701c1afba59d3f47ac9645726d12994ac14f185 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:33:47 +0200 Subject: [PATCH 05/11] Fix translations --- htdocs/langs/el_GR/admin.lang | 14 +++++++------- htdocs/langs/en_US/admin.lang | 23 ++++++++++++----------- htdocs/langs/fr_FR/admin.lang | 3 ++- htdocs/langs/nb_NO/admin.lang | 16 ++++++++-------- htdocs/langs/sl_SI/admin.lang | 2 +- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/htdocs/langs/el_GR/admin.lang b/htdocs/langs/el_GR/admin.lang index 6f38ed9ed82..ee159f0d689 100644 --- a/htdocs/langs/el_GR/admin.lang +++ b/htdocs/langs/el_GR/admin.lang @@ -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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b4d89c11055..efefb67f7ce 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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 diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 64ced0b6cf8..deef7609e55 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -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 diff --git a/htdocs/langs/nb_NO/admin.lang b/htdocs/langs/nb_NO/admin.lang index d1735da5273..7a9ec630980 100644 --- a/htdocs/langs/nb_NO/admin.lang +++ b/htdocs/langs/nb_NO/admin.lang @@ -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 diff --git a/htdocs/langs/sl_SI/admin.lang b/htdocs/langs/sl_SI/admin.lang index 0e6da5c4914..47b8ab80347 100644 --- a/htdocs/langs/sl_SI/admin.lang +++ b/htdocs/langs/sl_SI/admin.lang @@ -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 From c88d8f5d0ed83a71af0f603925cbdc17723682e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 17:35:28 +0200 Subject: [PATCH 06/11] Fix: Resotre synchro ldap 2 dolibarr --- htdocs/user/fiche.php | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d3c1c40e877..6a78003324d 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -350,7 +350,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $message.='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; } else - { + { $message.='
'.$edituser->error.'
'; } } @@ -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, @@ -532,7 +533,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print "
"; print "
"; - 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')) { @@ -557,6 +558,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // 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 +588,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\n"; + + print '
'; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("LDAPUsers"); + print ''; + print ''; + if (is_array($liste) && count($liste)) { - print "\n\n\n"; - - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("LDAPUsers"); - print ''; - print ''; print $form->selectarray('users', $liste, '', 1); - print ''; - print ''; - print '
'; - print ''; - - print "\n\n\n"; - print '
'; } + print '
'; + print ''; + print '
'; + print ''; + + print "\n\n\n"; + print '
'; } print '
'; From 5c78b2d5ddf8b1c517ab42cc8248f9078ff584be Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 24 Oct 2012 18:41:22 +0200 Subject: [PATCH 07/11] Fix: possibility to use this function in external module class --- htdocs/core/class/extrafields.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e6a38218566..37ca8710aeb 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Laurent Destailleur - * Copyright (C) 2009-2011 Regis Houssin + * Copyright (C) 2009-2012 Regis Houssin * * 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 @@ -118,7 +118,7 @@ class ExtraFields * @param int $unique Is field unique or not * @return int <=0 if KO, >0 if OK */ - private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0) + function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0) { $table=''; if ($elementtype == 'member') $table='adherent_extrafields'; From afb94c501430a6d1d67a3719e4b2caabcb2b888f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 21:16:58 +0200 Subject: [PATCH 08/11] Fix: Avoid warning --- .../interface_50_modLdap_Ldapsynchro.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index cde0d1a2f9d..7c151ae09c4 100755 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -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(); From d1a4a6a0908ac971898fa122899f050f8fd850de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 21:19:10 +0200 Subject: [PATCH 09/11] New: Support synchro of field job/title. New: Add script to synchronize users from ldap to dolibarr. --- htdocs/admin/ldap_users.php | 40 ++- htdocs/core/modules/modLdap.class.php | 6 +- htdocs/langs/ar_SA/errors.lang | 1 - htdocs/langs/bg_BG/errors.lang | 1 - htdocs/langs/ca_ES/errors.lang | 1 - htdocs/langs/da_DK/errors.lang | 8 +- htdocs/langs/de_AT/errors.lang | 1 - htdocs/langs/de_DE/errors.lang | 2 - htdocs/langs/el_GR/errors.lang | 1 - htdocs/langs/en_US/admin.lang | 2 + htdocs/langs/en_US/errors.lang | 5 +- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/es_ES/errors.lang | 1 - htdocs/langs/et_EE/errors.lang | 1 - htdocs/langs/fa_IR/errors.lang | 1 - htdocs/langs/fi_FI/errors.lang | 6 - htdocs/langs/fr_FR/admin.lang | 2 + htdocs/langs/fr_FR/errors.lang | 5 +- htdocs/langs/fr_FR/main.lang | 1 + htdocs/langs/he_IL/errors.lang | 1 - htdocs/langs/hu_HU/errors.lang | 1 - htdocs/langs/is_IS/errors.lang | 1 - htdocs/langs/it_IT/errors.lang | 1 - htdocs/langs/ja_JP/errors.lang | 1 - htdocs/langs/nb_NO/errors.lang | 1 - htdocs/langs/nl_NL/errors.lang | 1 - htdocs/langs/pl_PL/errors.lang | 1 - htdocs/langs/pt_BR/errors.lang | 1 - htdocs/langs/pt_PT/errors.lang | 1 - htdocs/langs/ro_RO/errors.lang | 1 - htdocs/langs/ru_RU/errors.lang | 1 - htdocs/langs/sl_SI/errors.lang | 1 - htdocs/langs/sv_SE/errors.lang | 1 - htdocs/langs/tr_TR/errors.lang | 1 - htdocs/langs/zh_CN/errors.lang | 1 - htdocs/user/class/user.class.php | 2 +- htdocs/user/fiche.php | 25 +- .../members/sync_members_dolibarr2ldap.php | 2 +- .../members/sync_members_ldap2dolibarr.php | 100 ++++--- scripts/user/sync_groups_dolibarr2ldap.php | 2 +- scripts/user/sync_users_dolibarr2ldap.php | 2 +- scripts/user/sync_users_ldap2dolibarr.php | 282 ++++++++++++++++++ 42 files changed, 405 insertions(+), 112 deletions(-) mode change 100644 => 100755 scripts/members/sync_members_dolibarr2ldap.php mode change 100644 => 100755 scripts/members/sync_members_ldap2dolibarr.php mode change 100644 => 100755 scripts/user/sync_groups_dolibarr2ldap.php mode change 100644 => 100755 scripts/user/sync_users_dolibarr2ldap.php create mode 100755 scripts/user/sync_users_ldap2dolibarr.php diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index b67fd7ae930..a0bae7e3be8 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -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,7 +248,15 @@ print ''.$langs->trans("LDAPFieldFaxExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked="checked"':'').">"; print ''; -// Description +// Title +$var=!$var; +print ''.$langs->trans("LDAPFieldTitle").''; +print ''; +print ''.$langs->trans("LDAPFieldTitleExample").''; +print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked="checked"':'').">"; +print ''; + +// Note $var=!$var; print ''.$langs->trans("Note").''; print ''; @@ -364,19 +373,22 @@ if (function_exists("ldap_connect")) 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_SID); + $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"))); diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php index 296293d60e6..538a9a7cf8d 100644 --- a/htdocs/core/modules/modLdap.class.php +++ b/htdocs/core/modules/modLdap.class.php @@ -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), diff --git a/htdocs/langs/ar_SA/errors.lang b/htdocs/langs/ar_SA/errors.lang index 40d8ebd63e0..d16a371da66 100644 --- a/htdocs/langs/ar_SA/errors.lang +++ b/htdocs/langs/ar_SA/errors.lang @@ -9,7 +9,6 @@ // START - Lines generated via autotranslator.php tool. // Reference language: en_US CHARSET=UTF-8 -MenuManager=قائمة مدير ErrorLoginAlreadyExists=ادخل ٪ ق موجود بالفعل. ErrorGroupAlreadyExists=المجموعة ٪ ق موجود بالفعل. ErrorFailToDeleteFile=فشل إزالة الملف '٪ ق. diff --git a/htdocs/langs/bg_BG/errors.lang b/htdocs/langs/bg_BG/errors.lang index db5a549fae8..83d491cae38 100644 --- a/htdocs/langs/bg_BG/errors.lang +++ b/htdocs/langs/bg_BG/errors.lang @@ -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 не е diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index b55edc77412..fd43de81c10 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -1,6 +1,5 @@ # Dolibarr language file - ca_ES - errors CHARSET=UTF-8 -MenuManager=Gestor de menú # Errors= Error=Error Errors=Errors diff --git a/htdocs/langs/da_DK/errors.lang b/htdocs/langs/da_DK/errors.lang index 57060c0314f..7d845bada5d 100644 --- a/htdocs/langs/da_DK/errors.lang +++ b/htdocs/langs/da_DK/errors.lang @@ -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 diff --git a/htdocs/langs/de_AT/errors.lang b/htdocs/langs/de_AT/errors.lang index 8694d13fac4..803c688633b 100644 --- a/htdocs/langs/de_AT/errors.lang +++ b/htdocs/langs/de_AT/errors.lang @@ -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 diff --git a/htdocs/langs/de_DE/errors.lang b/htdocs/langs/de_DE/errors.lang index f4d9a8af339..593f18bde01 100644 --- a/htdocs/langs/de_DE/errors.lang +++ b/htdocs/langs/de_DE/errors.lang @@ -7,8 +7,6 @@ CHARSET=UTF-8 -MenuManager=Menü Verwaltung - # Errors Error=Fehler Errors=Fehler diff --git a/htdocs/langs/el_GR/errors.lang b/htdocs/langs/el_GR/errors.lang index fd9c6bd8daa..3e21c71b43e 100644 --- a/htdocs/langs/el_GR/errors.lang +++ b/htdocs/langs/el_GR/errors.lang @@ -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 είναι λάθος diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index efefb67f7ce..acf2a6095aa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1147,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. diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a1f45f4ca1f..19a36f64c22 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -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. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2f329143fc3..36866d73a8a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -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 %s is allowed to use application at the moment. CoreErrorTitle=System error diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index b238a2d3802..580627e6cab 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -1,6 +1,5 @@ # Dolibarr language file - es_ES - errors CHARSET=UTF-8 -MenuManager=Gestor de menú # Errors Error=Error Errors=Errores diff --git a/htdocs/langs/et_EE/errors.lang b/htdocs/langs/et_EE/errors.lang index eafe9f45621..a5f8d78fd06 100644 --- a/htdocs/langs/et_EE/errors.lang +++ b/htdocs/langs/et_EE/errors.lang @@ -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 diff --git a/htdocs/langs/fa_IR/errors.lang b/htdocs/langs/fa_IR/errors.lang index 51a3bbca1fd..a26cf6eb48b 100644 --- a/htdocs/langs/fa_IR/errors.lang +++ b/htdocs/langs/fa_IR/errors.lang @@ -9,7 +9,6 @@ // START - Lines generated via autotranslator.php tool. // Reference language: en_US CHARSET=UTF-8 -MenuManager=قائمة مدير ErrorLoginAlreadyExists=ادخل ٪ ق موجود بالفعل. ErrorGroupAlreadyExists=المجموعة ٪ ق موجود بالفعل. ErrorFailToDeleteFile=فشل إزالة الملف '٪ ق. diff --git a/htdocs/langs/fi_FI/errors.lang b/htdocs/langs/fi_FI/errors.lang index 544b89ef544..4e9fe51a2a7 100644 --- a/htdocs/langs/fi_FI/errors.lang +++ b/htdocs/langs/fi_FI/errors.lang @@ -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ä diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index deef7609e55..6afab6c47ab 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1154,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. diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 6f4a790a6d6..87715bea1fe 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -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à. diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 5a4f9ebdbb4..b2147ce7e20 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -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 %s est autorisé à utiliser l'application en ce moment. CoreErrorTitle=Erreur système diff --git a/htdocs/langs/he_IL/errors.lang b/htdocs/langs/he_IL/errors.lang index 09e35168204..8ebd4928871 100644 --- a/htdocs/langs/he_IL/errors.lang +++ b/htdocs/langs/he_IL/errors.lang @@ -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 אימייל הוא בסדר diff --git a/htdocs/langs/hu_HU/errors.lang b/htdocs/langs/hu_HU/errors.lang index 87d8531c815..50e6875d84d 100644 --- a/htdocs/langs/hu_HU/errors.lang +++ b/htdocs/langs/hu_HU/errors.lang @@ -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 diff --git a/htdocs/langs/is_IS/errors.lang b/htdocs/langs/is_IS/errors.lang index c896905ef3f..ae238fb5951 100644 --- a/htdocs/langs/is_IS/errors.lang +++ b/htdocs/langs/is_IS/errors.lang @@ -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 diff --git a/htdocs/langs/it_IT/errors.lang b/htdocs/langs/it_IT/errors.lang index 8061c07fd6a..e00684424f5 100644 --- a/htdocs/langs/it_IT/errors.lang +++ b/htdocs/langs/it_IT/errors.lang @@ -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 %s utilizzato per eseguire il server web non ha i permessi necessari ErrorWrongValueForField =Valore errato nel campo numero %s (il valore '%s'non corrisponde alla regex %s) -MenuManager =Gestore dei menu UserCannotBeDelete =L'utente non può essere eliminato. Forse è associato ad alcuni elementi di Dolibarr. WarningAllowUrlFopenMustBeOn =Il parametro allow_url_fopen deve essere impostato su on nel file php.ini perché questo modulo funzioni correttamente. È necessario modificare questo file manualmente. WarningBookmarkAlreadyExists =Un segnalibro per questo link (URL) o con lo stesso titolo esiste già. diff --git a/htdocs/langs/ja_JP/errors.lang b/htdocs/langs/ja_JP/errors.lang index 8e1c9b8c371..b48f72828dd 100644 --- a/htdocs/langs/ja_JP/errors.lang +++ b/htdocs/langs/ja_JP/errors.lang @@ -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が間違っている diff --git a/htdocs/langs/nb_NO/errors.lang b/htdocs/langs/nb_NO/errors.lang index 0776a78c04d..0ee9583b99d 100644 --- a/htdocs/langs/nb_NO/errors.lang +++ b/htdocs/langs/nb_NO/errors.lang @@ -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 diff --git a/htdocs/langs/nl_NL/errors.lang b/htdocs/langs/nl_NL/errors.lang index 495aeaa6efb..728b4eddbdb 100644 --- a/htdocs/langs/nl_NL/errors.lang +++ b/htdocs/langs/nl_NL/errors.lang @@ -1,6 +1,5 @@ # Dolibarr language file - nl_NL - errors CHARSET = UTF-8 -MenuManager = Menubeheer Error = Fout Errors = Fouten ErrorBadEMail = Ongeldige e-mail %s diff --git a/htdocs/langs/pl_PL/errors.lang b/htdocs/langs/pl_PL/errors.lang index d905639743d..46c5ac0d97b 100644 --- a/htdocs/langs/pl_PL/errors.lang +++ b/htdocs/langs/pl_PL/errors.lang @@ -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 diff --git a/htdocs/langs/pt_BR/errors.lang b/htdocs/langs/pt_BR/errors.lang index 689e880ef87..012cdbb20fb 100644 --- a/htdocs/langs/pt_BR/errors.lang +++ b/htdocs/langs/pt_BR/errors.lang @@ -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 '%s' está utilizado. Elimine o duplicado da pasta '%s'. diff --git a/htdocs/langs/pt_PT/errors.lang b/htdocs/langs/pt_PT/errors.lang index ffe03099555..885eb064467 100644 --- a/htdocs/langs/pt_PT/errors.lang +++ b/htdocs/langs/pt_PT/errors.lang @@ -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 '%s' está utilizado. Elimine o duplicado da pasta '%s'. diff --git a/htdocs/langs/ro_RO/errors.lang b/htdocs/langs/ro_RO/errors.lang index 512c8267605..df2d969d797 100644 --- a/htdocs/langs/ro_RO/errors.lang +++ b/htdocs/langs/ro_RO/errors.lang @@ -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). diff --git a/htdocs/langs/ru_RU/errors.lang b/htdocs/langs/ru_RU/errors.lang index abd8ef5cdc1..d4cc21e6723 100644 --- a/htdocs/langs/ru_RU/errors.lang +++ b/htdocs/langs/ru_RU/errors.lang @@ -54,7 +54,6 @@ ErrorCantSaveADoneUserWithZeroPercentage=Не удается сохранить ErrorRefAlreadyExists=Ссылки, используемые для создания, уже существует. ErrorPleaseTypeBankTransactionReportName=Введите название банка, где получение сделки (в формате ГГГГММ или ГГГГММДД) ErrorRecordHasChildren=Не удается удалить записи, поскольку он имеет некоторые хлеб. -MenuManager=Меню менеджера ErrorUrlNotValid=Адрес веб-сайта, является неверным Error=Ошибка Errors=Ошибки diff --git a/htdocs/langs/sl_SI/errors.lang b/htdocs/langs/sl_SI/errors.lang index 1a8aa88e71d..304eccafb7f 100644 --- a/htdocs/langs/sl_SI/errors.lang +++ b/htdocs/langs/sl_SI/errors.lang @@ -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 diff --git a/htdocs/langs/sv_SE/errors.lang b/htdocs/langs/sv_SE/errors.lang index c5bed69914b..c2c1a4de446 100644 --- a/htdocs/langs/sv_SE/errors.lang +++ b/htdocs/langs/sv_SE/errors.lang @@ -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 diff --git a/htdocs/langs/tr_TR/errors.lang b/htdocs/langs/tr_TR/errors.lang index 5fa48260db6..51328ab6ffe 100644 --- a/htdocs/langs/tr_TR/errors.lang +++ b/htdocs/langs/tr_TR/errors.lang @@ -5,7 +5,6 @@ */ // Reference language: en_US -> TR – errors CHARSET=UTF-8 -MenuManager=Menü yöneticisi # Hatalar Error=Hata diff --git a/htdocs/langs/zh_CN/errors.lang b/htdocs/langs/zh_CN/errors.lang index 4ad29980eb9..43acc3de5b8 100644 --- a/htdocs/langs/zh_CN/errors.lang +++ b/htdocs/langs/zh_CN/errors.lang @@ -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是错误的 diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3ff5c7bd8be..314a8b6d584 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -797,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; } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 6a78003324d..263a28fad30 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -473,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(); @@ -546,12 +548,23 @@ 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"))); diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php old mode 100644 new mode 100755 index 7fdf7831d59..af564b6f67b --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -1,6 +1,6 @@ #!/usr/bin/php * Copyright (C) 2006-2008 Laurent Destailleur * diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php old mode 100644 new mode 100755 index b54d3f1a33e..7e7d55fbf90 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -1,6 +1,6 @@ #!/usr/bin/php * Copyright (C) 2006-2010 Laurent Destailleur * @@ -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�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) != ''); } diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php old mode 100644 new mode 100755 index 0deafa514e9..32086f51752 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -1,6 +1,6 @@ #!/usr/bin/php * Copyright (C) 2006 Laurent Destailleur * diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php old mode 100644 new mode 100755 index 044b3f133ac..a4931d91d32 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -1,6 +1,6 @@ #!/usr/bin/php * Copyright (C) 2006 Laurent Destailleur * diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php new file mode 100755 index 00000000000..e94c2cd618a --- /dev/null +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -0,0 +1,282 @@ +#!/usr/bin/php + + * Copyright (C) 2006-2012 Laurent Destailleur + * + * 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 . + */ + +/** + * \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) != ''); +} + +?> From 773b082b13c9fa40609a7d69fa01108c87af13b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2012 21:28:24 +0200 Subject: [PATCH 10/11] Fix: Restore private: The public method to use by external code is addExtraField. --- htdocs/core/class/extrafields.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 37ca8710aeb..ded8183ec70 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -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') @@ -118,7 +119,7 @@ class ExtraFields * @param int $unique Is field unique or not * @return int <=0 if KO, >0 if OK */ - function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0) + private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0) { $table=''; if ($elementtype == 'member') $table='adherent_extrafields'; From 65594d88a0255769f4609fe3268b8baeae0f93ce Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 24 Oct 2012 22:50:19 +0200 Subject: [PATCH 11/11] Fix: strict mode --- htdocs/admin/modules.php | 4 ++-- htdocs/core/boxes/box_members.php | 4 ++-- htdocs/core/modules/modAccounting.class.php | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 917c6cebbef..b8e02fcca21 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * * 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( diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index ab41c8dbacc..c931b6f7d34 100755 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * 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"; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 5fbc95f8dc5..dd09fd2756a 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin * * 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++; }