diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index 233bc483d06..9bf8cfdb18e 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -543,6 +543,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 +565,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 +708,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 +718,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)) {
|