diff --git a/composer.json b/composer.json index a553c1629b6c3b9e98a69f9b0b0f92f72796d868..4ee4e0f02f02e55cdddce2f6b94a281a63e72164 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "quiqqer/unsemantic": "^2", "quiqqer-asset/fastclick": "^1", "quiqqer/tooltips": "^2", - "quiqqer/currency": "^2", + "quiqqer/currency": "^2.2", "quiqqer/smarty4": "^2.0.7" }, "autoload": { diff --git a/index.php b/index.php index 85536cdeca290224e4afa6ec85c32a8559c8a9c5..3facd45eeeee466e3d23344d4d20fcdd5c9ea581 100644 --- a/index.php +++ b/index.php @@ -61,12 +61,6 @@ /** * Basket button */ -$Currency = QUI\ERP\Currency\Handler::getUserCurrency(); - -if (!$Currency) { - $Currency = QUI\ERP\Currency\Handler::getDefaultCurrency(); -} - $createBasketButton = true; $simpleSiteTypes = [ 'quiqqer/order:types/orderingProcess', @@ -79,7 +73,7 @@ $Template->setAttribute('content-header', false); } -$InitialBasketPrice = new QUI\ERP\Money\Price(0, $Currency); +$InitialBasketPrice = new QUI\ERP\Money\Price(0, QUI\ERP\Currency\Handler::getRuntimeCurrency()); $Logo = $Project->getMedia()->getLogoImage(); $logoHeight = $templateSettings['logoHeight']; diff --git a/src/QUI/TemplateCologne/Controls/CurrencySwitch.php b/src/QUI/TemplateCologne/Controls/CurrencySwitch.php index 424d15ed59bb9f8361c4091161073e7df355714f..7054101af649d9d02ab37f40d01c4b22e7e7be46 100644 --- a/src/QUI/TemplateCologne/Controls/CurrencySwitch.php +++ b/src/QUI/TemplateCologne/Controls/CurrencySwitch.php @@ -30,13 +30,6 @@ public function __construct(array $attributes = []) parent::__construct($attributes); } - /** - * (non-PHPdoc) - * - * @throws QUI\Exception - * @see \QUI\Control::create() - * - */ public function getBody(): string { $Engine = QUI::getTemplateManager()->getEngine(); @@ -61,15 +54,9 @@ public function getBody(): string } } - $Currency = QUI\ERP\Currency\Handler::getDefaultCurrency(); - - if (QUI\ERP\Currency\Handler::getUserCurrency()) { - $Currency = QUI\ERP\Currency\Handler::getUserCurrency(); - } - $Engine->assign([ 'this' => $this, - 'DefaultCurrency' => $Currency, + 'DefaultCurrency' => QUI\ERP\Currency\Handler::getRuntimeCurrency() ]); return $Engine->fetch(dirname(__FILE__) . '/CurrencySwitch.html'); diff --git a/src/QUI/TemplateCologne/Controls/LangCurrencySwitch.php b/src/QUI/TemplateCologne/Controls/LangCurrencySwitch.php index 49242431855f62205275f88578609f7f01589575..fb31322788aa5374fe595f9013a18d92edb304b7 100644 --- a/src/QUI/TemplateCologne/Controls/LangCurrencySwitch.php +++ b/src/QUI/TemplateCologne/Controls/LangCurrencySwitch.php @@ -8,6 +8,8 @@ use QUI; +use function count; + /** * Class LangCurrencySwitch */ @@ -32,13 +34,6 @@ public function __construct(array $attributes = []) parent::__construct($attributes); } - /** - * (non-PHPdoc) - * - * @throws QUI\Exception - * @see \QUI\Control::create() - * - */ public function getBody(): string { $Engine = QUI::getTemplateManager()->getEngine(); @@ -67,7 +62,7 @@ public function getBody(): string } $langSwitch = false; - if (\count($Project->getLanguages()) > 1) { + if (count($Project->getLanguages()) > 1) { $langSwitch = true; } @@ -76,12 +71,6 @@ public function getBody(): string $enableChange = true; } - $Currency = QUI\ERP\Currency\Handler::getDefaultCurrency(); - - if (QUI\ERP\Currency\Handler::getUserCurrency()) { - $Currency = QUI\ERP\Currency\Handler::getUserCurrency(); - } - if ($Locale->exists('quiqqer/core', 'language.' . $Project->getLang())) { $imgAltText = $Locale->get('quiqqer/core', 'language.' . $Project->getLang()); } else { @@ -92,7 +81,7 @@ public function getBody(): string 'this' => $this, 'projectLang' => $Project->getLang(), 'currencySwitch' => $currencySwitch, - 'DefaultCurrency' => $Currency, + 'DefaultCurrency' => QUI\ERP\Currency\Handler::getRuntimeCurrency(), 'flagFolderPath' => $flagFolder, 'imgAltText' => $imgAltText, 'enableChange' => $enableChange