diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 8b075805186..f463a5af4f6 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -340,7 +340,9 @@ print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERE print "\n"; // Login/Pass required for members -print ''.$langs->trans("AdherentLoginRequired").''; +print ''; +print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc")); +print ''; print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1); print "\n"; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3d3de5baeb9..0bc4aeed29c 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -119,6 +119,10 @@ if ($id) { // Security check $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0); +if (!$user->hasRight('adherent', 'creer') && $action == 'edit') { + accessforbidden('Not enough permission'); +} + $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); @@ -293,7 +297,9 @@ if (empty($reshook)) { $object->lastname = trim(GETPOST("lastname", 'alphanohtml')); $object->gender = trim(GETPOST("gender", 'alphanohtml')); $object->login = trim(GETPOST("login", 'alphanohtml')); - $object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none' + if (GETPOSTISSET('pass')) { + $object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none' + } $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated $object->company = trim(GETPOST("societe", 'alphanohtml')); @@ -329,6 +335,7 @@ if (empty($reshook)) { // Get status and public property $object->statut = GETPOST("statut", 'alpha'); + $object->status = GETPOST("statut", 'alpha'); $object->public = GETPOST("public", 'alpha'); // Fill array 'array_options' with data from add form @@ -346,10 +353,19 @@ if (empty($reshook)) { } // Check if we need to also synchronize password information - $nosyncuserpass = 0; - if ($object->user_id) { // If linked to a user - if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'password')) { - $nosyncuserpass = 1; // Disable synchronizing + $nosyncuserpass = 1; // no by default + if (GETPOSTISSET('pass')) { + if ($object->user_id) { // If member is linked to a user + $nosyncuserpass = 0; // We may try to sync password + if ($user->id == $object->user_id) { + if (!$user->hasRight('user', 'self', 'password')) { + $nosyncuserpass = 1; // Disable synchronizing + } + } else { + if (!$user->hasRight('user', 'user', 'password')) { + $nosyncuserpass = 1; // Disable synchronizing + } + } } } @@ -568,7 +584,7 @@ if (empty($reshook)) { if (!$error) { $db->begin(); - // Email about right and login does not exist + // Create the member $result = $object->create($user); if ($result > 0) { // Foundation categories @@ -576,13 +592,15 @@ if (empty($reshook)) { $object->setCategories($memcats); $db->commit(); + $rowid = $object->id; $id = $object->id; $backtopage = preg_replace('/__ID__/', $id, $backtopage); } else { - $error++; $db->rollback(); + + $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -1215,7 +1233,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").''; } // Type diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f1341c85ed2..a0e2622c746 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -632,7 +632,7 @@ class Form * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string Code html du tooltip (texte+picto) - * @see textwithpicto() Use thisfunction if you can. + * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. */ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc16365497b..2f6a6e5a2be 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1508,7 +1508,8 @@ WatermarkOnDraftContractCards=Watermark on draft contracts (none if empty) MembersSetup=Members module setup MemberMainOptions=Main options MemberCodeChecker=Options for automatic generation of member codes -AdherentLoginRequired= Manage a Login for each member +AdherentLoginRequired=Manage a login/password for each member +AdherentLoginRequiredDesc=Add a value for a login and a password on the member file. If the member is linked to a user, updating the member login and password will also update the user login and password. AdherentMailRequired=Email required to create a new member MemberSendInformationByMailByDefault=Checkbox to send mail confirmation to members (validation or new subscription) is on by default MemberCreateAnExternalUserForSubscriptionValidated=Create an external user login for each new member subscription validated diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 586868e7eef..6f0f3671272 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1508,7 +1508,7 @@ WatermarkOnDraftContractCards=Filigrane sur les brouillons de contrats (aucun si MembersSetup=Configuration du module Adhérents MemberMainOptions=Options principales MemberCodeChecker=Options de génération automatique des codes des adhérents -AdherentLoginRequired= Gérer un identifiant pour chaque adhérent +AdherentLoginRequired=Gérer un identifiant pour chaque adhérent AdherentMailRequired=Email obligatoire pour créer un nouvel adhérent MemberSendInformationByMailByDefault=Case à cocher pour envoyer un email de confirmation (validation ou nouvelle cotisation) aux adhérents est à oui par défaut. MemberCreateAnExternalUserForSubscriptionValidated=Créer un utilisateur externe pour chaque nouvelle cotisation adhérent validée