Skip to content
Code-Schnipsel Gruppen Projekte
Commit e4f7b305 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 !13
Übergeordnete 5a5a3b1b b2cfe1cc
Branches next-3.x
No related tags found
1 Merge Request!13Update 'next-3.x' with latest changes from 'main'
Pipeline #15007 bestanden mit Phase
in 2 Minuten und 13 Sekunden
werden angezeigt mit 194 Ergänzungen und 17 Löschungen
# Ignore developer files when exporting
.gitattributes export-ignore
.gitignore export-ignore
.gitlab-ci.yml export-ignore
.phive export-ignore
captainhook.json export-ignore
phpcs.xml.dist export-ignore
phpstan-baseline.neon export-ignore
phpstan.dist.neon export-ignore
phpunit.dist.xml export-ignore
tests export-ignore
# Explicitly set file type and line endings for PHP files, improves git diff output
*.php text eol=lf diff=php
\ No newline at end of file
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
\ No newline at end of file
phpunit.xml
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
include:
- project: 'quiqqer/stabilization/semantic-release'
file: '/ci-templates/.gitlab-ci.yml'
- component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@main
# Remove the entire phpunit-php8.1 block, to allow PHPUnit to run on PHP 8.1 in your pipeline
phpunit-php8.1:
rules:
- when: never
# Remove the entire phpunit-php8.2 block, to allow PHPUnit to run on PHP 8.2 in your pipeline
phpunit-php8.2:
rules:
- when: never
# 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
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.11.8" installed="1.11.8" 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"/>
<phar name="captainhook" version="^5.23.3" installed="5.23.3" location="./tools/captainhook" copy="false"/>
</phive>
# Contributing
This package follows the [QUIQQER contribution guidelines](https://dev.quiqqer.com/quiqqer/stabilization/documentation/-/wikis/home).
\ No newline at end of file
......@@ -22,7 +22,7 @@ function ($discountId) {
$Discount->setAttribute('active', 1);
$Discount->update();
return $Discount->isActive();
return method_exists($Discount, 'isActive') ? $Discount->isActive() : false;
},
['discountId'],
'Permission::checkAdminUser'
......
......@@ -22,7 +22,7 @@ function ($discountId) {
$Discount->setAttribute('active', 0);
$Discount->update();
return $Discount->isActive();
return method_exists($Discount, 'isActive') ? $Discount->isActive() : false;
},
['discountId'],
'Permission::checkAdminUser'
......
......@@ -22,7 +22,7 @@ function ($id) {
$attributes = $Discount->getAttributes();
/* @var $Discount Discount */
$attributes['title'] = $Discount->getTitle();
$attributes['title'] = method_exists($Discount, 'getTitle') ? $Discount->getTitle() : '';
return $attributes;
},
......
......@@ -67,7 +67,7 @@ function ($fields, $params) {
}
usort($result, function ($a, $b) {
return $a['text'] > $b['text'];
return strcmp($a['text'], $b['text']);
});
return $result;
......
......@@ -19,6 +19,10 @@ function ($discountId) {
$Discount = $Handler->getChild($discountId);
/* @var $Discount Discount */
if (!method_exists($Discount, 'isActive')) {
return false;
}
if ($Discount->isActive()) {
$Discount->setAttribute('active', 0);
} else {
......
{
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting"
},
{
"action": "composer test"
}
]
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
"url": "https://www.pcsg.de"
},
"require": {
"php": "^8.2",
"php": "^8.1",
"quiqqer/core": "^2",
"quiqqer/areas": "^2",
"quiqqer/products": "^2",
......@@ -29,5 +29,47 @@
"QUI\\ERP\\Discount\\": "src/QUI/ERP/Discount",
"QUITests\\ERP\\Discount\\": "tests/QUITests/ERP/Discount"
}
},
"scripts": {
"test": [
"@dev:lint",
"@dev:phpunit"
],
"dev:phpunit": "./tools/phpunit",
"dev:lint": [
"@dev:lint:phpstan",
"@dev:lint:style"
],
"dev:lint:phpstan": "./tools/phpstan",
"dev:lint:style": "./tools/phpcs",
"dev:lint:style:fix": "./tools/phpcbf",
"dev:init": [
"@dev:init:check-requirements",
"@dev:init:tools",
"@dev:init:git-hooks"
],
"dev:init:check-requirements": [
"which composer > /dev/null || (echo 'Error: composer has to be globally installed'; exit 1)",
"which phive > /dev/null || (echo 'Error: PHIVE has to be globally installed'; exit 1)"
],
"dev:init:tools": "phive install --temporary",
"dev:init:git-hooks": "./tools/captainhook install --only-enabled --force"
},
"scripts-aliases": {
"test": [
"dev:test"
]
},
"scripts-descriptions": {
"test": "Runs linting, static analysis, and unit tests.",
"dev:phpunit": "Run PHPUnit test suites",
"dev:lint": "Run PHPStan and code style check",
"dev:lint:phpstan": "Run PHPStan",
"dev:lint:style": "Run code style check (PHP_CodeSniffer)",
"dev:lint:style:fix": "Try to fix code style errors automatically",
"dev:init": "Initialize the developer tooling (tools and git hooks)",
"dev:init:check-requirements": "Check if the necessary requirements are met",
"dev:init:tools": "Install all developer tools (requires PHIVE)",
"dev:init:git-hooks": "Install all git hooks (may require tools to be installed)"
}
}
<?xml version="1.0"?>
<ruleset>
<!-- Use PSR-12 ruleset -->
<rule ref="PSR12"/>
<!-- Only scan *.php files -->
<arg name="extensions" value="php"/>
<!-- Ignore warnings -->
<arg name="warning-severity" value="0"/>
<!-- Process 64 (or number of CPU cores) files in parallel -->
<arg name="parallel" value="64"/>
<!-- Output relative file paths, by setting the current folder as the basepath -->
<arg name="basepath" value="."/>
<!-- Show colored output -->
<arg name="colors"/>
<!-- Scan everything in the current folder -->
<file>.</file>
</ruleset>
parameters:
ignoreErrors:
\ No newline at end of file
......@@ -2,9 +2,32 @@ includes:
- phpstan-baseline.neon
parameters:
level: 1
level: 5
paths:
- src
- ajax
bootstrapFiles:
- tests/phpstan-bootstrap.php
\ No newline at end of file
- tests/phpstan-bootstrap.php
treatPhpDocTypesAsCertain: false
customRulesetUsed: true
services:
-
class: \PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
tags:
- phpstan.rules.rule
-
class: \PHPStan\Rules\Functions\ArrowFunctionReturnTypeRule
tags:
- phpstan.rules.rule
-
class: \PHPStan\Rules\Functions\ClosureReturnTypeRule
tags:
- phpstan.rules.rule
-
class: \PHPStan\Rules\Functions\ReturnTypeRule
tags:
- phpstan.rules.rule
-
class: \PHPStan\Rules\Methods\ReturnTypeRule
tags:
- phpstan.rules.rule
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/phpunit-bootstrap.php">
<testsuites>
<testsuite name="Tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
......@@ -248,7 +248,7 @@ public function setAttribute(string $name, mixed $value): void
* @param null|QUI\Locale $Locale - optional, locale object
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if (!$Locale) {
$Locale = QUI::getLocale();
......@@ -284,7 +284,7 @@ public function canCombinedWith(Discount $Discount): bool
return false;
}
$combine = implode($combine, ',');
$combine = implode(',', $combine);
if (in_array($Discount->getId(), (array)$combine)) {
return true;
......@@ -437,15 +437,23 @@ public function canUsedWith(QUI\ERP\Products\Interfaces\ProductInterface $Produc
}
/**
* @param OrderInterface $Order
* @param QUI\ERP\ErpEntityInterface $Order
* @return bool
*/
public function canUsedInOrder(OrderInterface $Order): bool
public function canUsedInOrder(QUI\ERP\ErpEntityInterface $Order): bool
{
if ($this->isActive() === false) {
return false;
}
if (!interface_exists('QUI\ERP\Order\OrderInterface')) {
return false;
}
if (!($Order instanceof QUI\ERP\Order\OrderInterface)) {
return false;
}
$Articles = $Order->getArticles();
foreach ($Articles as $Article) {
......@@ -521,7 +529,7 @@ public function verifyUser(User $User): void
public function toPriceFactor(
$Locale = null,
$Customer = null
): QUI\ERP\Products\Interfaces\PriceFactorInterface|QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface|QUI\ERP\Products\Utils\PriceFactor {
): QUI\ERP\Products\Interfaces\PriceFactorInterface | QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface | QUI\ERP\Products\Utils\PriceFactor {
switch ($this->getAttribute('discount_type')) {
case QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE:
$calculation = QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE;
......
......@@ -47,7 +47,7 @@ public function getVatType(): QUI\ERP\Tax\TaxType
return QUI\ERP\Tax\Utils::getShopTaxType();
}
$standardTax = explode(':', $this->vat);
$standardTax = explode(':', (string)$this->vat);
if (!isset($standardTax[1])) {
return QUI\ERP\Tax\Utils::getShopTaxType();
......
<?php
if (!defined('QUIQQER_SYSTEM')) {
define('QUIQQER_SYSTEM', true);
}
if (!defined('QUIQQER_AJAX')) {
define('QUIQQER_AJAX', true);
}
require_once __DIR__ . '/../../../../bootstrap.php';
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