|
@@ -871,7 +871,7 @@ if (!$source) {
|
|
|
}
|
|
|
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
- print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
|
|
|
} else {
|
|
|
print '<b>'.price($amount).'</b>';
|
|
@@ -914,9 +914,13 @@ if ($source == 'order') {
|
|
|
|
|
|
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
|
|
|
$amount = $order->total_ttc;
|
|
|
+<<<<<<< HEAD
|
|
|
if (GETPOST("amount", 'int')) {
|
|
|
$amount = GETPOST("amount", 'int');
|
|
|
}
|
|
|
+=======
|
|
|
+ if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
$amount = price2num($amount);
|
|
|
}
|
|
|
|
|
@@ -965,8 +969,14 @@ if ($source == 'order') {
|
|
|
print ' ('.$langs->trans("ToComplete").')';
|
|
|
}
|
|
|
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
|
|
|
+<<<<<<< HEAD
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
+=======
|
|
|
+ if (empty($amount) || !is_numeric($amount))
|
|
|
+ {
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
|
|
|
} else {
|
|
|
print '<b>'.price($amount).'</b>';
|
|
@@ -1038,9 +1048,13 @@ if ($source == 'invoice') {
|
|
|
|
|
|
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
|
|
|
$amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed()));
|
|
|
+<<<<<<< HEAD
|
|
|
if (GETPOST("amount", 'int')) {
|
|
|
$amount = GETPOST("amount", 'int');
|
|
|
}
|
|
|
+=======
|
|
|
+ if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha');
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
$amount = price2num($amount);
|
|
|
}
|
|
|
|
|
@@ -1092,8 +1106,14 @@ if ($source == 'invoice') {
|
|
|
if ($object->type == $object::TYPE_CREDIT_NOTE) {
|
|
|
print '<b>'.$langs->trans("CreditNote").'</b>';
|
|
|
} elseif (empty($object->paye)) {
|
|
|
+<<<<<<< HEAD
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
+=======
|
|
|
+ if (empty($amount) || !is_numeric($amount))
|
|
|
+ {
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
|
|
|
} else {
|
|
|
print '<b>'.price($amount).'</b>';
|
|
@@ -1204,9 +1224,13 @@ if ($source == 'contractline') {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
if (GETPOST("amount", 'int')) {
|
|
|
$amount = GETPOST("amount", 'int');
|
|
|
}
|
|
|
+=======
|
|
|
+ if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
$amount = price2num($amount);
|
|
|
}
|
|
|
|
|
@@ -1296,8 +1320,14 @@ if ($source == 'contractline') {
|
|
|
print ' ('.$langs->trans("ToComplete").')';
|
|
|
}
|
|
|
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
|
|
|
+<<<<<<< HEAD
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
+=======
|
|
|
+ if (empty($amount) || !is_numeric($amount))
|
|
|
+ {
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
|
|
|
} else {
|
|
|
print '<b>'.price($amount).'</b>';
|
|
@@ -1370,10 +1400,15 @@ if ($source == 'membersubscription') {
|
|
|
|
|
|
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
|
|
|
$amount = $subscription->total_ttc;
|
|
|
+<<<<<<< HEAD
|
|
|
if (GETPOST("amount", 'int')) {
|
|
|
$amount = GETPOST("amount", 'int');
|
|
|
}
|
|
|
$amount = price2num($amount);
|
|
|
+=======
|
|
|
+ if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
|
|
|
+ $amount = price2num($amount, 'MT');
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
}
|
|
|
|
|
|
if (GETPOST('fulltag', 'alpha')) {
|
|
@@ -1470,15 +1505,30 @@ if ($source == 'membersubscription') {
|
|
|
}
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
|
|
|
+<<<<<<< HEAD
|
|
|
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
|
|
|
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
}
|
|
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
|
|
|
+=======
|
|
|
+ if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
+ if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
|
|
|
+ print '<input class="flat maxwidth75" type="text" name="newamountbis" value="'.$valtoshow.'" disabled>';
|
|
|
+ print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
|
|
|
+ } else {
|
|
|
+ print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
|
|
|
+ }
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
} else {
|
|
|
$valtoshow = $amount;
|
|
|
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
|
|
|
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
+<<<<<<< HEAD
|
|
|
+=======
|
|
|
+ $amount = $valtoshow;
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
}
|
|
|
print '<b>'.price($valtoshow).'</b>';
|
|
|
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
|
|
@@ -1548,9 +1598,13 @@ if ($source == 'donation') {
|
|
|
|
|
|
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
|
|
|
$amount = $subscription->total_ttc;
|
|
|
+<<<<<<< HEAD
|
|
|
if (GETPOST("amount", 'int')) {
|
|
|
$amount = GETPOST("amount", 'int');
|
|
|
}
|
|
|
+=======
|
|
|
+ if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha');
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
$amount = price2num($amount);
|
|
|
}
|
|
|
|
|
@@ -1624,15 +1678,24 @@ if ($source == 'donation') {
|
|
|
}
|
|
|
if (empty($amount) || !is_numeric($amount)) {
|
|
|
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
|
|
|
+<<<<<<< HEAD
|
|
|
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
|
|
|
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
}
|
|
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">';
|
|
|
+=======
|
|
|
+ if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
+ print '<input type="hidden" name="amount" value="'.price2num(GETPOST("amount", 'alpha'), 'MT').'">';
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
|
|
|
} else {
|
|
|
$valtoshow = $amount;
|
|
|
if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) {
|
|
|
$valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow);
|
|
|
+<<<<<<< HEAD
|
|
|
+=======
|
|
|
+ $amount = $valtoshow;
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
}
|
|
|
print '<b>'.price($valtoshow).'</b>';
|
|
|
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
|
|
@@ -2118,6 +2181,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
|
|
|
console.log("We click on buttontopay");
|
|
|
event.preventDefault();
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
if (cardholderName.value == '')
|
|
|
{
|
|
|
console.log("Field Card holder is empty");
|
|
@@ -2176,6 +2240,59 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+=======
|
|
|
+ if (cardholderName.value == '')
|
|
|
+ {
|
|
|
+ console.log("Field Card holder is empty");
|
|
|
+ var displayError = document.getElementById('card-errors');
|
|
|
+ displayError.textContent = '<?php print dol_escape_js($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardOwner"))); ?>';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /* Disable button to pay and show hourglass cursor */
|
|
|
+ jQuery('#hourglasstopay').show();
|
|
|
+ jQuery('#buttontopay').hide();
|
|
|
+
|
|
|
+ stripe.handleCardPayment(
|
|
|
+ clientSecret, cardElement, {
|
|
|
+ payment_method_data: {
|
|
|
+ billing_details: {
|
|
|
+ name: cardholderName.value
|
|
|
+ <?php if (GETPOST('email', 'alpha') || (is_object($object) && is_object($object->thirdparty) && !empty($object->thirdparty->email))) { ?>, email: '<?php echo dol_escape_js(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $object->thirdparty->email); ?>'<?php } ?>
|
|
|
+ <?php if (is_object($object) && is_object($object->thirdparty) && !empty($object->thirdparty->phone)) { ?>, phone: '<?php echo dol_escape_js($object->thirdparty->phone); ?>'<?php } ?>
|
|
|
+ <?php if (is_object($object) && is_object($object->thirdparty)) { ?>, address: {
|
|
|
+ city: '<?php echo dol_escape_js($object->thirdparty->town); ?>',
|
|
|
+ <?php if ($object->thirdparty->country_code) { ?>country: '<?php echo dol_escape_js($object->thirdparty->country_code); ?>',<?php } ?>
|
|
|
+ line1: '<?php echo dol_escape_js(preg_replace('/\s\s+/', ' ', $object->thirdparty->address)); ?>',
|
|
|
+ postal_code: '<?php echo dol_escape_js($object->thirdparty->zip); ?>'
|
|
|
+ }
|
|
|
+ <?php } ?>
|
|
|
+ }
|
|
|
+ },
|
|
|
+ save_payment_method: <?php if ($stripecu) { print 'true'; } else { print 'false'; } ?> /* true when a customer was provided when creating payment intent. true ask to save the card */
|
|
|
+ }
|
|
|
+ ).then(function(result) {
|
|
|
+ console.log(result);
|
|
|
+ if (result.error) {
|
|
|
+ console.log("Error on result of handleCardPayment");
|
|
|
+ jQuery('#buttontopay').show();
|
|
|
+ jQuery('#hourglasstopay').hide();
|
|
|
+ // Inform the user if there was an error
|
|
|
+ var errorElement = document.getElementById('card-errors');
|
|
|
+ errorElement.textContent = result.error.message;
|
|
|
+ } else {
|
|
|
+ // The payment has succeeded. Display a success message.
|
|
|
+ console.log("No error on result of handleCardPayment, so we submit the form");
|
|
|
+ // Submit the form
|
|
|
+ jQuery('#buttontopay').hide();
|
|
|
+ jQuery('#hourglasstopay').show();
|
|
|
+ // Send form (action=charge that will do nothing)
|
|
|
+ jQuery('#payment-form').submit();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
|
|
|
|
|
<?php
|
|
|
} else // Old method (not SCA ready)
|