Skip to content
Code-Schnipsel Gruppen Projekte
Commit b12cc837 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: update currency handling

Updated the way how we handle the currency in the system. Now instead of directly getting the
user's currency or the default one, we use the getRuntimeCurrency() method. This method is likely
to return the correct currency even if the user did not set it or if there is no default currency
set in the system. This change is applied in several files including `index.php`,
`CurrencySwitch.php`, and `LangCurrencySwitch.php`. Additionally, updated `composer.json` to use
version 2.2 of `quiqqer/currency`. Removed unused code.
Übergeordneter d4f7c28f
No related branches found
No related tags found
2 Merge Requests!29Update 'next-3.x' with latest changes from 'main',!28feat: update currency handling
Pipeline #16594 bestanden mit Phase
in 3 Minuten und 33 Sekunden
......@@ -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": {
......
......@@ -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'];
......
......@@ -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');
......
......@@ -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
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren