Skip to content
Code-Schnipsel Gruppen Projekte
Commit 015fd742 erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

fix: do not execute onPackageSetup for other packages than quiqqer/shippping

style: code style
Übergeordneter 31c82c68
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -22,8 +22,12 @@ class EventHandler
*
* @throws QUI\Exception
*/
public static function onPackageSetup()
public static function onPackageSetup(QUI\Package\Package $Package)
{
if ($Package->getName() !== 'quiqqer/shipping') {
return;
}
// Translations
$languages = QUI\Translator::getAvailableLanguages();
$StatusFactory = QUI\ERP\Shipping\ShippingStatus\Factory::getInstance();
......@@ -81,11 +85,14 @@ public static function onPackageSetup()
return $result;
};
$Handler = QUI\ERP\Shipping\ShippingStatus\Handler::getInstance();
$list = $Handler->getList();
$StatusFactory->createShippingStatus(1, '#dbb50c', $getLocaleTranslations('processing.status.default.1'));
$StatusFactory->createShippingStatus(2, '#418e73', $getLocaleTranslations('processing.status.default.2'));
$StatusFactory->createShippingStatus(3, '#4fd500', $getLocaleTranslations('processing.status.default.3'));
if (empty($list)) {
$StatusFactory->createShippingStatus(1, '#dbb50c', $getLocaleTranslations('processing.status.default.1'));
$StatusFactory->createShippingStatus(2, '#418e73', $getLocaleTranslations('processing.status.default.2'));
$StatusFactory->createShippingStatus(3, '#4fd500', $getLocaleTranslations('processing.status.default.3'));
}
// Product fields
self::createProductFields();
......
......@@ -28,20 +28,18 @@ public function create()
$lg = 'quiqqer/shipping';
/** @var ShippingTimePeriod $Field */
$Field = QUI\ERP\Products\Handler\Fields::getField($this->getId());
$value = $this->getValue();
if (empty($value)) {
return '';
}
switch ($value['option']) {
case ShippingTimePeriod::OPTION_UNAVAILABLE:
case ShippingTimePeriod::OPTION_ON_REQUEST:
case ShippingTimePeriod::OPTION_IMMEDIATELY_AVAILABLE:
case ShippingTimePeriod::OPTION_AVAILABLE_SOON:
$valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.' . $value['option']);
$valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.'.$value['option']);
$cssClass = $value['option'];
break;
......@@ -93,9 +91,9 @@ public function create()
}
if ($singleTime) {
$valueText .= ' ' . $L->get($lg, 'fields.ShippingTimeFrontendView.timeperiod.unit_single.' . $unit);
$valueText .= ' '.$L->get($lg, 'fields.ShippingTimeFrontendView.timeperiod.unit_single.'.$unit);
} else {
$valueText .= ' ' . $L->get($lg, 'fields.ShippingTimeFrontendView.timeperiod.unit_multi.' . $unit);
$valueText .= ' '.$L->get($lg, 'fields.ShippingTimeFrontendView.timeperiod.unit_multi.'.$unit);
}
}
......@@ -105,6 +103,6 @@ public function create()
'cssClass' => $cssClass
]);
return $Engine->fetch(\dirname(__FILE__) . '/ShippingTimePeriodFrontendView.html');
return $Engine->fetch(\dirname(__FILE__).'/ShippingTimePeriodFrontendView.html');
}
}
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