Merge pull request #995 from sumitwebkul/gli-1855

Fixed: Getting a fatal error if the admin reduces(in negative amount) more from the booking than the paid amount.
This commit is contained in:
Rohit Jain
2024-05-21 20:37:40 +05:30
committed by GitHub

View File

@@ -1623,6 +1623,9 @@ class AdminOrdersControllerCore extends AdminController
$this->errors[] = Tools::displayError('The date is invalid');
} elseif (!Validate::isUnsignedInt($payment_type)) {
$this->errors[] = Tools::displayError('Payment source is invalid');
// Amount cannot be less than paid amount by guest in negative price
} elseif ($amount < 0 && ($order->total_paid_real + $amount) < 0) {
$this->errors[] = sprintf(Tools::displayError('Amount cannot be less than -%s'), Tools::displayPrice($order->total_paid_real, new Currency($order->id_currency)));
} else {
if (!$order->addOrderPayment(
$amount,