diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook index 30f78b84..6a5009db 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook @@ -158,7 +158,9 @@ Le nom de l'attribut listant les mails possibles de l'utilisateur. Par défaut, la première valeur de l'attribut sera - utilisée comme adresse mail destinatrice. + utilisée comme adresse mail destinatrice. Cet attribut peut également + être un tableau de plusieurs noms d'attributs. Dans ce cas, la première + valeur correcte sera retenue. Si canEdit est activé, l'utilisateur pourra choisir l'adresse mail destinatrice parmi la liste des valeurs de l'attribut. diff --git a/public_html/includes/class/class.LSformElement_password.php b/public_html/includes/class/class.LSformElement_password.php index 6fbd92c4..8f1f4892 100644 --- a/public_html/includes/class/class.LSformElement_password.php +++ b/public_html/includes/class/class.LSformElement_password.php @@ -196,13 +196,28 @@ class LSformElement_password extends LSformElement { $mail = (String)$this -> sendMail['mail']; Lsdebug($mail); if ($mail=="") { - $mail_attr = $this -> attr_html -> attribute -> ldapObject -> attrs[$this -> params['html_options']['mail']['mail_attr']]; - if ($mail_attr instanceOf LSattribute) { - $mail = $mail_attr -> getValue(); - $mail=$mail[0]; + $mail_attrs = $this -> params['html_options']['mail']['mail_attr']; + if (!is_array($mail_attrs)) { + $mail_attrs=array(); } - else { - LSdebug("L'attribut $mail_attr pour l'envoie du nouveau mot de passe n'existe pas."); + foreach($mail_attrs as $attr) { + $mail_attr = $this -> attr_html -> attribute -> ldapObject -> attrs[$attr]; + if ($mail_attr instanceOf LSattribute) { + $mail = $mail_attr -> getValue(); + if (!empty($mail) && checkEmail($mail[0],NULL,true)) { + $mail=$mail[0]; + break; + } + else { + $mail=""; + } + } + else { + LSdebug("L'attribut $mail_attr pour l'envoie du nouveau mot de passe n'existe pas."); + } + } + if ($mail=="") { + LSerror :: addErrorCode('LSformElement_password_01'); return; } } @@ -229,7 +244,7 @@ class LSformElement_password extends LSformElement { } } else { - LSdebug('Adresse mail incorrect : '.$mail); + LSerror :: addErrorCode('LSformElement_password_02',$mail); return; } } @@ -300,5 +315,15 @@ class LSformElement_password extends LSformElement { } } - + +/* + * Error Codes + */ +LSerror :: defineError('LSformElement_password_01', +_("LSformElement_password : No contact mail available to send password.") +); +LSerror :: defineError('LSformElement_password_02', +_("LSformElement_password : Contact mail invalid (%{mail}). Can't send password.") +); + ?> diff --git a/public_html/includes/js/LSformElement_password_field.js b/public_html/includes/js/LSformElement_password_field.js index c447bfbd..59f46a51 100644 --- a/public_html/includes/js/LSformElement_password_field.js +++ b/public_html/includes/js/LSformElement_password_field.js @@ -111,10 +111,18 @@ var LSformElement_password_field = new Class({ this.LSmail.addEvent('valid',this.onLSmailValid.bind(this)); } - var mail = varLSform.getValue(this.params.mail['mail_attr']); + var mails = [] + if ($type(this.params.mail['mail_attr'])=='array') { + this.params.mail['mail_attr'].each(function(a) { + this.append(varLSform.getValue(a)); + },mails); + } + else { + mails.append(varLSform.getValue(this.params.mail['mail_attr'])); + } this.LSmail_open = 1; - this.LSmail.setMails(mail); + this.LSmail.setMails(mails); this.LSmail.setSubject(this.params.mail['subject']); this.LSmail.setMsg(this.params.mail['msg']); this.LSmail.open(this.editMailBtn); diff --git a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo index 39dc4f8b..c7d9afb1 100644 Binary files a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo and b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo differ diff --git a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po index d53f77eb..9a6e4568 100644 --- a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po +++ b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: LdapSaisie\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-03 12:19+0200\n" -"PO-Revision-Date: 2012-10-03 12:21+0100\n" +"POT-Creation-Date: 2012-12-18 11:55+0100\n" +"PO-Revision-Date: 2012-12-18 11:56+0100\n" "Last-Translator: Benjamin Renard \n" "Language-Team: LdapSaisie \n" "Language: \n" @@ -806,43 +806,43 @@ msgstr "Oui" msgid "No" msgstr "Non" -#: includes/class/class.LSattribute.php:260 +#: includes/class/class.LSattribute.php:267 msgid "The value of field %{label} is invalid." msgstr "La valeur du champ %{label} est incorrecte." -#: includes/class/class.LSattribute.php:724 +#: includes/class/class.LSattribute.php:731 msgid "LSattribute : Attribute %{attr} : LDAP or HTML types unknow (LDAP = %{ldap} & HTML = %{html})." msgstr "LSattribute : Attribut %{attr} : Les types LDAP ou HTML sont inconnus (LDAP = %{ldap} & HTML = %{html})." -#: includes/class/class.LSattribute.php:727 +#: includes/class/class.LSattribute.php:734 msgid "LSattribute : The function %{func} to display the attribute %{attr} is unknow." msgstr "LSattribute : La fonction %{func} pour afficher l'attribut %{attr} est inconnue." -#: includes/class/class.LSattribute.php:730 +#: includes/class/class.LSattribute.php:737 msgid "LSattribute : The rule %{rule} to validate the attribute %{attr} is unknow." msgstr "LSattribute : La règle %{rule} de validation de l'attribut %{attr} n'existe pas." -#: includes/class/class.LSattribute.php:733 +#: includes/class/class.LSattribute.php:740 msgid "LSattribute : Configuration data to verify the attribute %{attr} are incorrect." msgstr "LSattribute : Les données de configuration pour vérifier l'attribut %{attr} sont incorrecte." -#: includes/class/class.LSattribute.php:736 +#: includes/class/class.LSattribute.php:743 msgid "LSattribute : The function %{func} to save the attribute %{attr} is unknow." msgstr "LSattribute : La fonction %{func} pour sauvegarder l'attribut %{attr} est inconnue." -#: includes/class/class.LSattribute.php:739 +#: includes/class/class.LSattribute.php:746 msgid "LSattribute : The value of the attribute %{attr} can't be generated." msgstr "LSattribute : La valeur de l'attribut %{attr} ne peut être générée." -#: includes/class/class.LSattribute.php:742 +#: includes/class/class.LSattribute.php:749 msgid "LSattribute : Generation of the attribute %{attr} failed." msgstr "LSattribute : La génération de l'attribut %{attr} a échouée." -#: includes/class/class.LSattribute.php:745 +#: includes/class/class.LSattribute.php:752 msgid "LSattribute : Generation of the attribute %{attr} did not return a correct value." msgstr "LSattribute : La génération de l'attribut %{attr} n'a pas retournée de valeur correcte." -#: includes/class/class.LSattribute.php:748 +#: includes/class/class.LSattribute.php:755 msgid "LSattribute : The attr_%{type} of the attribute %{name} is not yet defined." msgstr "LSattribute : L'objet attr_%{type} de l'attribut %{name} n'est pas encore défini." @@ -958,10 +958,18 @@ msgstr "Le mot de passe ne sera pas envoyé en cas de modification. Cliquer pour msgid "Modify the mail sent to notice the user" msgstr "Modifier mail de notification de l'utilisateur" -#: includes/class/class.LSformElement_password.php:228 +#: includes/class/class.LSformElement_password.php:243 msgid "Notice mail sent." msgstr "Le mail de notification a été envoyé." +#: includes/class/class.LSformElement_password.php:323 +msgid "LSformElement_password : No contact mail available to send password." +msgstr "LSformElement_password : Aucun mail de contact disponible pour envoyer le mot de passe." + +#: includes/class/class.LSformElement_password.php:326 +msgid "LSformElement_password : Contact mail invalid (%{mail}). Can't send password." +msgstr "LSformElement_password : Mail de contact invalide (%{mail}). Impossible d'envoyer le mot de passe." + #: includes/class/class.LSformElement_date.php:159 msgid "Now." msgstr "Maintenant." @@ -998,21 +1006,21 @@ msgstr "Discuter avec cette personne." msgid "The custom action %{customAction} have been successfully execute on %{objectname}." msgstr "L'action personnalisée %{customAction} a été correctement exécutée sur %{objectname}." -#: view.php:87 +#: view.php:88 msgid "My account" msgstr "Mon compte" -#: view.php:117 +#: view.php:118 #: select.php:60 msgid "Search" msgstr "Rechercher" -#: view.php:118 +#: view.php:119 #: select.php:61 msgid "Approximative search" msgstr "Recherche approximative" -#: view.php:119 +#: view.php:120 #: select.php:62 msgid "Recursive search" msgstr "Recherche récursive" diff --git a/public_html/lang/ldapsaisie.pot b/public_html/lang/ldapsaisie.pot index 66e843b9..df317a52 100644 --- a/public_html/lang/ldapsaisie.pot +++ b/public_html/lang/ldapsaisie.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-03 12:19+0200\n" +"POT-Creation-Date: 2012-12-18 11:55+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -899,53 +899,53 @@ msgstr "" msgid "No" msgstr "" -#: includes/class/class.LSattribute.php:260 +#: includes/class/class.LSattribute.php:267 msgid "The value of field %{label} is invalid." msgstr "" -#: includes/class/class.LSattribute.php:724 +#: includes/class/class.LSattribute.php:731 msgid "" "LSattribute : Attribute %{attr} : LDAP or HTML types unknow (LDAP = %{ldap} " "& HTML = %{html})." msgstr "" -#: includes/class/class.LSattribute.php:727 +#: includes/class/class.LSattribute.php:734 msgid "" "LSattribute : The function %{func} to display the attribute %{attr} is " "unknow." msgstr "" -#: includes/class/class.LSattribute.php:730 +#: includes/class/class.LSattribute.php:737 msgid "" "LSattribute : The rule %{rule} to validate the attribute %{attr} is unknow." msgstr "" -#: includes/class/class.LSattribute.php:733 +#: includes/class/class.LSattribute.php:740 msgid "" "LSattribute : Configuration data to verify the attribute %{attr} are " "incorrect." msgstr "" -#: includes/class/class.LSattribute.php:736 +#: includes/class/class.LSattribute.php:743 msgid "" "LSattribute : The function %{func} to save the attribute %{attr} is unknow." msgstr "" -#: includes/class/class.LSattribute.php:739 +#: includes/class/class.LSattribute.php:746 msgid "LSattribute : The value of the attribute %{attr} can't be generated." msgstr "" -#: includes/class/class.LSattribute.php:742 +#: includes/class/class.LSattribute.php:749 msgid "LSattribute : Generation of the attribute %{attr} failed." msgstr "" -#: includes/class/class.LSattribute.php:745 +#: includes/class/class.LSattribute.php:752 msgid "" "LSattribute : Generation of the attribute %{attr} did not return a correct " "value." msgstr "" -#: includes/class/class.LSattribute.php:748 +#: includes/class/class.LSattribute.php:755 msgid "" "LSattribute : The attr_%{type} of the attribute %{name} is not yet defined." msgstr "" @@ -1076,10 +1076,19 @@ msgstr "" msgid "Modify the mail sent to notice the user" msgstr "" -#: includes/class/class.LSformElement_password.php:228 +#: includes/class/class.LSformElement_password.php:243 msgid "Notice mail sent." msgstr "" +#: includes/class/class.LSformElement_password.php:323 +msgid "LSformElement_password : No contact mail available to send password." +msgstr "" + +#: includes/class/class.LSformElement_password.php:326 +msgid "" +"LSformElement_password : Contact mail invalid (%{mail}). Can't send password." +msgstr "" + #: includes/class/class.LSformElement_date.php:159 msgid "Now." msgstr "" @@ -1118,19 +1127,19 @@ msgid "" "%{objectname}." msgstr "" -#: view.php:87 +#: view.php:88 msgid "My account" msgstr "" -#: view.php:117 select.php:60 +#: view.php:118 select.php:60 msgid "Search" msgstr "" -#: view.php:118 select.php:61 +#: view.php:119 select.php:61 msgid "Approximative search" msgstr "" -#: view.php:119 select.php:62 +#: view.php:120 select.php:62 msgid "Recursive search" msgstr ""