From 195f99ff62ac1a75e38837149df3a4982a6e06fc Mon Sep 17 00:00:00 2001 From: Henning <leutz@pcsg.de> Date: Fri, 7 Feb 2025 14:42:48 +0100 Subject: [PATCH 1/2] fix: handle exception in toOrderInProcess.php In the ajax/frontend/basket/toOrderInProcess.php: - The QUI\ERP\Order\Factory class was imported. - In the event of an exception, a new order in process is created instead of just logging the error. This change should improve the user experience by preventing any disruption in the order process due to unexpected errors. --- ajax/frontend/basket/toOrderInProcess.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ajax/frontend/basket/toOrderInProcess.php b/ajax/frontend/basket/toOrderInProcess.php index 2fba3900..cde75946 100644 --- a/ajax/frontend/basket/toOrderInProcess.php +++ b/ajax/frontend/basket/toOrderInProcess.php @@ -4,6 +4,8 @@ * This file contains package_quiqqer_order_ajax_frontend_basket_toOrderInProcess */ +use QUI\ERP\Order\Factory; + /** * Saves the basket to the temporary order * @@ -35,8 +37,8 @@ function ($basketId, $orderHash) { if ($Order === null) { try { $Order = $OrderHandler->getLastOrderInProcessFromUser($User); - } catch (QUI\Exception $Exception) { - QUI\System\Log::writeDebugException($Exception); + } catch (QUI\Exception) { + $Order = Factory::getInstance()->createOrderInProcess(); } } -- GitLab From d26d2d4515bdb6004fe643342a40275c87d8fd38 Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Fri, 7 Feb 2025 14:32:55 +0000 Subject: [PATCH 2/2] fix(phpstan): if is always true --- ajax/frontend/basket/toOrderInProcess.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ajax/frontend/basket/toOrderInProcess.php b/ajax/frontend/basket/toOrderInProcess.php index cde75946..ddb6cf77 100644 --- a/ajax/frontend/basket/toOrderInProcess.php +++ b/ajax/frontend/basket/toOrderInProcess.php @@ -42,10 +42,7 @@ function ($basketId, $orderHash) { } } - if ($Order) { - $Basket->toOrder($Order); - } - + $Basket->toOrder($Order); return $Order->getUUID(); }, -- GitLab