Skip to content

Commit

Permalink
Debug use bad amount for the subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 17, 2024
1 parent 91eb9fc commit 7959f4b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions htdocs/public/payment/newpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1522,9 +1522,8 @@

$member = new Adherent($db);
$adht = new AdherentType($db);
$subscription = new Subscription($db);

$result = $member->fetch('', $ref);
$result = $member->fetch('', $ref, 0, '', true, true); // This fetch also ->last_subscription_amount
if ($result <= 0) {
$mesg = $member->error;
$error++;
Expand All @@ -1536,7 +1535,7 @@
$object = $member;

if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = $subscription->total_ttc;
$amount = $member->last_subscription_amount;
if (GETPOST("amount", 'alpha')) {
$amount = price2num(GETPOST("amount", 'alpha'), 'MT', 2);
}
Expand Down Expand Up @@ -1673,6 +1672,10 @@
if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
$amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
}
// - If an amount was posted from the form (for example from page with types of membership)
if ($caneditamount && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) {
$amount = GETPOSTFLOAT('amount', 'MT');
}
// - If a new amount was posted from the form
if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) {
$amount = GETPOSTFLOAT('newamount', 'MT');
Expand Down

0 comments on commit 7959f4b

Please sign in to comment.