Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Regis Houssin 2012-10-24 22:50:44 +02:00
commit 23707e2346
44 changed files with 417 additions and 123 deletions

View File

@ -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 '</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("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.'">';
@ -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")));

View File

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

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

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

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

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

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

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

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

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

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

View File

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

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) != '');
}
?>