diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8659b3ca8bd..10c929b78e2 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1444,20 +1444,18 @@ if ($source == 'member' || $source == 'membersubscription') { print ''.$langs->trans("LastMemberType"); print ''.dol_escape_htmltag($member->type); print "\n"; - } - if (!empty($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE)) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; + $adht = new AdherentType($db); // Amount by member type - $amountbytype = array(); // TODO Read the amount of subscription into table of types + $amountbytype = $adht->amount_by_type(1); // Set the member type $member->typeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid); // If we change the type of membership, we set also label of new type $member->type = dol_getIdFromCode($db, $member->typeid, 'adherent_type', 'rowid', 'libelle'); // Set amount for the subscription - $amount = (!empty($member->last_subscription_amount)) ? $member->last_subscription_amount : $amountbytype[$member->typeid]; + $amount = (!empty($amountbytype[$member->typeid])) ? $amountbytype[$member->typeid] : $member->last_subscription_amount; // list member type - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; - $adht = new AdherentType($db); if ( !$action) { $form = new Form($db); // so we can call method selectarray print ''.$langs->trans("NewSubscription");