From ba530815ff5c78a8d70be8d855f2658075e451cf Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Wed, 2 Aug 2023 14:13:14 +0200 Subject: [PATCH] style: code style --- src/QUI/ERP/Shipping/EventHandler.php | 65 +++++++-------- .../FrontendUsers/ShippingAddressSelect.php | 12 +-- src/QUI/ERP/Shipping/Order/Shipping.php | 40 +++++----- src/QUI/ERP/Shipping/OrderProcessProvider.php | 12 ++- .../Fields/ShippingTimeFrontendView.php | 28 +++---- .../Products/Fields/ShippingTimePeriod.php | 18 ++--- src/QUI/ERP/Shipping/Rules/Factory.php | 8 +- src/QUI/ERP/Shipping/Rules/ShippingRule.php | 80 ++++++++++--------- src/QUI/ERP/Shipping/Shipping.php | 43 +++++----- .../ERP/Shipping/ShippingStatus/Factory.php | 10 +-- .../ERP/Shipping/ShippingStatus/Handler.php | 42 +++++----- .../ERP/Shipping/ShippingStatus/Status.php | 38 ++++----- src/QUI/ERP/Shipping/Tracking/Tracking.php | 69 ++++++++-------- src/QUI/ERP/Shipping/Types/ShippingUnique.php | 2 +- 14 files changed, 238 insertions(+), 229 deletions(-) diff --git a/src/QUI/ERP/Shipping/EventHandler.php b/src/QUI/ERP/Shipping/EventHandler.php index a19c37a..14652c0 100644 --- a/src/QUI/ERP/Shipping/EventHandler.php +++ b/src/QUI/ERP/Shipping/EventHandler.php @@ -41,14 +41,14 @@ public static function onPackageSetup(QUI\Package\Package $Package) } // Translations - $languages = QUI\Translator::getAvailableLanguages(); + $languages = QUI\Translator::getAvailableLanguages(); $StatusFactory = QUI\ERP\Shipping\ShippingStatus\Factory::getInstance(); // create locale - $var = 'message.no.rule.found.order.continue'; + $var = 'message.no.rule.found.order.continue'; $params = [ 'datatype' => 'php,js', - 'package' => 'quiqqer/shipping' + 'package' => 'quiqqer/shipping' ]; foreach ($languages as $language) { @@ -66,10 +66,10 @@ public static function onPackageSetup(QUI\Package\Package $Package) } // create locale - $var = 'message.no.rule.found.order.cancel'; + $var = 'message.no.rule.found.order.cancel'; $params = [ 'datatype' => 'php,js', - 'package' => 'quiqqer/shipping' + 'package' => 'quiqqer/shipping' ]; foreach ($languages as $language) { @@ -98,7 +98,7 @@ public static function onPackageSetup(QUI\Package\Package $Package) }; $Handler = QUI\ERP\Shipping\ShippingStatus\Handler::getInstance(); - $list = $Handler->getList(); + $list = $Handler->getList(); if (empty($list)) { $StatusFactory->createShippingStatus(1, '#dbb50c', $getLocaleTranslations('processing.status.default.1')); @@ -222,7 +222,7 @@ public static function onOrderProcessCustomerDataEnd( } $Control = new QUI\ERP\Shipping\Order\ShippingAddress([ - 'User' => $User, + 'User' => $User, 'Order' => $Order ]); @@ -247,7 +247,7 @@ public static function onQuiqqerOrderOrderProcessCheckoutOutputBefore( } $SessionUser = QUI::getUserBySession(); - $Customer = $Order->getCustomer(); + $Customer = $Order->getCustomer(); if ($SessionUser->getId() !== $Customer->getId()) { return; @@ -288,13 +288,13 @@ public static function onQuiqqerOrderOrderProcessCheckoutOutput(OrderCheckoutSte if ($DeliveryAddress->getId() === 0) { $customerId = $Order->getCustomer()->getId(); - $Customer = QUI::getUsers()->get($customerId); + $Customer = QUI::getUsers()->get($customerId); $deliveryAddressId = $Customer->getAttribute('quiqqer.delivery.address'); if (!empty($deliveryAddressId)) { try { - $DeliveryAddress = $Customer->getAddress($deliveryAddressId); + $DeliveryAddress = $Customer->getAddress($deliveryAddressId); $ErpDeliveryAddress = new QUI\ERP\Address( json_decode($DeliveryAddress->toJSON(), true), $Order->getCustomer() @@ -327,7 +327,7 @@ public static function onQuiqqerOrderCustomerDataSave( } // save shipping address - $Order = $CustomerData->getOrder(); + $Order = $CustomerData->getOrder(); $Customer = $Order->getCustomer(); try { @@ -390,10 +390,11 @@ public static function onUserSaveBegin(QUI\Users\User $User) $Request = QUI::getRequest()->request; - $submit = $Request->get('submit-shipping'); + $submit = $Request->get('submit-shipping'); $address = (int)$Request->get('shipping-address'); - if (isset($_REQUEST['step']) + if ( + isset($_REQUEST['step']) && $_REQUEST['step'] === 'Customer' && !empty($_REQUEST['shipping-address']) ) { @@ -422,7 +423,7 @@ public static function onUserSaveBegin(QUI\Users\User $User) */ public static function onTemplateGetHeader() { - $User = QUI::getUserBySession(); + $User = QUI::getUserBySession(); $addressId = $User->getAttribute('quiqqer.delivery.address'); if (!$addressId) { @@ -448,12 +449,12 @@ protected static function createProductFields() { $fields = [ Shipping::PRODUCT_FIELD_SHIPPING_TIME => [ - 'title' => [ + 'title' => [ 'de' => 'Lieferzeit', 'en' => 'Delivery time' ], - 'type' => Shipping::PRODUCT_FIELD_TYPE_SHIPPING_TIME, - 'public' => true, + 'type' => Shipping::PRODUCT_FIELD_TYPE_SHIPPING_TIME, + 'public' => true, 'standard' => true ] ]; @@ -470,14 +471,14 @@ protected static function createProductFields() try { ProductFields::createField([ - 'id' => $fieldId, - 'type' => $field['type'], - 'titles' => $field['title'], + 'id' => $fieldId, + 'type' => $field['type'], + 'titles' => $field['title'], 'workingtitles' => $field['title'], - 'systemField' => 0, + 'systemField' => 0, 'standardField' => !empty($field['standard']) ? 1 : 0, - 'publicField' => !empty($field['public']) ? 1 : 0, - 'options' => !empty($field['options']) ? $field['options'] : null + 'publicField' => !empty($field['public']) ? 1 : 0, + 'options' => !empty($field['options']) ? $field['options'] : null ]); } catch (\Exception $Exception) { QUI\System\Log::writeException($Exception); @@ -501,7 +502,7 @@ protected static function createProductFields() */ public static function onQuiqqerProductsPriceEnd(Collector $Collector, QUI\ERP\Products\Controls\Price $Price) { - $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); + $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); $enableShippingInfo = !!$Config->getValue('shipping', 'showShippingInfoAfterPrice'); if (!$enableShippingInfo || !$Price->getAttribute('withVatText')) { @@ -509,7 +510,7 @@ public static function onQuiqqerProductsPriceEnd(Collector $Collector, QUI\ERP\P } $Engine = QUI::getTemplateManager()->getEngine(); - $html = $Engine->fetch(dirname(__FILE__) . '/templates/shippingInformation.html'); + $html = $Engine->fetch(dirname(__FILE__) . '/templates/shippingInformation.html'); $Collector->append($html); } @@ -616,7 +617,7 @@ protected static function addDefaultShipping(ArticleList $Articles) } $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); - $add = $Config->getValue('shipping', 'addDefaultShipping'); + $add = $Config->getValue('shipping', 'addDefaultShipping'); if (empty($add)) { return; @@ -627,7 +628,7 @@ protected static function addDefaultShipping(ArticleList $Articles) // check if shipping factor exist $shippingFactor = null; - $factors = $PriceFactors->toArray(); + $factors = $PriceFactors->toArray(); foreach ($factors as $factor) { if (strpos($factor['identifier'], 'shipping-pricefactor-') !== false) { @@ -655,7 +656,7 @@ public static function onQuiqqerOrderUpdateBegin( QUI\ERP\Order\AbstractOrder $Order, &$data = [] ) { - $Articles = $Order->getArticles(); + $Articles = $Order->getArticles(); $PriceFactors = $Articles->getPriceFactors(); if (!$PriceFactors->count()) { @@ -664,8 +665,8 @@ public static function onQuiqqerOrderUpdateBegin( // check if shipping factor exist $shippingFactor = null; - $factors = $PriceFactors->toArray(); - $Shipping = $Order->getShipping(); + $factors = $PriceFactors->toArray(); + $Shipping = $Order->getShipping(); if (!$Shipping) { return; @@ -684,14 +685,14 @@ public static function onQuiqqerOrderUpdateBegin( $identifier = $shippingFactor['identifier']; $identifier = str_replace($identifier, 'shipping-pricefactor-', ''); - $id = (int)$identifier; + $id = (int)$identifier; if ($id !== $Shipping->getId() && isset($index)) { $Factor = $PriceFactors->getFactor($index); $factor = $Factor->toArray(); $factor['identifier'] = 'shipping-pricefactor-' . $Shipping->getId(); - $factor['title'] = $Shipping->getTitle(); + $factor['title'] = $Shipping->getTitle(); $PriceFactors->setFactor( $index, diff --git a/src/QUI/ERP/Shipping/FrontendUsers/ShippingAddressSelect.php b/src/QUI/ERP/Shipping/FrontendUsers/ShippingAddressSelect.php index 9b7c1e3..4875e2b 100644 --- a/src/QUI/ERP/Shipping/FrontendUsers/ShippingAddressSelect.php +++ b/src/QUI/ERP/Shipping/FrontendUsers/ShippingAddressSelect.php @@ -25,7 +25,7 @@ public function __construct($attributes = []) parent::__construct($attributes); $this->setAttribute('nodeName', 'section'); - $this->addCSSFile(\dirname(__FILE__).'/ShippingAddressSelect.css'); + $this->addCSSFile(\dirname(__FILE__) . '/ShippingAddressSelect.css'); $this->addCSSClass('quiqqer-shipping-user-address'); } @@ -41,20 +41,20 @@ public function getBody() } $addresses = []; - $current = ''; - $User = $this->getAttribute('User'); + $current = ''; + $User = $this->getAttribute('User'); if ($User) { /* @var $User QUI\Users\User */ $addresses = $User->getAddressList(); - $current = (int)$User->getAttribute('quiqqer.delivery.address'); + $current = (int)$User->getAttribute('quiqqer.delivery.address'); } $Engine->assign([ 'addresses' => $addresses, - 'current' => $current + 'current' => $current ]); - return $Engine->fetch(\dirname(__FILE__).'/ShippingAddressSelect.html'); + return $Engine->fetch(\dirname(__FILE__) . '/ShippingAddressSelect.html'); } } diff --git a/src/QUI/ERP/Shipping/Order/Shipping.php b/src/QUI/ERP/Shipping/Order/Shipping.php index ea39bb5..4c8a952 100644 --- a/src/QUI/ERP/Shipping/Order/Shipping.php +++ b/src/QUI/ERP/Shipping/Order/Shipping.php @@ -55,24 +55,24 @@ public function getIcon() public function getBody() { $Engine = QUI::getTemplateManager()->getEngine(); - $User = QUI::getUserBySession(); + $User = QUI::getUserBySession(); $Order = $this->getOrder(); $Order->recalculate(); $SelectedShipping = $Order->getShipping(); - $Customer = $Order->getCustomer(); - $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); + $Customer = $Order->getCustomer(); + $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); $shippingList = $this->getValidShipping(); // debugging logger if (QUI\ERP\Shipping\Shipping::getInstance()->debuggingEnabled()) { QUI\ERP\Shipping\Debug::clearLogStock(); - $debugStack = []; + $debugStack = []; $debugShipping = $Shipping->getShippingList(); - $Logger = QUI\ERP\Shipping\Debug::getLoggerWithoutFormatter(); + $Logger = QUI\ERP\Shipping\Debug::getLoggerWithoutFormatter(); foreach ($debugShipping as $DebugShippingEntry) { $DebugShippingEntry->setOrder($Order); @@ -86,7 +86,7 @@ public function getBody() $DebugShippingEntry->canUsedBy($User, $Order); } - $debugStack = \array_merge($debugStack, QUI\ERP\Shipping\Debug::getLogStack()); + $debugStack = \array_merge($debugStack, QUI\ERP\Shipping\Debug::getLogStack()); $debugStack[] = ""; QUI\ERP\Shipping\Debug::clearLogStock(); @@ -103,7 +103,7 @@ public function getBody() QUI\ERP\Shipping\Debug::sendAdminInfoMailAboutEmptyShipping($Order); $Package = QUI::getPackage('quiqqer/shipping'); - $Conf = $Package->getConfig(); + $Conf = $Package->getConfig(); if ((int)$Conf->getValue('no_rules', 'behavior') === ShippingHandler::NO_RULE_FOUND_ORDER_CANCEL) { $message = QUI::getLocale()->get( @@ -124,10 +124,10 @@ public function getBody() } $Engine->assign([ - 'User' => $User, - 'Customer' => $Customer, + 'User' => $User, + 'Customer' => $Customer, 'SelectedShipping' => $SelectedShipping, - 'shippingList' => $shippingList + 'shippingList' => $shippingList ]); return $Engine->fetch(\dirname(__FILE__) . '/Shipping.html'); @@ -141,14 +141,14 @@ public function validate() $Order = $this->getOrder(); $Shipping = $Order->getShipping(); - $User = $Order->getCustomer(); + $User = $Order->getCustomer(); // setting rule behavior $behavior = ShippingHandler::NO_RULE_FOUND_ORDER_CONTINUE; try { $Package = QUI::getPackage('quiqqer/shipping'); - $Conf = $Package->getConfig(); + $Conf = $Package->getConfig(); $behavior = (int)$Conf->getValue('no_rules', 'behavior'); } catch (QUI\Exception $Exception) { @@ -180,8 +180,10 @@ public function validate() // if no shipping exists, BUT order can be continued // and if really no shipping is selectable - if ($Shipping === null - && $behavior === ShippingHandler::NO_RULE_FOUND_ORDER_CANCEL) { + if ( + $Shipping === null + && $behavior === ShippingHandler::NO_RULE_FOUND_ORDER_CANCEL + ) { throw new QUI\ERP\Order\Exception([ 'quiqqer/shipping', 'exception.missing.shipping.order.canceled' @@ -189,8 +191,10 @@ public function validate() } // if no shipping exists, BUT order can be continued - if ($Shipping === null - && $behavior === ShippingHandler::NO_RULE_FOUND_ORDER_CONTINUE) { + if ( + $Shipping === null + && $behavior === ShippingHandler::NO_RULE_FOUND_ORDER_CONTINUE + ) { return; } @@ -235,11 +239,11 @@ public function save() $shipping = $this->getAttribute('shipping'); } - $User = QUI::getUserBySession(); + $User = QUI::getUserBySession(); $Order = $this->getOrder(); try { - $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); + $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); $ShippingEntry = $Shipping->getShippingEntry($shipping); $ShippingEntry->setOrder($Order); diff --git a/src/QUI/ERP/Shipping/OrderProcessProvider.php b/src/QUI/ERP/Shipping/OrderProcessProvider.php index bb8cb4e..df054bf 100644 --- a/src/QUI/ERP/Shipping/OrderProcessProvider.php +++ b/src/QUI/ERP/Shipping/OrderProcessProvider.php @@ -6,14 +6,12 @@ namespace QUI\ERP\Shipping; -use QUI; - -use QUI\ERP\Shipping\Api\AbstractShippingEntry; use QUI\ERP\Order\AbstractOrder; use QUI\ERP\Order\AbstractOrderProcessProvider; use QUI\ERP\Order\Controls\AbstractOrderingStep; use QUI\ERP\Order\OrderProcess; use QUI\ERP\Order\Utils\OrderProcessSteps; +use QUI\ERP\Shipping\Api\AbstractShippingEntry; /** * Class OrderProcessProvider @@ -41,17 +39,17 @@ public function initSteps(OrderProcessSteps $OrderProcessSteps, OrderProcess $Pr } $orderId = null; - $Order = null; + $Order = null; if ($Process->getOrder()) { - $Order = $Process->getOrder(); + $Order = $Process->getOrder(); $orderId = $Order->getId(); } $OrderProcessSteps->append( new Order\Shipping([ - 'orderId' => $orderId, - 'Order' => $Order, + 'orderId' => $orderId, + 'Order' => $Order, 'priority' => 25 ]) ); diff --git a/src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php b/src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php index face904..c8c052c 100644 --- a/src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php +++ b/src/QUI/ERP/Shipping/Products/Fields/ShippingTimeFrontendView.php @@ -24,8 +24,8 @@ public function create() } $Engine = QUI::getTemplateManager()->getEngine(); - $L = QUI::getLocale(); - $lg = 'quiqqer/shipping'; + $L = QUI::getLocale(); + $lg = 'quiqqer/shipping'; /** @var ShippingTimePeriod $Field */ $value = $this->getValue(); @@ -39,8 +39,8 @@ public function create() case ShippingTimePeriod::OPTION_ON_REQUEST: case ShippingTimePeriod::OPTION_IMMEDIATELY_AVAILABLE: case ShippingTimePeriod::OPTION_AVAILABLE_SOON: - $valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.'.$value['option']); - $cssClass = $value['option']; + $valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.' . $value['option']); + $cssClass = $value['option']; break; case ShippingTimePeriod::OPTION_CUSTOM_TEXT: @@ -56,14 +56,14 @@ public function create() break; default: - $from = $value['from']; - $to = $value['to']; - $unit = $value['unit']; + $from = $value['from']; + $to = $value['to']; + $unit = $value['unit']; $cssClass = 'timeperiod'; if (empty($to) && empty($from)) { $valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.unavailable'); - $cssClass = 'unavailable'; + $cssClass = 'unavailable'; break; } @@ -84,26 +84,26 @@ public function create() } else { $valueText = $L->get($lg, 'fields.ShippingTimeFrontendView.timeperiod.from_to', [ 'from' => $from, - 'to' => $to + 'to' => $to ]); $singleTime = false; } 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); } } $Engine->assign([ - 'title' => $this->getTitle(), + 'title' => $this->getTitle(), 'valueText' => $valueText, - 'cssClass' => $cssClass + 'cssClass' => $cssClass ]); - return $Engine->fetch(\dirname(__FILE__).'/ShippingTimePeriodFrontendView.html'); + return $Engine->fetch(\dirname(__FILE__) . '/ShippingTimePeriodFrontendView.html'); } /** diff --git a/src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php b/src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php index 2a29ec0..6f541b6 100644 --- a/src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php +++ b/src/QUI/ERP/Shipping/Products/Fields/ShippingTimePeriod.php @@ -12,13 +12,13 @@ */ class ShippingTimePeriod extends TimePeriod { - const OPTION_TIMEPERIOD = 'timeperiod'; - const OPTION_UNAVAILABLE = 'unavailable'; + const OPTION_TIMEPERIOD = 'timeperiod'; + const OPTION_UNAVAILABLE = 'unavailable'; const OPTION_IMMEDIATELY_AVAILABLE = 'immediately_available'; - const OPTION_ON_REQUEST = 'on_request'; - const OPTION_AVAILABLE_SOON = 'available_soon'; - const OPTION_CUSTOM_TEXT = 'custom_text'; - const OPTION_USE_DEFAULT = 'use_default'; + const OPTION_ON_REQUEST = 'on_request'; + const OPTION_AVAILABLE_SOON = 'available_soon'; + const OPTION_CUSTOM_TEXT = 'custom_text'; + const OPTION_USE_DEFAULT = 'use_default'; /** * Check the value @@ -49,9 +49,9 @@ public function validate($value) 'quiqqer/products', 'exception.field.invalid', [ - 'fieldId' => $this->getId(), + 'fieldId' => $this->getId(), 'fieldTitle' => $this->getTitle(), - 'fieldType' => $this->getType() + 'fieldType' => $this->getType() ] ]); } @@ -85,7 +85,7 @@ public function cleanup($value) } $value['from'] = (int)$value['from']; - $value['to'] = (int)$value['to']; + $value['to'] = (int)$value['to']; switch ($value['option']) { case self::OPTION_TIMEPERIOD: diff --git a/src/QUI/ERP/Shipping/Rules/Factory.php b/src/QUI/ERP/Shipping/Rules/Factory.php index 5fad8de..86dc7ad 100644 --- a/src/QUI/ERP/Shipping/Rules/Factory.php +++ b/src/QUI/ERP/Shipping/Rules/Factory.php @@ -164,8 +164,8 @@ public function createChild($data = []) /* @var $NewChild ShippingRule */ $NewChild = parent::createChild($data); - $localeTitle = 'shipping.'.$NewChild->getId().'.rule.title'; - $localeWTitle = 'shipping.'.$NewChild->getId().'.rule.workingTitle'; + $localeTitle = 'shipping.' . $NewChild->getId() . '.rule.title'; + $localeWTitle = 'shipping.' . $NewChild->getId() . '.rule.workingTitle'; $this->createShippingLocale( $localeTitle, @@ -305,9 +305,9 @@ protected function createShippingLocale($var, $title) try { QUI\Translator::addUserVar('quiqqer/shipping', $var, [ - $current => $title, + $current => $title, 'datatype' => 'php,js', - 'package' => 'quiqqer/shipping' + 'package' => 'quiqqer/shipping' ]); } catch (QUI\Exception $Exception) { QUI\System\Log::addNotice($Exception->getMessage()); diff --git a/src/QUI/ERP/Shipping/Rules/ShippingRule.php b/src/QUI/ERP/Shipping/Rules/ShippingRule.php index 9108a43..ab4b39f 100644 --- a/src/QUI/ERP/Shipping/Rules/ShippingRule.php +++ b/src/QUI/ERP/Shipping/Rules/ShippingRule.php @@ -69,7 +69,7 @@ public function __construct($id, Factory $Factory) $this->Events->addEvent('onSaveBegin', function () { Permission::checkPermission('quiqqer.shipping.edit'); - $id = $this->getId(); + $id = $this->getId(); $attributes = $this->getAttributes(); if (is_array($attributes['title'])) { @@ -100,12 +100,15 @@ public function __construct($id, Factory $Factory) $attributes['discount_type'] = (int)$attributes['discount_type']; } - if ($attributes['discount_type'] === RuleFactory::DISCOUNT_TYPE_PERCENTAGE || + if ( + $attributes['discount_type'] === RuleFactory::DISCOUNT_TYPE_PERCENTAGE || $attributes['discount_type'] === 'PERCENTAGE' ) { $attributes['discount_type'] = RuleFactory::DISCOUNT_TYPE_PERCENTAGE; - } elseif ($attributes['discount_type'] === RuleFactory::DISCOUNT_TYPE_PC_ORDER || - $attributes['discount_type'] === 'PERCENTAGE_ORDER') { + } elseif ( + $attributes['discount_type'] === RuleFactory::DISCOUNT_TYPE_PC_ORDER || + $attributes['discount_type'] === 'PERCENTAGE_ORDER' + ) { $attributes['discount_type'] = RuleFactory::DISCOUNT_TYPE_PC_ORDER; } else { $attributes['discount_type'] = RuleFactory::DISCOUNT_TYPE_ABS; @@ -158,7 +161,7 @@ public function toArray() $id = $this->getId(); $attributes = $this->getAttributes(); - $Locale = QUI::getLocale(); + $Locale = QUI::getLocale(); $availableLanguages = QUI\Translator::getAvailableLanguages(); @@ -194,7 +197,7 @@ public function getTitle($Locale = null) } $language = $Locale->getCurrent(); - $id = $this->getId(); + $id = $this->getId(); return $Locale->getByLang( $language, @@ -256,9 +259,9 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) // usage definitions / limits - $dateFrom = $this->getAttribute('date_from'); + $dateFrom = $this->getAttribute('date_from'); $dateUntil = $this->getAttribute('date_until'); - $now = time(); + $now = time(); if ($dateFrom && strtotime($dateFrom) > $now) { Debug::addLog("{$this->getTitle()} :: date from is not valid {$dateFrom} > {$now}"); @@ -274,7 +277,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) // assignment $userGroupValue = $this->getAttribute('user_groups'); - $areasValue = $this->getAttribute('areas'); + $areasValue = $this->getAttribute('areas'); // if groups and areas are empty, everybody is allowed if (empty($userGroupValue) && empty($areasValue)) { @@ -291,7 +294,7 @@ public function canUsedBy(QUI\Interfaces\Users\User $User) $this->getAttribute('user_groups') ); - $discountUsers = $userGroups['users']; + $discountUsers = $userGroups['users']; $discountGroups = $userGroups['groups']; if (empty($discountUsers) && empty($discountGroups)) { @@ -384,33 +387,33 @@ public function canUsedInOrder($Order) } /* @var $Order QUI\ERP\Order\Order */ - $Articles = $Order->getArticles(); + $Articles = $Order->getArticles(); $articleList = $Articles->getArticles(); if (!$Articles->count()) { return false; } - $articles = $this->getAttribute('articles'); + $articles = $this->getAttribute('articles'); $articleOnly = (int)$this->getAttribute('articles_only'); - $unitTerms = $this->getUnitTerms(); + $unitTerms = $this->getUnitTerms(); $categories = $this->getAttribute('categories'); $categories = trim($categories, ','); $categories = explode(',', $categories); $categories = array_map('intval', $categories); - $quantityFrom = $this->getAttribute('purchase_quantity_from'); // Einkaufsmenge ab + $quantityFrom = $this->getAttribute('purchase_quantity_from'); // Einkaufsmenge ab $quantityUntil = $this->getAttribute('purchase_quantity_until'); // Einkaufsmenge bis - $purchaseFrom = $this->getAttribute('purchase_value_from'); // Einkaufswert ab + $purchaseFrom = $this->getAttribute('purchase_value_from'); // Einkaufswert ab $purchaseUntil = $this->getAttribute('purchase_value_until'); // Einkaufswert bis // article checks - $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); - $unitIds = $Shipping->getShippingRuleUnitFieldIds(); + $Shipping = QUI\ERP\Shipping\Shipping::getInstance(); + $unitIds = $Shipping->getShippingRuleUnitFieldIds(); $articleFound = true; $articleUnits = []; - $debugUnits = []; + $debugUnits = []; if (!empty($articles)) { $articleFound = false; @@ -442,12 +445,12 @@ public function canUsedInOrder($Order) }; foreach ($articleList as $Article) { - $aid = $Article->getId(); + $aid = $Article->getId(); $articleQuantity = $Article->getQuantity(); // get product because of units try { - $Product = Products::getProduct($aid); + $Product = Products::getProduct($aid); $productCategories = $Product->getCategories(); $categoryIds = array_map(function ($Category) { @@ -481,7 +484,7 @@ public function canUsedInOrder($Order) $articleUnits[$unitId] = $articleUnits[$unitId] + ($weight * $articleQuantity); $debugUnits[$unitId] = [ - 'field' => $Weight->getTitle(), + 'field' => $Weight->getTitle(), 'amount' => $articleUnits[$unitId] ]; } @@ -526,7 +529,8 @@ public function canUsedInOrder($Order) // category check $categoryIdsInOrder = array_unique($categoryIdsInOrder); - if (!empty($categoryIdsInOrder) + if ( + !empty($categoryIdsInOrder) && !empty($categories) && (count($categories) === 1 && $categories[0] !== 0) ) { @@ -571,11 +575,11 @@ public function canUsedInOrder($Order) $unitTerm['term2'] = 'gt'; } - $id = (int)$unitTerm['id']; - $unit = $unitTerm['unit']; + $id = (int)$unitTerm['id']; + $unit = $unitTerm['unit']; $value = floatval($unitTerm['value']); - $term = $unitTerm['term']; + $term = $unitTerm['term']; $hTerm = FieldUtils::termToHuman($term); if (!isset($articleUnits[$id])) { @@ -584,7 +588,7 @@ public function canUsedInOrder($Order) if ($id === Fields::FIELD_WEIGHT) { $unitValue = FieldUtils::weightToKilogram($value, $unit); - $compare = FieldUtils::compare($articleUnits[$id], $unitValue, $term); + $compare = FieldUtils::compare($articleUnits[$id], $unitValue, $term); if ($compare === false) { QUI\ERP\Shipping\Debug::addLog( @@ -597,11 +601,11 @@ public function canUsedInOrder($Order) // term 2 if (!empty($unitTerm['value2'])) { $value2 = floatval($unitTerm['value2']); - $term2 = $unitTerm['term2']; + $term2 = $unitTerm['term2']; $hTerm2 = FieldUtils::termToHuman($term2); $unitValue = FieldUtils::weightToKilogram($value2, $unit); - $compare2 = FieldUtils::compare($articleUnits[$id], $unitValue, $term2); + $compare2 = FieldUtils::compare($articleUnits[$id], $unitValue, $term2); if ($compare2 === false) { QUI\ERP\Shipping\Debug::addLog( @@ -627,9 +631,9 @@ public function canUsedInOrder($Order) // term 2 if (!empty($unitTerm['value2'])) { - $value2 = floatval($unitTerm['value2']); - $term2 = $unitTerm['term2']; - $hTerm2 = FieldUtils::termToHuman($term2); + $value2 = floatval($unitTerm['value2']); + $term2 = $unitTerm['term2']; + $hTerm2 = FieldUtils::termToHuman($term2); $compare2 = FieldUtils::compare($articleUnits[$id], $value2, $term2); if ($compare2 === false) { @@ -665,9 +669,9 @@ public function canUsedInOrder($Order) // purchase try { - $Calculation = $Order->getPriceCalculation(); - $Currency = $Order->getCurrency(); - $PriceFactors = $Order->getArticles()->getPriceFactors(); + $Calculation = $Order->getPriceCalculation(); + $Currency = $Order->getCurrency(); + $PriceFactors = $Order->getArticles()->getPriceFactors(); $ShippingFactor = null; /* @var $Factor QUI\ERP\Products\Interfaces\PriceFactorInterface */ @@ -764,9 +768,9 @@ public function isValid() } // check date - $usageFrom = $this->getAttribute('date_from'); + $usageFrom = $this->getAttribute('date_from'); $usageUntil = $this->getAttribute('date_until'); - $time = time(); + $time = time(); if (!empty($usageFrom)) { $usageFrom = strtotime($usageFrom); @@ -907,7 +911,7 @@ protected function setLocaleVar($var, $title) { $data = [ 'datatype' => 'php,js', - 'package' => 'quiqqer/shipping' + 'package' => 'quiqqer/shipping' ]; $languages = QUI::availableLanguages(); @@ -917,7 +921,7 @@ protected function setLocaleVar($var, $title) continue; } - $data[$language] = $title[$language]; + $data[$language] = $title[$language]; $data[$language . '_edit'] = $title[$language]; } diff --git a/src/QUI/ERP/Shipping/Shipping.php b/src/QUI/ERP/Shipping/Shipping.php index 11f0ec6..4734c30 100644 --- a/src/QUI/ERP/Shipping/Shipping.php +++ b/src/QUI/ERP/Shipping/Shipping.php @@ -128,7 +128,7 @@ public function shippingDisabled() } try { - $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); + $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); $this->shippingDisabled = !!$Config->getValue('shipping', 'deactivated'); } catch (QUI\Exception $Exception) { $this->shippingDisabled = false; @@ -149,7 +149,7 @@ public function debuggingEnabled() } try { - $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); + $Config = QUI::getPackage('quiqqer/shipping')->getConfig(); $this->debugging = !!$Config->getValue('shipping', 'debug'); } catch (QUI\Exception $Exception) { $this->debugging = false; @@ -165,7 +165,7 @@ public function debuggingEnabled() */ public function getShippingTypes() { - $shipping = []; + $shipping = []; $providers = $this->getShippingProviders(); foreach ($providers as $Provider) { @@ -322,9 +322,11 @@ public function getValidShippingEntriesByOrder(AbstractOrder $Order) foreach ($userShipping as $ShippingEntry) { $ShippingEntry->setOrder($Order); - if ($ShippingEntry->isValid() + if ( + $ShippingEntry->isValid() && $ShippingEntry->canUsedInOrder($Order) - && $ShippingEntry->canUsedBy($User, $Order)) { + && $ShippingEntry->canUsedBy($User, $Order) + ) { $shippingList[] = $ShippingEntry; } } @@ -388,7 +390,8 @@ public function getHost() */ public function getShippingByObject($Object) { - if (!($Object instanceof QUI\ERP\Order\Order) && + if ( + !($Object instanceof QUI\ERP\Order\Order) && !($Object instanceof QUI\ERP\Order\OrderInProcess) && !($Object instanceof QUI\ERP\Accounting\Invoice\Invoice) && !($Object instanceof QUI\ERP\Accounting\Invoice\InvoiceTemporary) @@ -434,21 +437,21 @@ public function getDefaultPriceFactor(): QUI\ERP\Products\Utils\PriceFactor $price = QUI\ERP\Money\Price::validatePrice($price); $PriceFactor = new QUI\ERP\Products\Utils\PriceFactor([ - 'identifier' => 'shipping-pricefactor-default', - 'title' => QUI::getLocale()->get('quiqqer/shipping', 'shipping.default.pricefactor'), + 'identifier' => 'shipping-pricefactor-default', + 'title' => QUI::getLocale()->get('quiqqer/shipping', 'shipping.default.pricefactor'), 'description' => '', 'calculation' => QUI\ERP\Accounting\Calc::CALCULATION_COMPLEMENT, - 'basis' => QUI\ERP\Accounting\Calc::CALCULATION_BASIS_CURRENTPRICE, - 'value' => $price, - 'visible' => true, - 'currency' => QUI\ERP\Defaults::getCurrency()->getCode() + 'basis' => QUI\ERP\Accounting\Calc::CALCULATION_BASIS_CURRENTPRICE, + 'value' => $price, + 'visible' => true, + 'currency' => QUI\ERP\Defaults::getCurrency()->getCode() ]); $PriceFactor->setNettoSum($price); // set default vat - $Area = QUI\ERP\Defaults::getArea(); - $TaxType = QUI\ERP\Tax\Utils::getTaxTypeByArea($Area); + $Area = QUI\ERP\Defaults::getArea(); + $TaxType = QUI\ERP\Tax\Utils::getTaxTypeByArea($Area); $TaxEntry = QUI\ERP\Tax\Utils::getTaxEntry($TaxType, $Area); $PriceFactor->setVat($TaxEntry->getValue()); @@ -467,10 +470,10 @@ public function getOrderVat($Order) /* @var $Article QUI\ERP\Accounting\Article */ $Articles = $Order->getArticles(); - $vats = []; + $vats = []; foreach ($Articles as $Article) { - $vat = $Article->getVat(); + $vat = $Article->getVat(); $price = $Article->getPrice()->getValue(); if (!isset($vats[(string)$vat])) { @@ -484,8 +487,8 @@ public function getOrderVat($Order) // look at vat, which vat should be used if (!count($vats) && !$Order->getCustomer()) { // use default vat - $Area = QUI\ERP\Defaults::getArea(); - $TaxType = QUI\ERP\Tax\Utils::getTaxTypeByArea($Area); + $Area = QUI\ERP\Defaults::getArea(); + $TaxType = QUI\ERP\Tax\Utils::getTaxTypeByArea($Area); $TaxEntry = QUI\ERP\Tax\Utils::getTaxEntry($TaxType, $Area); return $TaxEntry->getValue(); @@ -524,7 +527,7 @@ public function sendStatusChangeNotification( $statusId, $message = null ) { - $Customer = $Order->getCustomer(); + $Customer = $Order->getCustomer(); $customerEmail = $Customer->getAttribute('email'); if (empty($customerEmail)) { @@ -537,7 +540,7 @@ public function sendStatusChangeNotification( } if (empty($message)) { - $Status = ShippingStatus\Handler::getInstance()->getShippingStatus($statusId); + $Status = ShippingStatus\Handler::getInstance()->getShippingStatus($statusId); $message = $Status->getStatusChangeNotificationText($Order); } diff --git a/src/QUI/ERP/Shipping/ShippingStatus/Factory.php b/src/QUI/ERP/Shipping/ShippingStatus/Factory.php index 7982a9b..7c9257a 100644 --- a/src/QUI/ERP/Shipping/ShippingStatus/Factory.php +++ b/src/QUI/ERP/Shipping/ShippingStatus/Factory.php @@ -31,7 +31,7 @@ class Factory extends QUI\Utils\Singleton public function createShippingStatus($id, $color, array $title) { $list = Handler::getInstance()->getList(); - $id = (int)$id; + $id = (int)$id; $data = []; if (isset($list[$id])) { @@ -43,7 +43,7 @@ public function createShippingStatus($id, $color, array $title) // config $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); + $Config = $Package->getConfig(); $Config->setValue('shipping_status', $id, $color); $Config->save(); @@ -60,13 +60,13 @@ public function createShippingStatus($id, $color, array $title) } // ShippingStatus title - $data['package'] = 'quiqqer/shipping'; + $data['package'] = 'quiqqer/shipping'; $data['datatype'] = 'php,js'; - $data['html'] = 1; + $data['html'] = 1; QUI\Translator::addUserVar( 'quiqqer/shipping', - 'shipping.status.'.$id, + 'shipping.status.' . $id, $data ); diff --git a/src/QUI/ERP/Shipping/ShippingStatus/Handler.php b/src/QUI/ERP/Shipping/ShippingStatus/Handler.php index 2cc21f8..f89b525 100644 --- a/src/QUI/ERP/Shipping/ShippingStatus/Handler.php +++ b/src/QUI/ERP/Shipping/ShippingStatus/Handler.php @@ -50,8 +50,8 @@ public function getList() try { $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); - $result = $Config->getSection('shipping_status'); + $Config = $Package->getConfig(); + $result = $Config->getSection('shipping_status'); } catch (QUI\Exception $Exception) { QUI\System\Log::writeException($Exception); @@ -88,7 +88,7 @@ public function refreshList() */ public function getShippingStatusList() { - $list = $this->getList(); + $list = $this->getList(); $result = []; foreach ($list as $entry => $color) { @@ -135,14 +135,14 @@ public function deleteShippingStatus($id) // remove translation QUI\Translator::delete( 'quiqqer/shipping', - 'shipping.status.'.$Status->getId() + 'shipping.status.' . $Status->getId() ); QUI\Translator::publish('quiqqer/shipping'); // update config $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); + $Config = $Package->getConfig(); $Config->del('shipping_status', $Status->getId()); $Config->save(); @@ -164,7 +164,7 @@ public function setShippingStatusNotification($id, $notify) // update config $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); + $Config = $Package->getConfig(); $Config->setValue('shipping_status_notification', $Status->getId(), $notify ? "1" : "0"); $Config->save(); @@ -189,21 +189,21 @@ public function updateShippingStatus($id, $color, array $title) $languages = QUI::availableLanguages(); $data = [ - 'package' => 'quiqqer/shipping', + 'package' => 'quiqqer/shipping', 'datatype' => 'php,js', - 'html' => 1 + 'html' => 1 ]; foreach ($languages as $language) { if (isset($title[$language])) { - $data[$language] = $title[$language]; - $data[$language.'_edit'] = $title[$language]; + $data[$language] = $title[$language]; + $data[$language . '_edit'] = $title[$language]; } } QUI\Translator::edit( 'quiqqer/shipping', - 'shipping.status.'.$Status->getId(), + 'shipping.status.' . $Status->getId(), 'quiqqer/shipping', $data ); @@ -212,7 +212,7 @@ public function updateShippingStatus($id, $color, array $title) // update config $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); + $Config = $Package->getConfig(); $Config->setValue('shipping_status', $Status->getId(), $color); $Config->save(); @@ -227,13 +227,13 @@ public function updateShippingStatus($id, $color, array $title) public function createNotificationTranslations($id) { $data = [ - 'package' => 'quiqqer/shipping', + 'package' => 'quiqqer/shipping', 'datatype' => 'php,js', - 'html' => 1 + 'html' => 1 ]; // translations - $L = new QUI\Locale(); + $L = new QUI\Locale(); $languages = QUI::availableLanguages(); foreach ($languages as $language) { @@ -243,7 +243,7 @@ public function createNotificationTranslations($id) try { // Check if translation already exists - $translation = QUI\Translator::get('quiqqer/shipping', 'shipping.status.notification.'.$id); + $translation = QUI\Translator::get('quiqqer/shipping', 'shipping.status.notification.' . $id); if (!empty($translation)) { return; @@ -252,7 +252,7 @@ public function createNotificationTranslations($id) // ShippingStatus notification messages QUI\Translator::addUserVar( 'quiqqer/shipping', - 'shipping.status.notification.'.$id, + 'shipping.status.notification.' . $id, $data ); @@ -274,20 +274,20 @@ public function createNotificationTranslations($id) */ public function sendStatusChangeNotification(AbstractOrder $Order, $statusId, $message = null) { - $Customer = $Order->getCustomer(); + $Customer = $Order->getCustomer(); $customerEmail = $Customer->getAttribute('email'); if (empty($customerEmail)) { QUI\System\Log::addWarning( - 'Status change notification for order #'.$Order->getPrefixedId().' cannot be sent' - .' because customer #'.$Customer->getId().' has no e-mail address.' + 'Status change notification for order #' . $Order->getPrefixedId() . ' cannot be sent' + . ' because customer #' . $Customer->getId() . ' has no e-mail address.' ); return; } if (empty($message)) { - $Status = $this->getShippingStatus($statusId); + $Status = $this->getShippingStatus($statusId); $message = $Status->getStatusChangeNotificationText($Order); } diff --git a/src/QUI/ERP/Shipping/ShippingStatus/Status.php b/src/QUI/ERP/Shipping/ShippingStatus/Status.php index 03e9f4a..13df092 100644 --- a/src/QUI/ERP/Shipping/ShippingStatus/Status.php +++ b/src/QUI/ERP/Shipping/ShippingStatus/Status.php @@ -48,14 +48,14 @@ public function __construct($id) ]); } - $this->id = (int)$id; + $this->id = (int)$id; $this->color = $list[$id]; // notification try { $Package = QUI::getPackage('quiqqer/shipping'); - $Config = $Package->getConfig(); - $result = $Config->getSection('shipping_status_notification'); + $Config = $Package->getConfig(); + $result = $Config->getSection('shipping_status_notification'); } catch (QUI\Exception $Exception) { QUI\System\Log::writeException($Exception); } @@ -89,7 +89,7 @@ public function getTitle($Locale = null) $Locale = QUI::getLocale(); } - return $Locale->get('quiqqer/shipping', 'shipping.status.'.$this->id); + return $Locale->get('quiqqer/shipping', 'shipping.status.' . $this->id); } /** @@ -107,18 +107,18 @@ public function getStatusChangeNotificationText(AbstractOrder $Order, $Locale = $Customer = $Order->getCustomer(); - $message = $Locale->get('quiqqer/shipping', 'shipping.status.notification.'.$this->id, [ - 'customerName' => $Customer->getName(), - 'orderNo' => $Order->getPrefixedId(), - 'orderDate' => $Locale->formatDate($Order->getCreateDate()), + $message = $Locale->get('quiqqer/shipping', 'shipping.status.notification.' . $this->id, [ + 'customerName' => $Customer->getName(), + 'orderNo' => $Order->getPrefixedId(), + 'orderDate' => $Locale->formatDate($Order->getCreateDate()), 'shippingStatus' => $this->getTitle($Locale) ]); if (QUI::getLocale()->isLocaleString($message)) { $message = $Locale->get('quiqqer/shipping', 'shipping.status.notification.template', [ - 'customerName' => $Customer->getName(), - 'orderNo' => $Order->getPrefixedId(), - 'orderDate' => $Locale->formatDate($Order->getCreateDate()), + 'customerName' => $Customer->getName(), + 'orderNo' => $Order->getPrefixedId(), + 'orderDate' => $Locale->formatDate($Order->getCreateDate()), 'shippingStatus' => $this->getTitle($Locale) ]); } @@ -160,32 +160,32 @@ public function toArray( $title = $this->getTitle($Locale); if ($Locale === null) { - $statusId = $this->getId(); - $title = []; + $statusId = $this->getId(); + $title = []; $statusChangeText = []; - $Locale = QUI::getLocale(); + $Locale = QUI::getLocale(); $languages = QUI::availableLanguages(); foreach ($languages as $language) { $title[$language] = $Locale->getByLang( $language, 'quiqqer/shipping', - 'shipping.status.'.$statusId + 'shipping.status.' . $statusId ); $statusChangeText[$language] = $Locale->getByLang( $language, 'quiqqer/shipping', - 'shipping.status.notification.'.$statusId + 'shipping.status.notification.' . $statusId ); } } return [ - 'id' => $this->getId(), - 'title' => $title, - 'color' => $this->getColor(), + 'id' => $this->getId(), + 'title' => $title, + 'color' => $this->getColor(), 'notification' => $this->isAutoNotification() ]; } diff --git a/src/QUI/ERP/Shipping/Tracking/Tracking.php b/src/QUI/ERP/Shipping/Tracking/Tracking.php index 9b9c475..9c8a4dd 100644 --- a/src/QUI/ERP/Shipping/Tracking/Tracking.php +++ b/src/QUI/ERP/Shipping/Tracking/Tracking.php @@ -1,6 +1,5 @@ <?php - namespace QUI\ERP\Shipping\Tracking; use QUI\Countries\Country; @@ -25,55 +24,55 @@ class Tracking //UPS - UNITED PARCEL SERVICE [ 'active' => '1', - 'type' => 'ups', - 'title' => 'UPS', - 'image' => 'quiqqer/shipping/bin/images/tracking/ups.svg', - 'url' => 'https://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumber1=' + 'type' => 'ups', + 'title' => 'UPS', + 'image' => 'quiqqer/shipping/bin/images/tracking/ups.svg', + 'url' => 'https://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumber1=' ], //USPS - UNITED STATES POSTAL SERVICE [ 'active' => '1', - 'type' => 'usps', - 'title' => 'USPS', - 'image' => 'quiqqer/shipping/bin/images/tracking/usps.png', - 'url' => 'https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=' + 'type' => 'usps', + 'title' => 'USPS', + 'image' => 'quiqqer/shipping/bin/images/tracking/usps.png', + 'url' => 'https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=' ], //FEDEX - FEDERAL EXPRESS [ 'active' => '1', - 'type' => 'fedex', - 'title' => 'FedEx', - 'image' => 'quiqqer/shipping/bin/images/tracking/fedex.svg', - 'url' => 'https://www.fedex.com/fedextrack/?trknbr=' + 'type' => 'fedex', + 'title' => 'FedEx', + 'image' => 'quiqqer/shipping/bin/images/tracking/fedex.svg', + 'url' => 'https://www.fedex.com/fedextrack/?trknbr=' ], //LaserShip [ 'active' => '1', - 'type' => 'laser_ship', - 'title' => 'LaserShip', - 'image' => 'quiqqer/shipping/bin/images/tracking/lasership.png', - 'url' => 'https://www.fedex.com/fedextrack/?trknbr=' + 'type' => 'laser_ship', + 'title' => 'LaserShip', + 'image' => 'quiqqer/shipping/bin/images/tracking/lasership.png', + 'url' => 'https://www.fedex.com/fedextrack/?trknbr=' ], //ONTRAC [ 'active' => '1', - 'type' => 'ontrac', - 'title' => 'OnTrac', - 'image' => 'quiqqer/shipping/bin/images/tracking/ontrac.svg', - 'url' => 'https://www.ontrac.com/trackres.asp?tracking_number=' + 'type' => 'ontrac', + 'title' => 'OnTrac', + 'image' => 'quiqqer/shipping/bin/images/tracking/ontrac.svg', + 'url' => 'https://www.ontrac.com/trackres.asp?tracking_number=' ], //DHL [ - 'active' => '1', - 'type' => 'dhl', - 'title' => 'DHL', - 'image' => 'quiqqer/shipping/bin/images/tracking/dhl.svg', - 'url' => 'https://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=', + 'active' => '1', + 'type' => 'dhl', + 'title' => 'DHL', + 'image' => 'quiqqer/shipping/bin/images/tracking/dhl.svg', + 'url' => 'https://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=', 'country' => [ 'en' => 'https://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=', 'de' => 'https://www.dhl.com/de-de/home/tracking/tracking-parcel.html?submit=1&tracking-id=' @@ -83,19 +82,19 @@ class Tracking //DPD [ 'active' => '1', - 'type' => 'dpd', - 'title' => 'DPD', - 'image' => 'quiqqer/shipping/bin/images/tracking/dpd.svg', - 'url' => 'https://track.dpdnl.nl/?parcelnumber=' + 'type' => 'dpd', + 'title' => 'DPD', + 'image' => 'quiqqer/shipping/bin/images/tracking/dpd.svg', + 'url' => 'https://track.dpdnl.nl/?parcelnumber=' ], // DEUTSCHE POST [ 'active' => '1', - 'type' => 'deutschePost', - 'title' => 'Deutsche Post', - 'image' => 'quiqqer/shipping/bin/images/tracking/DeutschePost.svg', - 'url' => 'https://www.deutschepost.de/de/s/sendungsverfolgung/verfolgen.html?lang=de&cid=brief&piececode=' + 'type' => 'deutschePost', + 'title' => 'Deutsche Post', + 'image' => 'quiqqer/shipping/bin/images/tracking/DeutschePost.svg', + 'url' => 'https://www.deutschepost.de/de/s/sendungsverfolgung/verfolgen.html?lang=de&cid=brief&piececode=' ] ]; @@ -146,7 +145,7 @@ public static function getActiveCarriers(): array public static function getUrl($trackingId, string $carrier, ?Country $Country): string { $carriers = self::getActiveCarriers(); - $country = false; + $country = false; if ($Country) { $country = $Country->getCode(); diff --git a/src/QUI/ERP/Shipping/Types/ShippingUnique.php b/src/QUI/ERP/Shipping/Types/ShippingUnique.php index b300700..e54ddaf 100644 --- a/src/QUI/ERP/Shipping/Types/ShippingUnique.php +++ b/src/QUI/ERP/Shipping/Types/ShippingUnique.php @@ -105,7 +105,7 @@ public function getPriceDisplay() QUI\ERP\Defaults::getCurrency() ); - return '+'.$Price->getDisplayPrice(); + return '+' . $Price->getDisplayPrice(); } /** -- GitLab