From 04bca1cc1ffcd5441125a0ffdd0fff2c12392290 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Apr 2023 14:51:20 +0200 Subject: [PATCH] Fix when membership type option "Any amount" when Yes. --- htdocs/adherents/card.php | 4 ++-- htdocs/langs/en_US/withdrawals.lang | 2 +- htdocs/public/payment/newpayment.php | 36 ++++++++++++++++------------ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4bc3e3e55e4..5816c5c4ea1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1403,7 +1403,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print dol_get_fiche_end(); - print $form->buttonsSaveCancel("Save", ''); + print $form->buttonsSaveCancel("Save", 'Cancel'); print ''; } @@ -2041,7 +2041,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($useonlinepayment) { print '
'; if (empty($amount)) { // Take the maximum amount among what the member is supposed to pay / has paid in the past - $amount = price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount)); + $amount = max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount); } if (empty($amount)) { $amount = 0; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 7b8d4ae3f26..6c2d552dd61 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -122,7 +122,7 @@ WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty am SepaMandate=SEPA Direct Debit Mandate SepaMandateShort=SEPA Mandate PleaseReturnMandate=Please return this mandate form by email to %s or by mail to -SEPALegalText=By signing this mandate form, you authorize (A) %s and its payment service provider to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank. +SEPALegalText=By signing this mandate form, you authorize (A) %s and its payment service provider to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank. You agree to receive notifications about future charges up to 2 days before they occur. CreditorIdentifier=Creditor Identifier CreditorName=Creditor Name SEPAFillForm=(B) Please complete all the fields marked * diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index f6b5b03aac2..cd4dbb468b6 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1021,7 +1021,7 @@ if (!$source) { } -// Payment on sales order +// Payment on a Sale Order if ($source == 'order') { $found = true; $langs->load("orders"); @@ -1150,7 +1150,7 @@ if ($source == 'order') { } -// Payment on customer invoice +// Payment on a Customer Invoice if ($source == 'invoice') { $found = true; $langs->load("bills"); @@ -1282,7 +1282,7 @@ if ($source == 'invoice') { print ''."\n"; } -// Payment on contract line +// Payment on a Contract line if ($source == 'contractline') { $found = true; $langs->load("contracts"); @@ -1478,7 +1478,7 @@ if ($source == 'contractline') { print ''."\n"; } -// Payment on member subscription +// Payment on a Member subscription if ($source == 'member' || $source == 'membersubscription') { $newsource = 'member'; @@ -1634,15 +1634,23 @@ if ($source == 'member' || $source == 'membersubscription') { if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $amount) { $amount = max(0, $conf->global->MEMBER_MIN_AMOUNT, $amount); } - print ''.price($amount, 1, $langs, 1, -1, -1, $currency).''; // Price with currency $caneditamount = $adht->caneditamount; - $minimumamount = empty($conf->global->MEMBER_MIN_AMOUNT)? $adht->amount : max($conf->global->MEMBER_MIN_AMOUNT, $adht->amount > $amount); - if (!$caneditamount && $minimumamount > $amount) { - print ' '. $langs->trans("AmountIsLowerToMinimumNotice", price($adht->amount, 1, $langs, 1, -1, -1, $currency)); - } + $minimumamount = empty($conf->global->MEMBER_MIN_AMOUNT)? $adht->amount : max($conf->global->MEMBER_MIN_AMOUNT, $adht->amount, $amount); + if ($caneditamount && $action != 'dopayment') { + if (GETPOSTISSET('newamount')) { + print ''; + } else { + print ''; + } + } else { + print ''.price($amount, 1, $langs, 1, -1, -1, $currency).''; // Price with currency + if ($minimumamount > $amount) { + print ' '. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)); + } + print ''; + } print ''; - print ''; print ''; print ''."\n"; @@ -2203,7 +2211,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme //print '
'; - print ''."\n"; + print ''."\n"; print '
'."\n"; print ''."\n"; @@ -2251,11 +2259,9 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } // Note: - // $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1 = use intent (default value) - // $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 = use payment + // $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1 = use intent object (default value, suggest card payment mode only) + // $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 = use payment object (suggest both card payment mode but also sepa, ...) - //if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) || !empty($paymentintent)) - //{ print '
';