Fix when membership type option "Any amount" when Yes.

This commit is contained in:
Laurent Destailleur 2023-04-24 14:51:20 +02:00
parent 155c52bc30
commit 04bca1cc1f
3 changed files with 24 additions and 18 deletions

View File

@ -1403,7 +1403,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Save", '');
print $form->buttonsSaveCancel("Save", 'Cancel');
print '</form>';
}
@ -2041,7 +2041,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($useonlinepayment) {
print '<br>';
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;

View File

@ -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 *

View File

@ -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 '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\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 '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\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 '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // 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 '<input type="text" class="width75" name="newamount" value="'.price(price2num(GETPOST('newamount'), '', 2), 1, $langs, 1, -1, -1).'">';
} else {
print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">';
}
} else {
print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
if ($minimumamount > $amount) {
print ' '. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency));
}
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print '<input type="hidden" name="amount" value="'.$amount.'">';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
print '<input type="hidden" name="currency" value="'.$currency.'">';
print '</td></tr>'."\n";
@ -2203,7 +2211,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
//print '<br>';
print '<!-- Form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.$conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION.' STRIPE_USE_NEW_CHECKOUT = '.$conf->global->STRIPE_USE_NEW_CHECKOUT.' -->'."\n";
print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.$conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION.' STRIPE_USE_NEW_CHECKOUT = '.$conf->global->STRIPE_USE_NEW_CHECKOUT.' -->'."\n";
print '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'."\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 '
<table id="dolpaymenttable" summary="Payment form" class="center centpercent">
<tbody><tr><td class="textpublicpayment">';