From 08bd331d0bcaf3e19e7488be885d9f3cc2d37600 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2026 14:32:55 +0200 Subject: [PATCH] FIX option MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE --- htdocs/adherents/admin/website.php | 7 +++++-- htdocs/langs/en_US/members.lang | 5 +++-- htdocs/public/members/new.php | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 57d9950b901..a370280973c 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -107,6 +107,9 @@ if ($action == 'update') { } else { $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCEMORPHY", $forcemorphy, 'chaine', 0, '', $conf->entity); } + if (GETPOSTISSET('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE')) { + $res = dolibarr_set_const($db, "MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", GETPOST('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE') == 'yes' ? 1 : 0, 'chaine', 0, '', $conf->entity); + } if (!($res > 0)) { $error++; @@ -321,9 +324,9 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { // Search a member after member creation form print ''; - print $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); + print $form->textwithpicto($langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"), $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc")); print ''; - print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); // Reverse the logic "hide -> show" for retrocompatibility + print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE")); // Reverse the logic "hide -> show" for retrocompatibility print "\n"; print ''; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index da563c950f1..9416b02272c 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -262,5 +262,6 @@ ConfirmMergeMembers=Are you sure you want to merge the chosen member with the cu ErrorMembersMerge=There was an error when merging the members. Please check the log. Changes have been reverted. ConfirmCreateMember=Confirm create member CorrespondingMemberFound=Corresponding member found -CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? -MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Searches for a member matching the information entered in the public member creation form. If a member is found, redirects the user to the membership payment form +CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? (if not nothing will be recorded) +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Suggest to just record the subscription (without creating a new member) if an existing member is found +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc=A search is done on login, company name + email (for legal entity), or full name + email (for individual). If a member is already found, the form suggest to record a renewal of subscription. diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 16a47afe396..a184f2a035a 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -228,9 +228,13 @@ if ($reshook < 0) { } // Verify if we can find member + if (empty($reshook) && getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE") && $action == 'add' && !GETPOSTISSET("nofetchmember")) { // Test on permission not required here $memberfound = false; + if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') && GETPOSTISSET('login')) { + // Note that this allow to guess anonymous ID already used. But this is not a problem as it is an anonymous pseudonym. + // If we try to new account and option MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE was off, we also get the same error. $sql = "SELECT rowid as id"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql .= " WHERE a.login = '".$db->escape(GETPOST('login'))."'"; @@ -868,14 +872,14 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } // Firstname - print ''.$langs->trans("Firstname").''."\n"; + print ''.$langs->trans("Firstname").''."\n"; // Lastname - print ''.$langs->trans("Lastname").''."\n"; + print ''.$langs->trans("Lastname").''."\n"; // EMail print ''.(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').$langs->trans("EMail").(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').''; - print ''.img_picto('', 'object_email').' '."\n"; + print ''.img_picto('', 'object_email').' '."\n"; // Login if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {