From ae339c0599653f35a408933d875743131e85ea11 Mon Sep 17 00:00:00 2001
From: Henning <leutz@pcsg.de>
Date: Wed, 5 Feb 2025 09:13:24 +0100
Subject: [PATCH] fix: convertWithSign.php: add class existence check

Added a condition to check if the class 'QUI\\ERP\\Money\\Price' exists before executing the rest
of the code in the convertWithSign.php file in the ajax directory. This fix prevents potential
errors and improves code stability.

Related: quiqqer/package-currency#9
---
 ajax/convertWithSign.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ajax/convertWithSign.php b/ajax/convertWithSign.php
index f7bb2e6..3ba0666 100644
--- a/ajax/convertWithSign.php
+++ b/ajax/convertWithSign.php
@@ -18,6 +18,10 @@ function ($data) {
         $data = json_decode($data, true);
         $result = [];
 
+        if (!class_exists('QUI\ERP\Money\Price')) {
+            return $result;
+        }
+
         foreach ($data as $entry) {
             $amount = $entry['amount'];
             $currencyFrom = $entry['from'];
-- 
GitLab