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

Merge branch 'main' into 'next-3.x'

Update 'next-3.x' with latest changes from 'main'

See merge request !19
Übergeordnete 18a27935 2796c83d
No related branches found
No related tags found
1 Merge Request!19Update 'next-3.x' with latest changes from 'main'
Pipeline #15711 bestanden mit Phase
in 2 Minuten und 26 Sekunden
werden angezeigt mit 248 Ergänzungen und 311 Löschungen
......@@ -14,4 +14,4 @@ phpunit-php8.2:
# Remove the entire phpunit-php8.3 block, to allow PHPUnit to run on PHP 8.3 in your pipeline
phpunit-php8.3:
rules:
- when: never
\ No newline at end of file
- when: never
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
......
......@@ -28,7 +28,7 @@ function ($couponId, $vat) {
continue;
}
if ($vat !== false) {
if ($vat !== false && method_exists($PriceFactor, 'setVat')) {
$PriceFactor->setVat($vat);
}
......
......@@ -36,9 +36,11 @@ function ($ids) {
);
return false;
} catch (QUI\Permissions\Exception $Exception) {
throw $Exception;
} catch (Exception $Exception) {
if ($Exception instanceof QUI\Permissions\Exception) {
throw $Exception;
}
QUI\System\Log::writeException($Exception);
QUI::getMessagesHandler()->addError(
......
......@@ -13,7 +13,7 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
], function (QUIAjax) {
"use strict";
var pkg = 'quiqqer/coupons';
const pkg = 'quiqqer/coupons';
return new Class({
......@@ -28,9 +28,9 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
create: function (Attributes) {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_coupons_ajax_create', resolve, {
'package' : pkg,
'package': pkg,
attributes: JSON.encode(Attributes),
onError : reject
onError: reject
});
});
},
......@@ -45,10 +45,10 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
edit: function (id, Attributes) {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_coupons_ajax_edit', resolve, {
'package' : pkg,
id : id,
'package': pkg,
id: id,
attributes: JSON.encode(Attributes),
onError : reject
onError: reject
});
});
},
......@@ -63,8 +63,8 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_coupons_ajax_delete', resolve, {
'package': pkg,
ids : JSON.encode(ids),
onError : reject
ids: JSON.encode(ids),
onError: reject
});
});
},
......@@ -78,9 +78,9 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
getList: function (SearchParams) {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_coupons_ajax_getList', resolve, {
'package' : pkg,
'package': pkg,
searchParams: JSON.encode(SearchParams),
onError : reject
onError: reject
});
});
},
......@@ -96,9 +96,9 @@ define('package/quiqqer/coupons/bin/backend/classes/CouponCodes', [
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_coupons_ajax_sendMail', resolve, {
'package': pkg,
ids : JSON.encode(ids),
resend : resend ? 1 : 0,
onError : reject
ids: JSON.encode(ids),
resend: resend ? 1 : 0,
onError: reject
});
});
}
......
Dieser Diff ist reduziert.
......@@ -18,7 +18,7 @@ define('package/quiqqer/coupons/bin/backend/controls/Window', [
return new Class({
Extends: QUIConfirm,
Type : 'package/quiqqer/coupons/bin/backend/controls/Window',
Type: 'package/quiqqer/coupons/bin/backend/controls/Window',
Binds: [
'$listRefresh',
......@@ -30,14 +30,14 @@ define('package/quiqqer/coupons/bin/backend/controls/Window', [
this.parent(options);
this.setAttributes({
icon : 'fa fa-credit-card-alt',
title : QUILocale.get(lg, 'controls.manager.title'),
icon: 'fa fa-credit-card-alt',
title: QUILocale.get(lg, 'controls.manager.title'),
maxHeight: 600,
maxWidth : 500,
maxWidth: 500,
});
this.addEvents({
onOpen : this.$onOpen,
onOpen: this.$onOpen,
onResize: this.$onResize
});
},
......@@ -64,54 +64,54 @@ define('package/quiqqer/coupons/bin/backend/controls/Window', [
const Container = new Element('div').inject(this.getContent());
this.$Grid = new Grid(Container, {
columnModel : [
columnModel: [
{
header : QUILocale.get('quiqqer/system', 'id'),
header: QUILocale.get('quiqqer/system', 'id'),
dataIndex: 'id',
dataType : 'number',
width : 50
dataType: 'number',
width: 50
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.code'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.code'),
dataIndex: 'code',
dataType : 'string',
width : 150
dataType: 'string',
width: 150
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.title'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.title'),
dataIndex: 'title',
dataType : 'string',
width : 200
dataType: 'string',
width: 200
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.status'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.status'),
dataIndex: 'status',
dataType : 'node',
width : 200,
dataType: 'node',
width: 200,
className: 'clickable'
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.validUntilDate'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.validUntilDate'),
dataIndex: 'validUntilDateText',
dataType : 'string',
width : 150
dataType: 'string',
width: 150
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.reusable'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.reusable'),
dataIndex: 'maxUsageLabel',
dataType : 'string',
width : 150
dataType: 'string',
width: 150
},
{
header : QUILocale.get(lg, 'controls.manager.tbl.header.createDate'),
header: QUILocale.get(lg, 'controls.manager.tbl.header.createDate'),
dataIndex: 'createDate',
dataType : 'string',
width : 150
dataType: 'string',
width: 150
}
],
pagination : true,
serverSort : true,
selectable : true,
pagination: true,
serverSort: true,
selectable: true,
multipleSelection: true
});
......@@ -120,7 +120,7 @@ define('package/quiqqer/coupons/bin/backend/controls/Window', [
onDblClick: () => {
this.submit();
},
onRefresh : this.$listRefresh
onRefresh: this.$listRefresh
});
this.$Grid.refresh();
......@@ -148,10 +148,10 @@ define('package/quiqqer/coupons/bin/backend/controls/Window', [
}
let GridParams = {
sortOn : Grid.getAttribute('sortOn'),
sortBy : Grid.getAttribute('sortBy'),
sortOn: Grid.getAttribute('sortOn'),
sortBy: Grid.getAttribute('sortBy'),
perPage: Grid.getAttribute('perPage'),
page : Grid.getAttribute('page')
page: Grid.getAttribute('page')
};
switch (GridParams.sortOn) {
......
......@@ -17,11 +17,11 @@ define('package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelec
], function (QUISelect, QUILoader, QUILocale, QUIAjax) {
"use strict";
var lg = 'quiqqer/coupons';
const lg = 'quiqqer/coupons';
return new Class({
Extends: QUISelect,
Type : 'package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelect',
Type: 'package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelect',
Binds: [
'$onImport'
......@@ -46,22 +46,22 @@ define('package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelec
* Event: onImport
*/
$onImport: function () {
var self = this;
const self = this;
this.$Input = this.getElm();
this.$Input = this.getElm();
this.$Input.hidden = true;
var Elm = this.create().inject(this.$Input, 'after');
const Elm = this.create().inject(this.$Input, 'after');
Elm.addClass('field-container-field');
this.Loader.inject(Elm);
this.Loader.show();
this.$getCodeGenerators().then(function(codeGenerators) {
this.$getCodeGenerators().then(function (codeGenerators) {
self.Loader.hide();
for (var i = 0, len = codeGenerators.length; i < len; i++) {
for (let i = 0, len = codeGenerators.length; i < len; i++) {
self.appendChild(
codeGenerators[i],
codeGenerators[i]
......@@ -72,7 +72,7 @@ define('package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelec
self.setValue(self.$Input.value);
}
self.addEvent('onChange', function(value) {
self.addEvent('onChange', function (value) {
self.$Input.value = value;
});
});
......@@ -87,7 +87,7 @@ define('package/quiqqer/coupons/bin/backend/controls/settings/CodeGeneratorSelec
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_coupons_ajax_settings_getCodeGenerators', resolve, {
'package': 'quiqqer/coupons',
onError : reject
onError: reject
});
});
}
......
......@@ -7,8 +7,8 @@ require(['qui/QUI'], function (QUI) {
require(['Ajax'], function (QUIAjax) {
QUIAjax.get('package_quiqqer_coupons_ajax_backend_getCouponPrice', resolve, {
'package': 'quiqqer/coupons',
couponId : couponId,
vat : vat
couponId: couponId,
vat: vat
});
});
});
......@@ -22,13 +22,13 @@ require(['qui/QUI'], function (QUI) {
require(['Locale'], function (QUILocale) {
new Element('button', {
'class': 'qui-button',
html : '<span class="fa fa-credit-card-alt"></span>',
title : QUILocale.get('quiqqer/coupons', 'add.coupon.priceFactor'),
styles : {
'float' : 'right',
html: '<span class="fa fa-credit-card-alt"></span>',
title: QUILocale.get('quiqqer/coupons', 'add.coupon.priceFactor'),
styles: {
'float': 'right',
marginRight: '10px'
},
events : {
events: {
click: function (e) {
e.stop();
......@@ -37,7 +37,7 @@ require(['qui/QUI'], function (QUI) {
], function (CouponWindow) {
new CouponWindow({
multiple: true,
events : {
events: {
onSubmit: function (Instance, value) {
if (!value.length) {
return;
......@@ -57,20 +57,20 @@ require(['qui/QUI'], function (QUI) {
);
}).then((data) => {
let priceFactor = {
calculation : 2,
calculation: 2,
calculation_basis: 2,
description : couponData.title,
identifier : "",
index : ArticleList.countPriceFactors(),
nettoSum : data.nettoSum,
description: couponData.title,
identifier: "",
index: ArticleList.countPriceFactors(),
nettoSum: data.nettoSum,
nettoSumFormatted: data.nettoSumFormatted,
sum : data.sum,
sumFormatted : data.sumFormatted,
title : couponData.title,
value : data.sum,
valueText : data.valueText,
vat : vat,
visible : 1
sum: data.sum,
sumFormatted: data.sumFormatted,
title: couponData.title,
value: data.sum,
valueText: data.valueText,
vat: vat,
visible: 1
};
ArticleList.addPriceFactor(priceFactor);
......
......@@ -13,7 +13,7 @@ define('package/quiqqer/coupons/bin/frontend/classes/CouponCodes', [
], function (QUIAjax) {
"use strict";
var pkg = 'quiqqer/coupons';
const pkg = 'quiqqer/coupons';
return new Class({
......@@ -30,9 +30,9 @@ define('package/quiqqer/coupons/bin/frontend/classes/CouponCodes', [
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_coupons_ajax_frontend_redeem', resolve, {
'package': pkg,
code : code,
code: code,
orderHash: orderHash,
onError : reject
onError: reject
});
});
}
......
......@@ -23,7 +23,7 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
], function(QUI, QUIControl, QUILoader, Sessions, CouponCodes, QUIAjax, QUILocale, Mustache, template) {
'use strict';
var lg = 'quiqqer/coupons';
const lg = 'quiqqer/coupons';
return new Class({
......@@ -50,8 +50,8 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
* Event: onInject
*/
$onInject: function() {
var self = this;
var lgPrefix = 'controls.frontend.CouponCodeInput.template.';
const self = this;
const lgPrefix = 'controls.frontend.CouponCodeInput.template.';
this.$Elm.addClass('quiqqer-coupons-field');
......@@ -81,7 +81,7 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
});
if (this.isInOrder()) {
var OrderProcess = this.getOrderProcess();
const OrderProcess = this.getOrderProcess();
new Promise(function(resolve) {
if (!OrderProcess.isLoaded()) {
......@@ -118,8 +118,8 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
return;
}
var self = this;
var code = this.$Input.value.trim();
const self = this;
const code = this.$Input.value.trim();
if (code === '') {
this.$Input.focus();
......@@ -192,7 +192,7 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
return;
}
var OrderProcess = this.getOrderProcess();
const OrderProcess = this.getOrderProcess();
OrderProcess.Loader.show();
......@@ -239,7 +239,7 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
* @return {boolean}
*/
isInOrder: function() {
var OrderProcessNode = this.getElm().getParent(
const OrderProcessNode = this.getElm().getParent(
'[data-qui="package/quiqqer/order/bin/frontend/controls/OrderProcess"]'
);
......@@ -252,7 +252,7 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
* @return {Object}
*/
getOrderProcess: function() {
var OrderProcessNode = this.getElm().getParent(
const OrderProcessNode = this.getElm().getParent(
'[data-qui="package/quiqqer/order/bin/frontend/controls/OrderProcess"]'
);
......@@ -269,10 +269,10 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [
return Promise.resolve();
}
var self = this;
const self = this;
return new Promise(function(resolve) {
var OrderProcess = self.getOrderProcess();
const OrderProcess = self.getOrderProcess();
OrderProcess.Loader.show();
OrderProcess.getOrder().then(function(orderHash) {
......
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Products\\\\Interfaces\\\\PriceFactorInterface\\:\\:setVat\\(\\)\\.$#"
count: 1
path: ajax/backend/getCouponPrice.php
-
message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#"
count: 1
path: ajax/delete.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Products\\\\Interfaces\\\\PriceFactorInterface\\:\\:setVat\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Coupons/CouponCode.php
-
message: "#^Method QUI\\\\ERP\\\\Coupons\\\\CouponCode\\:\\:getDiscounts\\(\\) should return array\\<QUI\\\\ERP\\\\Discount\\\\Discount\\> but returns array\\<int\\<0, max\\>, QUI\\\\CRUD\\\\Child\\>\\.$#"
count: 1
path: src/QUI/ERP/Coupons/CouponCode.php
-
message: "#^Offset 'standard' on array\\{title\\: array\\{de\\: 'Gutschein \\- Versand', en\\: 'Coupon delivery'\\}, type\\: 'ProductAttributeList', public\\: true, standard\\: false, requiredField\\: true, options\\: array\\{entries\\: array\\{array\\{title\\: array\\{de\\: 'per E \\- Mail', en\\: 'via email'\\}, sum\\: 0, type\\: 2, selected\\: true, userinput\\: false\\}, array\\{title\\: array\\{de\\: 'per Post', en\\: 'via mail'\\}, sum\\: 0, type\\: 2, selected\\: false, userinput\\: false\\}\\}\\}\\}\\|array\\{title\\: array\\{de\\: 'Gutschein Wert', en\\: 'Coupon amount'\\}, type\\: 'FloatType', public\\: false, standard\\: false, requiredField\\: true\\}\\|array\\{title\\: array\\{de\\: 'Gutschein\\-Code als…', en\\: 'Provide coupon code…'\\}, description\\: array\\{de\\: 'Der Gutschein wird…', en\\: 'The coupon is also…'\\}, type\\: 'BoolType', public\\: false, standard\\: false, requiredField\\: false\\}\\|array\\{title\\: array\\{de\\: 'Gutschein\\-Code ist…', en\\: 'Coupon code is…'\\}, description\\: array\\{de\\: 'Übertragbare…', en\\: 'Transferable…'\\}, type\\: 'BoolType', public\\: false, standard\\: false, requiredField\\: false\\}\\|array\\{title\\: array\\{de\\: 'Gutschein\\-Code per…', en\\: 'Send coupon code…'\\}, description\\: array\\{de\\: 'Der Gutschein\\-Code…', en\\: 'The coupon code is…'\\}, type\\: 'BoolType', public\\: false, standard\\: false, requiredField\\: false\\}\\|array\\{title\\: array\\{de\\: 'Gutschein\\-Code…', en\\: 'Coupon code…'\\}, type\\: 'IntType', public\\: false, standard\\: false, requiredField\\: true\\}\\|array\\{title\\: array\\{de\\: 'Gutschein…', en\\: 'Coupon description'\\}, description\\: array\\{de\\: 'Diese Beschreibung…', en\\: 'This description…'\\}, type\\: 'InputMultiLang', public\\: false, standard\\: false, requiredField\\: false\\}\\|array\\{title\\: array\\{de\\: 'Ist Einzweck…', en\\: 'Is single purpose…'\\}, description\\: array\\{de\\: 'Einzweck\\-Gutscheine…', en\\: 'Single\\-purpose…'\\}, type\\: 'BoolType', public\\: false, standard\\: false, requiredField\\: false\\}\\|array\\{title\\: array\\{de\\: 'Kunde darf…', en\\: 'Customer can choose…'\\}, description\\: array\\{de\\: 'Ist diese Funktion…', en\\: 'if this option is…'\\}, type\\: 'BoolType', public\\: false, standard\\: false, requiredField\\: false\\} in empty\\(\\) always exists and is always falsy\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Events.php
-
message: "#^Parameter \\#1 \\$id of static method QUI\\\\ERP\\\\Coupons\\\\Handler\\:\\:getCouponCode\\(\\) expects int, string\\|false given\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Handler.php
-
message: "#^Call to method createPDF\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Call to method setAttribute\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 7
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Call to method setContentHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Call to method setFooterHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Call to method setHeaderHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Instantiated class QUI\\\\HtmlToPdf\\\\Document not found\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
-
message: "#^Parameter \\#1 \\$key of method QUI\\\\ERP\\\\Accounting\\\\Article\\:\\:getCustomField\\(\\) expects string, int given\\.$#"
count: 1
path: src/QUI/ERP/Coupons/Products/Handler.php
......@@ -276,6 +276,7 @@ public function getDiscounts(): array
}
}
// @phpstan-ignore-next-line
return $discounts;
}
......@@ -307,7 +308,7 @@ public function getGroupIds(): array
* @throws QUI\Database\Exception
* @throws ExceptionStack
*/
public function redeem(QUI\Interfaces\Users\User $User = null, AbstractOrder $Order = null): void
public function redeem(null | QUI\Interfaces\Users\User $User = null, null | AbstractOrder $Order = null): void
{
if (is_null($User)) {
$User = QUI::getUserBySession();
......@@ -487,14 +488,13 @@ public function checkOrderRedemption(?OrderInterface $Order): void
foreach ($this->discountIds as $discountId) {
try {
/** @var QUI\ERP\Discount\Discount $Discount */
$Discount = $DiscountHandler->getChild($discountId);
} catch (Exception $Exception) {
$discountError = $Exception->getMessage();
continue;
}
if ($Discount->canUsedInOrder($Order)) {
if (method_exists($Discount, 'canUsedInOrder') && $Discount->canUsedInOrder($Order)) {
$discountsValid = true;
break;
}
......@@ -525,8 +525,10 @@ public function checkOrderRedemption(?OrderInterface $Order): void
* @param OrderInterface|null $Order
* @return bool
*/
public function isRedeemable(QUI\Interfaces\Users\User $User = null, OrderInterface $Order = null): bool
{
public function isRedeemable(
null | QUI\Interfaces\Users\User $User = null,
null | OrderInterface $Order = null
): bool {
try {
$this->checkRedemption($User);
} catch (CouponCodeException) {
......@@ -725,13 +727,12 @@ public function addToOrder(QUI\ERP\Order\OrderInProcess $Order): void
continue;
}
/* @var $Discount QUI\ERP\Discount\Discount */
$discounts = $Coupon->getDiscounts();
foreach ($discounts as $Discount) {
$PriceFactor = $Discount->toPriceFactor(null, $Order->getCustomer());
if ($vat !== false) {
if ($vat !== false && method_exists($PriceFactor, 'setVat')) {
$PriceFactor->setVat($vat);
}
......
......@@ -44,6 +44,10 @@ class Events
*/
public static function onPackageSetup(QUI\Package\Package $Package): void
{
if ($Package->getName() !== 'quiqqer/coupons') {
return;
}
try {
self::createProductFields();
} catch (Exception $Exception) {
......@@ -670,7 +674,7 @@ protected static function createProductFields(): void
'workingtitles' => $field['title'],
'description' => !empty($field['description']) ? $field['description'] : null,
'systemField' => 0,
'standardField' => !empty($field['standard']) ? 1 : 0,
'standardField' => !empty($field['standard']) ? 1 : 0, // @phpstan-ignore-line
'publicField' => !empty($field['public']) ? 1 : 0,
'options' => !empty($field['options']) ? $field['options'] : null,
'requiredField' => !empty($field['requiredField']) ? 1 : 0
......
......@@ -193,7 +193,7 @@ public static function createCouponCode(array $discountIds, array $settings = []
]);
}
return self::getCouponCode(QUI::getPDO()->lastInsertId());
return self::getCouponCode((int)QUI::getPDO()->lastInsertId());
}
/**
......@@ -310,7 +310,7 @@ public static function editCouponCode(int $id, array $discountIds, array $settin
* @return CouponCode[]|int
* @throws CouponCodeException|QUI\Exception
*/
public static function search(array $searchParams, bool $countOnly = false): array|int
public static function search(array $searchParams, bool $countOnly = false): array | int
{
$couponCodes = [];
$Grid = new Grid($searchParams);
......@@ -434,7 +434,7 @@ public static function existsCode(string $code): bool
*
* @return QUI\Projects\Site|false
*/
public static function getRegistrationSite(): bool|QUI\Projects\Site
public static function getRegistrationSite(): bool | QUI\Projects\Site
{
try {
$Conf = QUI::getPackage('quiqqer/coupons')->getConfig();
......@@ -464,7 +464,7 @@ public static function getRegistrationSite(): bool|QUI\Projects\Site
*
* @throws Exception
*/
public static function deleteExpiredCouponCodes(int $days = null): void
public static function deleteExpiredCouponCodes(null | int $days = null): void
{
$Now = new DateTime();
$where = [
......@@ -498,7 +498,7 @@ public static function deleteExpiredCouponCodes(int $days = null): void
*
* @throws Exception
*/
public static function deleteRedeemedCouponCodes(int $days = null): void
public static function deleteRedeemedCouponCodes(null | int $days = null): void
{
$where = [
'useDate' => [
......
......@@ -4,6 +4,7 @@
use QUI;
use QUI\ERP\Products\Product\Types\DigitalProduct;
use QUI\Locale;
/**
* Class DigitalProduct
......@@ -52,7 +53,7 @@ public function __construct(int $pid, array $product = [])
* @param QUI\Locale|null $Locale
* @return string
*/
public static function getTypeTitle(QUI\Locale $Locale = null): string
public static function getTypeTitle(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -62,10 +63,10 @@ public static function getTypeTitle(QUI\Locale $Locale = null): string
}
/**
* @param QUI\Locale $Locale
* @param Locale|null $Locale
* @return string
*/
public static function getTypeDescription($Locale = null): string
public static function getTypeDescription(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......
......@@ -57,7 +57,6 @@ public static function createCouponCodesFromOrder(QUI\ERP\Order\AbstractOrder $O
$Customer = $Order->getCustomer();
$Currency = $Order->getCurrency();
/** @var QUI\ERP\Accounting\Article $Article */
foreach ($Order->getArticles() as $Article) {
try {
// Do not parse coupon codes / discounts
......
......@@ -3,6 +3,7 @@
namespace QUI\ERP\Coupons\Products;
use QUI;
use QUI\Locale;
/**
* Class PhysicalCouponProductType
......@@ -51,7 +52,7 @@ public function __construct(int $pid, array $product = [])
* @param QUI\Locale|null $Locale
* @return string
*/
public static function getTypeTitle(QUI\Locale $Locale = null): string
public static function getTypeTitle(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -61,10 +62,10 @@ public static function getTypeTitle(QUI\Locale $Locale = null): string
}
/**
* @param QUI\Locale $Locale
* @param Locale|null $Locale
* @return string
*/
public static function getTypeDescription($Locale = null): string
public static function getTypeDescription(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......
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