From fa6602fed2fa1339a5f39af9cf50728931f29447 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 23 Apr 2024 20:20:12 +0530 Subject: [PATCH] Fixed: Getting a fatal error if the admin reduces(in negative amount) more from the booking than the paid amount. --- controllers/admin/AdminOrdersController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..45067c47a 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -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,