diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 233bc483d06..71446b58779 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2021 Waël Almoman * * 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 @@ -543,6 +544,10 @@ jQuery(document).ready(function () { document.newmember.action.value="create"; document.newmember.submit(); }); + jQuery("#typeid").change(function() { + document.newmember.action.value="create"; + document.newmember.submit(); + }); }); }); '; @@ -561,7 +566,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $isempty = 0; } print ''.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print ''."\n"; } else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); @@ -704,7 +709,8 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; + $amountbytype = $adht->amountByType(1); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; @@ -713,6 +719,9 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } + + $amount = price2num($amount); + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' print ''.$langs->trans("Subscription").''; if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {