From fd1f77633e29cdb0334c45314a042b37150b0213 Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Fri, 5 Jan 2018 11:35:17 +0100 Subject: [PATCH] fix: ArticleListUnique getCurrency fix -> fallback to default currency if it is not set --- src/QUI/ERP/Accounting/ArticleList.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/QUI/ERP/Accounting/ArticleList.php b/src/QUI/ERP/Accounting/ArticleList.php index 958f661..1246ca9 100644 --- a/src/QUI/ERP/Accounting/ArticleList.php +++ b/src/QUI/ERP/Accounting/ArticleList.php @@ -139,7 +139,22 @@ public function getUser() */ public function getCurrency() { - return $this->Currency; + if (!is_null($this->Currency)) { + return $this->Currency; + } + + if (is_array($this->currencyData) && !empty($this->currencyData['currency_code'])) { + try { + $this->Currency = QUI\ERP\Currency\Handler::getCurrency( + $this->currencyData['currency_code'] + ); + + return $this->Currency; + } catch (QUI\Exception $Exception) { + } + } + + return QUI\ERP\Defaults::getCurrency(); } /** -- GitLab