diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 34fe35153ca..1c032c39207 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -93,7 +93,9 @@ if ($action == 'update') { $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", $showtable ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" - $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", $showvoteallowed ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" + if (GETPOSTISSET('MEMBER_HIDE_VOTE_ALLOWED')) { + $res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", $showvoteallowed ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show" + } $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) { $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); @@ -225,6 +227,24 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print ''; print "\n"; + // Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0) + $skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE'); + print ''; + print $langs->trans("MembersShowMembershipTypesTable"); + print ''; + print $form->selectyesno("MEMBER_SHOW_TABLE", (int) !$skiptable, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility + print "\n"; + + // Show "vote allowed" setting for membership types + if (!$skiptable) { + $hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED'); + print ''; + print $langs->trans("MembersShowVotesAllowed"); + print ''; + print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", (int) !$hidevoteallowed, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility + print "\n"; + } + // Force Type $adht = new AdherentType($db); print ''; @@ -272,22 +292,6 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", getDolGlobalInt('MEMBER_COUNTERS_ARE_PUBLIC'), 1, false, 0, 1); print "\n"; - // Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0) - $skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE'); - print ''; - print $langs->trans("MembersShowMembershipTypesTable"); - print ''; - print $form->selectyesno("MEMBER_SHOW_TABLE", (int) !$skiptable, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility - print "\n"; - - // Show "vote allowed" setting for membership types - $hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED'); - print ''; - print $langs->trans("MembersShowVotesAllowed"); - print ''; - print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", (int) !$hidevoteallowed, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility - print "\n"; - // Jump to an online payment page print ''; print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index d04e3f77006..3d08bf8edea 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -696,7 +696,7 @@ class AdherentType extends CommonObject while ($i < $nump) { $obj = $this->db->fetch_object($resql); - $amountbytype[$obj->rowid] = $obj->amount; + $amountbytype[$obj->rowid] = (float) $obj->amount; $i++; } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 08639d66233..9d489f3581f 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -485,7 +485,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.yn($objp->subscription).''; } if (!empty($arrayfields['t.amount']['checked'])) { - print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; + print ''; + $amount = (is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)); + print ''.$amount.''; + if ($amount && $amount < (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")) { + print img_warning('Amount lower than minimum of '.price(getDolGlobalInt("MEMBER_MIN_AMOUNT")).' defined in setup'); + } + print ''; } if (!empty($arrayfields['t.caneditamount']['checked'])) { print ''.yn($objp->caneditamount).''; @@ -645,7 +651,11 @@ if ($rowid > 0) { // Amount print ''.$langs->trans("Amount").''; - print((is_null($object->amount) || $object->amount === '') ? '' : ''.price($object->amount).''); + $amount = ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); + print ''.$amount.''; + if ($amount && $amount < (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")) { + print ' '.img_warning('Amount lower than minimum of '.price(getDolGlobalInt("MEMBER_MIN_AMOUNT")).' defined in setup'); + } print ''; print ''.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).''; @@ -944,7 +954,6 @@ if ($rowid > 0) { $adh->firstname = $objp->firstname; $adh->datefin = $datefin; $adh->need_subscription = $objp->subscription; - $adh->statut = $objp->status; $adh->status = $objp->status; $adh->email = $objp->email; $adh->photo = $objp->photo; @@ -1089,8 +1098,9 @@ if ($rowid > 0) { print ''; print ''.$langs->trans("Amount").''; + $amount = ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); print ''; print ''; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 3a8b3bba7d7..3005c83e03e 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -27,7 +27,7 @@ MembersListNotUpToDate=List of valid members with out-of-date contribution MembersListExcluded=List of excluded members MembersListResiliated=List of terminated members MembersListQualified=List of qualified members -MembersShowMembershipTypesTable=Show a table of all available membership types (if no, show directly the registration form) +MembersShowMembershipTypesTable=Show a table to select its membership types before the registration form (if no, show directly the registration form) MembersShowVotesAllowed=Show whether votes are allowed, in the table of membership types MenuMembersToValidate=Draft members MenuMembersValidated=Validated members @@ -227,7 +227,7 @@ MembershipPaid=Membership paid for current period (until %s) YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email XMembersClosed=%s member(s) closed XExternalUserCreated=%s external user(s) created -ForceMemberNature=Force member nature (Individual or Corporation) +ForceMemberNature=Force member nature (Individual or Legal Entity) CreateDolibarrLoginDesc=The creation of a user login for members allows them to connect to the application. Depending on the authorizations granted, they will be able, for example, to consult or modify their file themselves. CreateDolibarrThirdPartyDesc=A third party is the legal entity that will be used on the invoice if you decide to generate invoice for each contribution. You will be able to create it later during the process of recording the contribution. MemberFirstname=Member firstname diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 8bbf2b9b505..4c142758c3b 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -715,7 +715,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR $listetype = $adht->liste_array(1); print img_picto('', $adht->picto, 'class="pictofixedwidth"'); if (count($listetype)) { - print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', 'minwidth200', 1); + print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', 'minwidth150 maxwidth300 widthcentpercentminusx', 1); } else { print ''.$langs->trans("NoTypeDefinedGoToSetup").''; } @@ -834,7 +834,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // Title if (getDolGlobalString('MEMBER_NEWFORM_ASK_TITLE')) { - print ''.$langs->trans('UserTitle').''; + print ''.$langs->trans('UserTitle').''; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').''."\n"; } @@ -846,7 +846,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // 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')) { @@ -859,7 +859,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print ''.$langs->trans("Gender").''; print ''; $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother")); - print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150 maxwidth300 widthcentpercentminusx', 1); print ''; // Address @@ -878,7 +878,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print img_picto('', 'country', 'class="pictofixedwidth paddingright"'); $country_id = GETPOSTINT('country_id'); if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) { - $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs); + $country_id = getCountry(getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE'), '2', $db, $langs); } if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { $country_code = dol_user_country(); @@ -892,7 +892,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } } $country_code = getCountry($country_id, '2', $db, $langs); - print $form->select_country($country_id, 'country_id'); + print $form->select_country($country_id, 'country_id', '', 0, 'minwidth150 maxwidth300 widthcentpercentminusx'); print ''; // State @@ -900,22 +900,22 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print ''.$langs->trans('State').''; if ($country_code) { print img_picto('', 'state', 'class="pictofixedwidth paddingright"'); - print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code, 'state_id', 'minwidth150 maxwidth300 widthcentpercentminusx'); } print ''; } // Pro phone print ''.$langs->trans("PhonePro").''; - print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; + print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; // Personal phone print ''.$langs->trans("PhonePerso").''; - print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; + print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; // Mobile phone print ''.$langs->trans("PhoneMobile").''; - print ''.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').''; + print ''.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').''; // Birthday print ''.$langs->trans("DateOfBirth").''; @@ -923,7 +923,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print ''."\n"; // Photo - print ''.$langs->trans("URLPhoto").''."\n"; + print ''.$langs->trans("URLPhoto").''."\n"; // Public if (getDolGlobalString('MEMBER_PUBLIC_ENABLED')) { @@ -938,8 +938,8 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // Comments print ''; - print ''.$langs->trans("Comments").''; - print ''; + print ''; + print ''; print ''."\n"; // Add specific fields used by Dolibarr foundation for example @@ -995,6 +995,11 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR $adht->fetch($typeid); $caneditamount = $adht->caneditamount; $amountbytype = $adht->amountByType(1); // Load the array of amount per type + foreach ($amountbytype as $k => $v) { + $amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); + $amountbytype[$k] = $amount; + } + $amountbytype_json = json_encode($amountbytype); $caneditamountbytype = $adht->caneditamountByType(1); // Load the array of caneditamount per type $caneditamountbytype_json = json_encode($caneditamountbytype); @@ -1053,9 +1058,10 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print '