Fix public new member form use adh type amount

This commit is contained in:
daraelmin 2021-05-07 00:13:49 +02:00 committed by GitHub
parent e791f9b863
commit 82bf9cd3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
});
});
});
</script>';
@ -561,7 +565,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
$isempty = 0;
}
print '<tr><td class="titlefield">'.$langs->trans("Type").' <FONT COLOR="red">*</FONT></td><td>';
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 '</td></tr>'."\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 '<tr><td>'.$langs->trans("Subscription").'</td><td class="nowrap">';
if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {