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

style: code style

Übergeordneter ba530815
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!5Next,!4style: code style
Pipeline-Nr. 4550 mit Warnungen bestanden
werden angezeigt mit 61 Ergänzungen und 59 Löschungen
......@@ -12,10 +12,11 @@
* @param integer $shippingId
* @return array
*/
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_activate',
function ($shippingId) {
$Shipping = new Factory();
$Shipping = new Factory();
$ShippingEntry = $Shipping->getChild($shippingId);
$ShippingEntry->activate();
......
......@@ -16,7 +16,7 @@
'package_quiqqer_shipping_ajax_backend_articleList_getShippingPriceFactor',
function ($shippingId) {
$Shipping = Shipping::getInstance()->getShippingEntry($shippingId);
return [
'title' => $Shipping->getTitle(),
'price' => $Shipping->getPrice()
......
......@@ -4,8 +4,8 @@
* This file contains package_quiqqer_shipping_ajax_backend_create
*/
use \QUI\ERP\Shipping\Types\Factory;
use \QUI\ERP\Shipping\Shipping;
use QUI\ERP\Shipping\Shipping;
use QUI\ERP\Shipping\Types\Factory;
/**
* Create a new shipping method
......@@ -17,7 +17,7 @@
function ($shippingType) {
$Type = Shipping::getInstance()->getShippingType($shippingType);
$Factory = new Factory();
$Factory = new Factory();
$Shipping = $Factory->createChild([
'shipping_type' => $Type->getType()
]);
......
......@@ -4,7 +4,7 @@
* This file contains package_quiqqer_shipping_ajax_backend_deactivate
*/
use \QUI\ERP\Shipping\Types\Factory;
use QUI\ERP\Shipping\Types\Factory;
/**
* Deactivate a shipping
......@@ -15,7 +15,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_deactivate',
function ($shippingId) {
$factory = new Factory();
$factory = new Factory();
$Shipping = $factory->getChild($shippingId);
$Shipping->deactivate();
......
......@@ -16,7 +16,7 @@
'package_quiqqer_shipping_ajax_backend_getShippingList',
function () {
$shippingEntries = Shipping::getInstance()->getShippingList();
$result = [];
$result = [];
foreach ($shippingEntries as $ShippingEntry) {
/* @var $ShippingEntry ShippingEntry */
......@@ -25,7 +25,7 @@ function () {
$current = QUI::getLocale()->getCurrent();
\usort($result, function ($a, $b) use ($current) {
usort($result, function ($a, $b) use ($current) {
$aTitle = $a['title'][$current];
$bTitle = $b['title'][$current];
......
......@@ -4,7 +4,7 @@
* This file contains package_quiqqer_shipping_ajax_backend_create
*/
use \QUI\ERP\Shipping\Rules\Factory;
use QUI\ERP\Shipping\Rules\Factory;
/**
......@@ -15,9 +15,9 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_create',
function ($rules) {
$rules = \json_decode($rules, true);
$rules = json_decode($rules, true);
$Factory = new Factory();
$Rule = $Factory->createChild($rules);
$Rule = $Factory->createChild($rules);
return $Rule->getId();
},
......
......@@ -5,7 +5,6 @@
*/
use QUI\ERP\Shipping\Rules\Factory;
use QUI\ExceptionStack;
/**
* Delete the shipping rule(s)
......@@ -15,10 +14,10 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_delete',
function ($ruleIds) {
$ruleIds = \json_decode($ruleIds, true);
$ruleIds = json_decode($ruleIds, true);
$Factory = new Factory();
if (!\is_array($ruleIds)) {
if (!is_array($ruleIds)) {
$ruleIds = [$ruleIds];
}
......
......@@ -14,7 +14,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_getList',
function ($options) {
$options = \json_decode($options, true);
$options = json_decode($options, true);
if (!is_array($options)) {
$options = [];
......@@ -44,8 +44,8 @@ function ($options) {
}
$Factory = QUI\ERP\Shipping\Rules\Factory::getInstance();
$Grid = new Grid();
$query = $Grid->parseDBParams($options);
$Grid = new Grid();
$query = $Grid->parseDBParams($options);
if (!isset($query['order'])) {
$query['order'] = 'priority DESC';
......@@ -68,8 +68,8 @@ function ($options) {
$count = $Factory->countChildren($query);
return [
'data' => $result,
'page' => (int)$options['page'],
'data' => $result,
'page' => (int)$options['page'],
'total' => $count
];
},
......
......@@ -12,12 +12,12 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_getRules',
function ($ruleIds) {
$ruleIds = \json_decode($ruleIds, true);
$Rules = QUI\ERP\Shipping\Rules\Factory::getInstance();
$ruleIds = json_decode($ruleIds, true);
$Rules = QUI\ERP\Shipping\Rules\Factory::getInstance();
$result = [];
if (!\is_array($ruleIds)) {
if (!is_array($ruleIds)) {
$ruleIds = [];
}
......@@ -30,7 +30,7 @@ function ($ruleIds) {
}
// sort by priority
\usort($result, function ($a, $b) {
usort($result, function ($a, $b) {
if (!isset($a['priority'])) {
$a['priority'] = 0;
}
......
......@@ -14,9 +14,9 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_settings_getUnitFieldSetting',
function () {
$result = [];
$result = [];
$Shipping = \QUI\ERP\Shipping\Shipping::getInstance();
$ids = $Shipping->getShippingRuleUnitFieldIds();
$ids = $Shipping->getShippingRuleUnitFieldIds();
foreach ($ids as $id) {
try {
......
......@@ -4,7 +4,7 @@
* This file contains package_quiqqer_shipping_ajax_backend_rules_update
*/
use \QUI\ERP\Shipping\Rules\Factory;
use QUI\ERP\Shipping\Rules\Factory;
/**
* Update a shipping method
......@@ -14,7 +14,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_rules_update',
function ($ruleId, $data) {
$data = \json_decode($data, true);
$data = json_decode($data, true);
$Factory = new Factory();
/* @var $Rule QUI\ERP\Shipping\Rules\ShippingRule */
......
......@@ -4,8 +4,8 @@
* This file contains package_quiqqer_shipping_ajax_backend_shippingStatus_getNotificationText
*/
use QUI\ERP\Shipping\ShippingStatus\Handler;
use QUI\ERP\Order\Handler as OrderHandler;
use QUI\ERP\Shipping\ShippingStatus\Handler;
/**
* Get status change notification text for a specific order
......
......@@ -14,16 +14,16 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_shippingStatus_list',
function () {
$Grid = new QUI\Utils\Grid();
$Grid = new QUI\Utils\Grid();
$Handler = Handler::getInstance();
$list = $Handler->getShippingStatusList();
$list = $Handler->getShippingStatusList();
$result = \array_map(function ($Status) {
/* @var $Status \QUI\ERP\Shipping\ShippingStatus\Status */
return $Status->toArray(QUI::getLocale());
}, $list);
\usort($result, function ($a, $b) {
usort($result, function ($a, $b) {
if ($a['id'] == $b['id']) {
return 0;
}
......
......@@ -18,7 +18,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_shippingStatus_update',
function ($id, $color, $title, $notification) {
$id = (int)$id;
$id = (int)$id;
$Handler = Handler::getInstance();
$Handler->updateShippingStatus(
......
......@@ -15,7 +15,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_shipping_ajax_backend_update',
function ($shippingId, $data) {
$Factory = new Factory();
$Factory = new Factory();
$ShippingEntry = $Factory->getChild($shippingId);
$data = \json_decode($data, true);
......
......@@ -102,9 +102,9 @@ abstract public function getWorkingTitle();
*/
public function getIcon()
{
return QUI\ERP\Shipping\Shipping::getInstance()->getHost().
URL_OPT_DIR
.'quiqqer/shipping/bin/images/shipping/default.png';
return QUI\ERP\Shipping\Shipping::getInstance()->getHost() .
URL_OPT_DIR
. 'quiqqer/shipping/bin/images/shipping/default.png';
}
/**
......@@ -115,8 +115,8 @@ public function getIcon()
public function toArray()
{
return [
'name' => $this->getName(),
'title' => $this->getTitle(),
'name' => $this->getName(),
'title' => $this->getTitle(),
'description' => $this->getDescription()
];
}
......
......@@ -6,8 +6,6 @@
namespace QUI\ERP\Shipping\Api;
use QUI;
/**
* Shipping provider
*
......
......@@ -36,7 +36,7 @@ public function toArray($Locale = null)
return [
'title' => $this->getTitle($Locale),
'type' => $this->getType()
'type' => $this->getType()
];
}
......
......@@ -5,8 +5,8 @@
use QUI;
use QUI\ERP\Areas\Utils as AreaUtils;
use QUI\ERP\Products\Handler\Products;
use QUI\ERP\Shipping\Debug;
use QUI\ERP\Products\Product\Types\DigitalProduct;
use QUI\ERP\Shipping\Debug;
/**
* Class DigitalType
......@@ -33,9 +33,9 @@ public function getTitle($Locale = null)
*/
public function getIcon()
{
return QUI\ERP\Shipping\Shipping::getInstance()->getHost().
URL_OPT_DIR
.'quiqqer/shipping/bin/images/shipping/download.png';
return QUI\ERP\Shipping\Shipping::getInstance()->getHost() .
URL_OPT_DIR
. 'quiqqer/shipping/bin/images/shipping/download.png';
}
/**
......@@ -72,7 +72,7 @@ public function canUsedInOrder(
if (!($Product instanceof DigitalProduct)) {
Debug::addLog(
"{$this->getTitle()} :: {$ShippingEntry->getTitle()} :: contains at least one NON-DIGITAL"
." product that must be shipped physically."
. " product that must be shipped physically."
);
return false;
......@@ -83,7 +83,7 @@ public function canUsedInOrder(
}
// Check restriction to certain products / product categories
$articles = $ShippingEntry->getAttribute('articles');
$articles = $ShippingEntry->getAttribute('articles');
$categories = $ShippingEntry->getAttribute('categories');
$toInt = function ($article) {
......@@ -109,7 +109,7 @@ public function canUsedInOrder(
return true;
}
$ArticleList = $Order->getArticles();
$ArticleList = $Order->getArticles();
$orderArticles = $ArticleList->getArticles();
foreach ($orderArticles as $Article) {
......@@ -117,13 +117,15 @@ public function canUsedInOrder(
$productId = $Article->getId();
if (!empty($articles) && \in_array($productId, $articles)) {
Debug::addLog("{$this->getTitle()} :: {$ShippingEntry->getTitle()} :: product {$productId} is in allowed list [ok]");
Debug::addLog(
"{$this->getTitle()} :: {$ShippingEntry->getTitle()} :: product {$productId} is in allowed list [ok]"
);
return true;
}
if (\is_array($categories)) {
$Product = QUI\ERP\Products\Handler\Products::getProduct($productId);
$Product = QUI\ERP\Products\Handler\Products::getProduct($productId);
$articleCategories = $Product->getCategories();
/* @var $Category QUI\ERP\Products\Category\Category */
......@@ -131,7 +133,9 @@ public function canUsedInOrder(
$categoryId = $Category->getId();
if (\in_array($categoryId, $categories)) {
Debug::addLog("{$this->getTitle()} :: {$ShippingEntry->getTitle()} :: category {$categoryId} is in allowed list [ok]");
Debug::addLog(
"{$this->getTitle()} :: {$ShippingEntry->getTitle()} :: category {$categoryId} is in allowed list [ok]"
);
return true;
}
......@@ -173,7 +177,7 @@ public function canUsedBy(
// assignment
$userGroupValue = $ShippingEntry->getAttribute('user_groups');
$areasValue = $ShippingEntry->getAttribute('areas');
$areasValue = $ShippingEntry->getAttribute('areas');
// if groups and areas are empty, everybody is allowed
if (empty($userGroupValue) && empty($areasValue)) {
......@@ -202,7 +206,7 @@ public function canUsedBy(
$ShippingEntry->getAttribute('user_groups')
);
$discountUsers = $userGroups['users'];
$discountUsers = $userGroups['users'];
$discountGroups = $userGroups['groups'];
if (empty($discountUsers) && empty($discountGroups)) {
......
......@@ -101,7 +101,7 @@ public function canUsedInOrder(
}
// assignment
$articles = $ShippingEntry->getAttribute('articles');
$articles = $ShippingEntry->getAttribute('articles');
$categories = $ShippingEntry->getAttribute('categories');
$toInt = function ($article) {
......@@ -127,7 +127,7 @@ public function canUsedInOrder(
return true;
}
$ArticleList = $Order->getArticles();
$ArticleList = $Order->getArticles();
$orderArticles = $ArticleList->getArticles();
foreach ($orderArticles as $Article) {
......@@ -143,7 +143,7 @@ public function canUsedInOrder(
}
if (is_array($categories)) {
$Product = QUI\ERP\Products\Handler\Products::getProduct($productId);
$Product = QUI\ERP\Products\Handler\Products::getProduct($productId);
$articleCategories = $Product->getCategories();
/* @var $Category QUI\ERP\Products\Category\Category */
......@@ -195,7 +195,7 @@ public function canUsedBy(
// assignment
$userGroupValue = $ShippingEntry->getAttribute('user_groups');
$areasValue = $ShippingEntry->getAttribute('areas');
$areasValue = $ShippingEntry->getAttribute('areas');
// if groups and areas are empty, everybody is allowed
if (empty($userGroupValue) && empty($areasValue)) {
......@@ -224,7 +224,7 @@ public function canUsedBy(
$ShippingEntry->getAttribute('user_groups')
);
$discountUsers = $userGroups['users'];
$discountUsers = $userGroups['users'];
$discountGroups = $userGroups['groups'];
if (empty($discountUsers) && empty($discountGroups)) {
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren