Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/invoice
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (8)
werden angezeigt mit 182 Ergänzungen und 281 Löschungen
<?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"/>
......
parameters:
ignoreErrors:
-
message: "#^Parameter \\#6 \\$User of static method QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Factory\\:\\:createPaymentTransaction\\(\\) expects null, QUI\\\\Interfaces\\\\Users\\\\User given\\.$#"
count: 1
path: ajax/invoices/addPayment.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/EventHandler.php
-
message: "#^PHPDoc tag @throws has invalid value \\(\\)\\: Unexpected token \"\\\\n \", expected type at offset 212$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Factory.php
-
message: "#^Class QUI\\\\Database\\\\Exception referenced with incorrect case\\: QUI\\\\DataBase\\\\Exception\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Invoice.php
-
message: "#^Method QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\:\\:getShipping\\(\\) has invalid return type QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingUnique\\.$#"
count: 2
......@@ -30,21 +15,6 @@ parameters:
count: 2
path: src/QUI/ERP/Accounting/Invoice/Invoice.php
-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$globalProcessId$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Invoice.php
-
message: "#^PHPDoc tag @throws has invalid value \\(\\)\\: Unexpected token \"\\\\n \", expected type at offset 174$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Invoice.php
-
message: "#^PHPDoc tag @throws has invalid value \\(\\)\\: Unexpected token \"\\\\n \", expected type at offset 86$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Invoice.php
-
message: "#^Property QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\:\\:\\$Shipping \\(QUI\\\\ERP\\\\Shipping\\\\Api\\\\ShippingInterface\\|null\\) does not accept QUI\\\\ERP\\\\Shipping\\\\Types\\\\ShippingUnique\\.$#"
count: 2
......@@ -80,87 +50,17 @@ parameters:
count: 2
path: src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php
-
message: "#^PHPDoc tag @throws has invalid value \\(\\)\\: Unexpected token \"\\\\n \", expected type at offset 86$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php
-
message: "#^Parameter \\$Shipping of method QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\:\\:setShipping\\(\\) has invalid type QUI\\\\ERP\\\\Shipping\\\\Api\\\\ShippingInterface\\.$#"
count: 2
path: src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php
-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/InvoiceView.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/InvoiceView.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Accounting\\\\ArticleListUnique\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Output/OutputProviderInvoice.php
-
message: "#^Call to an undefined method QUI\\\\ERP\\\\Accounting\\\\ArticleListUnique\\:\\:toUniqueList\\(\\)\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Output/OutputProviderInvoice.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Output/OutputProviderInvoice.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:setValue\\(\\) expects string\\|null, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/ProcessingStatus/Factory.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:del\\(\\) expects string\\|null, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/ProcessingStatus/Handler.php
-
message: "#^Parameter \\#2 \\$key of method QUI\\\\Config\\:\\:setValue\\(\\) expects string\\|null, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/ProcessingStatus/Handler.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
-
message: "#^Parameter \\#1 \\$haystack of function str_starts_with expects string, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
-
message: "#^Parameter \\#1 \\$string of function strlen expects string, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
-
message: "#^Parameter \\#1 \\$string of function substr_replace expects array\\|string, int given\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
-
message: "#^Result of && is always false\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php
-
message: "#^Result of \\|\\| is always true\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php
......@@ -7,6 +7,7 @@
namespace QUI\ERP\Accounting\Invoice;
use QUI;
use QUI\Database\Exception;
use function json_encode;
......@@ -23,14 +24,13 @@ class Factory extends QUI\Utils\Singleton
/**
* Creates a new temporary invoice
*
* @param QUI\Interfaces\Users\User|null $User
* @param bool|string $globalProcessId - hash of the process
* @return InvoiceTemporary
* @throws
* @throws QUI\Exception
* @throws QUI\Lock\Exception
* @throws Exception
*/
public function createInvoice(
QUI\Interfaces\Users\User $User = null,
bool|string $globalProcessId = false
null | QUI\Interfaces\Users\User $User = null,
bool | string $globalProcessId = false
): InvoiceTemporary {
if ($User === null) {
$User = QUI::getUserBySession();
......
.quiqqer-invoice-profile-invoices {
float: left;
:where(.quiqqer-invoice-profile-invoices-table) {
width: 100%;
}
.quiqqer-invoice-profile-invoices-table {
float: left;
width: 100%;
}
.quiqqer-invoice-profile-invoices-table th {
:where(.quiqqer-invoice-profile-invoices-table th) {
padding: 5px;
text-align: left;
}
.quiqqer-invoice-profile-invoices-table td {
:where(.quiqqer-invoice-profile-invoices-table td) {
padding: 5px;
}
.quiqqer-invoice-profile-invoices-table th:last-child,
.quiqqer-invoice-profile-invoices-table td:last-child {
.quiqqer-invoice-profile-invoices-table-th-invoice-dl,
.quiqqer-invoice-profile-invoices-table-invoice-dl {
text-align: center;
width: 100px;
}
......@@ -27,6 +21,6 @@
width: 140px;
}
.quiqqer-invoice-profile-invoices-table tbody tr:nth-child(odd) {
:where(.quiqqer-invoice-profile-invoices-table tbody tr:nth-child(even)) {
background: #f8f8f8;
}
\ No newline at end of file
<h1>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.title"}
</h1>
<section class="quiqqer-frontendUsers-profile-section quiqqer-frontendUsers-section--userInvoices">
<h2>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.title"}
</h2>
<table class="quiqqer-invoice-profile-invoices-table">
{if count($invoices)}
<thead>
<tr>
<th>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.id"}
</th>
<th>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.date"}
</th>
<th>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.download"}
</th>
</tr>
</thead>
{/if}
<tbody>
{foreach $invoices as $Invoice}
<tr class="quiqqer-invoice-profile-invoices-table-invoice">
<td class="quiqqer-invoice-profile-invoices-table-invoice-id">
{$Invoice->getId()}
</td>
<td class="quiqqer-invoice-profile-invoices-table-invoice-date">
{$Invoice->getDate()}
</td>
<td class="quiqqer-invoice-profile-invoices-table-invoice-dl">
<a href="{$Invoice->getDownloadLink()}" target="_blank">
<span class="fa fa-file-pdf-o fa-file-pdf"></span>
</a>
</td>
</tr>
{foreachelse}
<tr>
<td colspan="3">
<div class="invoice-message-empty-invoices">
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.empty.message"}
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
<table class="quiqqer-invoice-profile-invoices-table">
{if count($invoices)}
<thead>
<tr>
<th>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.id"}
</th>
<th>
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.date"}
</th>
<th class="quiqqer-invoice-profile-invoices-table-th-invoice-dl">
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.download"}
</th>
</tr>
</thead>
{/if}
<tbody>
{foreach $invoices as $Invoice}
<tr class="quiqqer-invoice-profile-invoices-table-invoice">
<td class="quiqqer-invoice-profile-invoices-table-invoice-id">
{$Invoice->getId()}
</td>
<td class="quiqqer-invoice-profile-invoices-table-invoice-date">
{$Invoice->getDate()}
</td>
<td class="quiqqer-invoice-profile-invoices-table-invoice-dl">
<a href="{$Invoice->getDownloadLink()}" target="_blank">
<span class="fa fa-file-pdf-o fa-file-pdf"></span>
</a>
</td>
</tr>
{foreachelse}
<tr>
<td colspan="3">
<div class="invoice-message-empty-invoices">
{locale group="quiqqer/invoice" var="control.frontendUsers.invoices.table.empty.message"}
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</section>
\ No newline at end of file
......@@ -97,7 +97,7 @@ public function getInvoicesByUser(QUI\Users\User $User): array
* @throws QUI\Lock\Exception
* @throws QUI\Exception
*/
public function delete(string|int $invoiceId, QUI\Interfaces\Users\User $User = null): void
public function delete(string | int $invoiceId, null | QUI\Interfaces\Users\User $User = null): void
{
$Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getInvoiceByString($invoiceId);
......@@ -269,7 +269,7 @@ public function countTemporaryInvoices(array $queryParams = []): int
*
* @throws QUI\Exception
*/
public function get(int|string $id): Invoice|InvoiceTemporary
public function get(int | string $id): Invoice | InvoiceTemporary
{
try {
return $this->getInvoice($id);
......@@ -288,7 +288,7 @@ public function get(int|string $id): Invoice|InvoiceTemporary
* @throws Exception
* @throws QUI\Exception
*/
public function getInvoice(int|string $id): Invoice
public function getInvoice(int | string $id): Invoice
{
return new Invoice($id, $this);
}
......@@ -302,7 +302,7 @@ public function getInvoice(int|string $id): Invoice
* @throws Exception
* @throws QUI\Exception
*/
public function getInvoiceByHash(string $hash): Invoice|InvoiceTemporary
public function getInvoiceByHash(string $hash): Invoice | InvoiceTemporary
{
$hash = QUI\Utils\Security\Orthos::clear($hash);
......@@ -347,7 +347,7 @@ public function getInvoiceByHash(string $hash): Invoice|InvoiceTemporary
* @throws Exception
* @throws QUI\Exception
*/
public function getInvoiceData(int|string $id): array
public function getInvoiceData(int | string $id): array
{
// check invoice via hash
$result = QUI::getDataBase()->fetch([
......@@ -434,7 +434,7 @@ public function temporaryInvoiceTable(): string
* @throws Exception
* @throws QUI\Exception
*/
public function getTemporaryInvoice(int|string $id): InvoiceTemporary
public function getTemporaryInvoice(int | string $id): InvoiceTemporary
{
return new InvoiceTemporary($id, $this);
}
......@@ -480,7 +480,7 @@ public function getTemporaryInvoiceByHash(string $hash): InvoiceTemporary
* @throws Exception
* @throws QUI\Exception
*/
public function getTemporaryInvoiceData(int|string $id): array
public function getTemporaryInvoiceData(int | string $id): array
{
$result = QUI::getDataBase()->fetch([
'from' => self::temporaryInvoiceTable(),
......
......@@ -101,7 +101,7 @@ class Invoice extends QUI\QDOM implements ErpEntityInterface, ErpTransactionsInt
/**
* @var null|ShippingInterface
*/
protected ShippingInterface|null $Shipping = null;
protected ShippingInterface | null $Shipping = null;
/**
* Invoice constructor.
......@@ -430,8 +430,8 @@ public function getEditor(): QUI\ERP\User
* - How many must be paid
*
* @return array
*
* @throws
* @throws Exception
* @throws QUI\Exception
*/
public function getPaidStatusInformation(): array
{
......@@ -549,7 +549,7 @@ public function getPayment(): Payment
*
* @return int|QUI\ERP\Shipping\Types\ShippingUnique|null
*/
public function getShipping(): int|QUI\ERP\Shipping\Types\ShippingUnique|null
public function getShipping(): int | QUI\ERP\Shipping\Types\ShippingUnique | null
{
return $this->Shipping;
}
......@@ -583,7 +583,7 @@ public function getInvoiceType(): int
*/
public function reversal(
string $reason = '',
QUI\Interfaces\Users\User $PermissionUser = null
null | QUI\Interfaces\Users\User $PermissionUser = null
): ?QUI\ERP\ErpEntityInterface {
// is canceled / reversal possible?
if (!Settings::getInstance()->get('invoice', 'storno')) {
......@@ -743,7 +743,7 @@ public function reversal(
* @throws QUI\Exception
* @throws QUI\Permissions\Exception
*/
public function cancellation(string $reason, QUI\Interfaces\Users\User $PermissionUser = null): int|string
public function cancellation(string $reason, null | QUI\Interfaces\Users\User $PermissionUser = null): int | string
{
return $this->reversal($reason, $PermissionUser)->getUUID();
}
......@@ -759,7 +759,7 @@ public function cancellation(string $reason, QUI\Interfaces\Users\User $Permissi
* @throws QUI\Exception
* @throws QUI\Permissions\Exception
*/
public function storno(string $reason, QUI\Interfaces\Users\User $PermissionUser = null): int|string
public function storno(string $reason, null | QUI\Interfaces\Users\User $PermissionUser = null): int | string
{
return $this->reversal($reason, $PermissionUser)->getUUID();
}
......@@ -776,8 +776,8 @@ public function storno(string $reason, QUI\Interfaces\Users\User $PermissionUser
* @throws QUI\Permissions\Exception
*/
public function copy(
QUI\Interfaces\Users\User $PermissionUser = null,
bool|string $globalProcessId = false
null | QUI\Interfaces\Users\User $PermissionUser = null,
bool | string $globalProcessId = false
): InvoiceTemporary {
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......@@ -893,16 +893,18 @@ public function copy(
* Create a credit note, set the invoice to credit note
* - Gutschrift
*
* @param null|QUI\Interfaces\Users\User $PermissionUser
* @param bool|string $globalProcessId
* @param null|User $PermissionUser
* @return InvoiceTemporary
*
* @throws Exception
* @throws ExceptionStack
* @throws QUI\Exception
* @throws QUI\Lock\Exception
* @throws QUI\Permissions\Exception
* @throws Exception
*/
public function createCreditNote(
QUI\Interfaces\Users\User $PermissionUser = null
null | QUI\Interfaces\Users\User $PermissionUser = null
): InvoiceTemporary {
// a credit node cant create a credit note
if ($this->getInvoiceType() === QUI\ERP\Constants::TYPE_INVOICE_CREDIT_NOTE) {
......@@ -1084,8 +1086,8 @@ public function createCreditNote(
* @throws QUI\Permissions\Exception
*/
public function createReversal(
QUI\Interfaces\Users\User $PermissionUser = null,
bool|string $globalProcessId = false
null | QUI\Interfaces\Users\User $PermissionUser = null,
bool | string $globalProcessId = false
): InvoiceTemporary {
Permission::checkPermission('quiqqer.invoice.reversal', $PermissionUser);
......@@ -1452,7 +1454,10 @@ protected function isTransactionIdAddedToInvoice(string $txId): bool
/**
* Calculates the payments and set the new part payments
*
* @throws
* @throws Exception
* @throws ExceptionStack
* @throws QUI\Database\Exception
* @throws QUI\Exception
*/
public function calculatePayments(): void
{
......@@ -1599,7 +1604,7 @@ public function setPaymentStatus(int $paymentStatus): void
*
* @throws QUI\Exception
*/
public function sendTo(string $recipient, bool|string $template = false): void
public function sendTo(string $recipient, bool | string $template = false): void
{
$type = $this->getInvoiceType();
$outputType = 'Invoice';
......@@ -1635,7 +1640,7 @@ public function sendTo(string $recipient, bool|string $template = false): void
*
* @throws QUI\Exception
*/
public function addComment(string $comment, QUI\Interfaces\Users\User $PermissionUser = null): void
public function addComment(string $comment, null | QUI\Interfaces\Users\User $PermissionUser = null): void
{
if (empty($comment)) {
return;
......@@ -1855,7 +1860,7 @@ public function setProcessingStatus(int $statusId): void
);
$this->setAttribute('processing_status', $Status->getId());
} catch (QUI\DataBase\Exception $Exception) {
} catch (QUI\Database\Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
}
......
......@@ -124,7 +124,7 @@ class InvoiceTemporary extends QUI\QDOM implements ErpEntityInterface, ErpTransa
/**
* @var array|false
*/
protected array|false $addressDelivery = [];
protected array | false $addressDelivery = [];
/**
* @var null|QUI\ERP\Currency\Currency
......@@ -477,7 +477,7 @@ public function getCustomer(): ?QUI\ERP\User
* @param string|QUI\ERP\Currency\Currency $currency
* @throws QUI\Exception
*/
public function setCurrency(QUI\ERP\Currency\Currency|string $currency): void
public function setCurrency(QUI\ERP\Currency\Currency | string $currency): void
{
if (is_string($currency)) {
try {
......@@ -685,7 +685,7 @@ public function hasRefund(): bool
* @throws QUI\Permissions\Exception
* @throws QUI\Exception
*/
public function setInvoiceType(int|string $type, QUI\Interfaces\Users\User $PermissionUser = null): void
public function setInvoiceType(int | string $type, null | QUI\Interfaces\Users\User $PermissionUser = null): void
{
QUI\Permissions\Permission::checkPermission(
'quiqqer.invoice.temporary.edit',
......@@ -729,7 +729,7 @@ public function setInvoiceType(int|string $type, QUI\Interfaces\Users\User $Perm
* @throws QUI\Lock\Exception
* @throws QUI\Exception
*/
public function save(QUI\Interfaces\Users\User $PermissionUser = null): void
public function save(null | QUI\Interfaces\Users\User $PermissionUser = null): void
{
$this->update($PermissionUser);
}
......@@ -743,7 +743,7 @@ public function save(QUI\Interfaces\Users\User $PermissionUser = null): void
* @throws QUI\Lock\Exception
* @throws QUI\Exception
*/
public function update(QUI\Interfaces\Users\User $PermissionUser = null): void
public function update(null | QUI\Interfaces\Users\User $PermissionUser = null): void
{
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......@@ -1073,7 +1073,7 @@ public function update(QUI\Interfaces\Users\User $PermissionUser = null): void
* @throws QUI\Lock\Exception
* @throws QUI\Exception
*/
public function delete(QUI\Interfaces\Users\User $PermissionUser = null): void
public function delete(null | QUI\Interfaces\Users\User $PermissionUser = null): void
{
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......@@ -1102,8 +1102,10 @@ public function delete(QUI\Interfaces\Users\User $PermissionUser = null): void
* @param QUI\Interfaces\Users\User|null $PermissionUser
* @return ErpEntityInterface|null
*/
public function reversal(string $reason = '', QUI\Interfaces\Users\User $PermissionUser = null): ?ErpEntityInterface
{
public function reversal(
string $reason = '',
null | QUI\Interfaces\Users\User $PermissionUser = null
): ?ErpEntityInterface {
return null;
}
......@@ -1121,8 +1123,8 @@ public function reversal(string $reason = '', QUI\Interfaces\Users\User $Permiss
* @throws Exception
*/
public function copy(
QUI\Interfaces\Users\User $PermissionUser = null,
bool|string $globalProcessId = false
null | QUI\Interfaces\Users\User $PermissionUser = null,
bool | string $globalProcessId = false
): InvoiceTemporary {
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......@@ -1199,7 +1201,7 @@ public function copy(
* @throws QUI\Permissions\Exception
* @throws QUI\Exception
*/
public function post(QUI\Interfaces\Users\User $PermissionUser = null): Invoice
public function post(null | QUI\Interfaces\Users\User $PermissionUser = null): Invoice
{
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......@@ -1624,7 +1626,7 @@ public function post(QUI\Interfaces\Users\User $PermissionUser = null): Invoice
* @throws QUI\Permissions\Exception
* @throws QUI\Exception
*/
public function createInvoice(QUI\Interfaces\Users\User $PermissionUser = null): Invoice
public function createInvoice(null | QUI\Interfaces\Users\User $PermissionUser = null): Invoice
{
return $this->post($PermissionUser);
}
......@@ -1887,7 +1889,10 @@ protected function isTransactionIdAdded(string $txId): bool
/**
* Calculates the payments and set the new part payments
*
* @throws
* @throws Exception
* @throws ExceptionStack
* @throws QUI\Database\Exception
* @throws QUI\Exception
*/
public function calculatePayments(): void
{
......@@ -2464,7 +2469,7 @@ public function getDeliveryAddress(): ?QUI\ERP\Address
*
* @param array|QUI\ERP\Address $address
*/
public function setDeliveryAddress(array|QUI\ERP\Address $address): void
public function setDeliveryAddress(array | QUI\ERP\Address $address): void
{
if ($address instanceof QUI\ERP\Address) {
$this->addressDelivery = $address->getAttributes();
......
......@@ -27,30 +27,22 @@ class InvoiceView extends QUI\QDOM
/**
* @var Invoice|InvoiceTemporary
*/
protected InvoiceTemporary|Invoice $Invoice;
protected InvoiceTemporary | Invoice $Invoice;
/**
* InvoiceView constructor.
*
* @param Invoice|InvoiceTemporary $Invoice
*
* @throws Exception
*/
public function __construct(Invoice|InvoiceTemporary $Invoice)
public function __construct(Invoice | InvoiceTemporary $Invoice)
{
if ($Invoice instanceof Invoice || $Invoice instanceof InvoiceTemporary) {
$this->Invoice = $Invoice;
return;
}
throw new Exception('$Invoice must be an instance of Invoice or InvoiceTemporary');
$this->Invoice = $Invoice;
}
/**
* @return QUI\ERP\Accounting\ArticleList|QUI\ERP\Accounting\ArticleListUnique
*/
public function getArticles(): QUI\ERP\Accounting\ArticleList|QUI\ERP\Accounting\ArticleListUnique
public function getArticles(): QUI\ERP\Accounting\ArticleList | QUI\ERP\Accounting\ArticleListUnique
{
try {
return $this->Invoice->getArticles();
......@@ -90,7 +82,7 @@ public function getCurrency(): QUI\ERP\Currency\Currency
/**
* @return false|null|QUI\ERP\User|QUI\Users\Nobody|QUI\Users\SystemUser|QUI\Users\User
*/
public function getCustomer(): bool|QUI\Users\SystemUser|QUI\Users\Nobody|QUI\ERP\User|QUI\Users\User|null
public function getCustomer(): bool | QUI\Users\SystemUser | QUI\Users\Nobody | QUI\ERP\User | QUI\Users\User | null
{
try {
return $this->Invoice->getCustomer();
......@@ -103,7 +95,7 @@ public function getCustomer(): bool|QUI\Users\SystemUser|QUI\Users\Nobody|QUI\ER
* @param null|QUI\Locale $Locale
* @return string|bool
*/
public function getDate(QUI\Locale $Locale = null): string|bool
public function getDate(null | QUI\Locale $Locale = null): string | bool
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -120,7 +112,7 @@ public function getDate(QUI\Locale $Locale = null): string|bool
* @param null $Locale
* @return false|string
*/
public function formatDate($dateString, $Locale = null): bool|string
public function formatDate($dateString, $Locale = null): bool | string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -160,7 +152,7 @@ public function getPayment(): Payment
/**
* @return Invoice|InvoiceTemporary
*/
public function getInvoice(): Invoice|InvoiceTemporary
public function getInvoice(): Invoice | InvoiceTemporary
{
return $this->Invoice;
}
......@@ -308,7 +300,11 @@ class_exists('QUI\ERP\Accounting\Payments\Methods\AdvancePayment\Payment')
} else {
$timeForPayment = $Locale->get('quiqqer/invoice', 'additional.invoice.text.timeForPayment.0');
}
} else {
}
/*
// Else is unreachable because previous condition is always true.
else {
$timeForPayment = strtotime($timeForPayment);
if (date('Y-m-d') === date('Y-m-d', $timeForPayment)) {
......@@ -317,6 +313,7 @@ class_exists('QUI\ERP\Accounting\Payments\Methods\AdvancePayment\Payment')
$timeForPayment = $Formatter->format($timeForPayment);
}
}
*/
return $Locale->get(
'quiqqer/invoice',
......
......@@ -34,7 +34,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale()
* @return string
*/
public static function getEntityTypeTitle(Locale $Locale = null): string
public static function getEntityTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......@@ -51,7 +51,7 @@ public static function getEntityTypeTitle(Locale $Locale = null): string
*
* @throws QUI\Exception
*/
public static function getMailSubject(int|string $entityId): string
public static function getMailSubject(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -91,7 +91,7 @@ public static function getMailSubject(int|string $entityId): string
*
* @throws QUI\Exception
*/
public static function getMailBody(int|string $entityId): string
public static function getMailBody(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......
......@@ -34,7 +34,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale()
* @return string
*/
public static function getEntityTypeTitle(Locale $Locale = null): string
public static function getEntityTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......@@ -51,7 +51,7 @@ public static function getEntityTypeTitle(Locale $Locale = null): string
*
* @throws QUI\Exception
*/
public static function getMailSubject(int|string $entityId): string
public static function getMailSubject(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -91,7 +91,7 @@ public static function getMailSubject(int|string $entityId): string
*
* @throws QUI\Exception
*/
public static function getMailBody(int|string $entityId): string
public static function getMailBody(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......
......@@ -60,7 +60,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If ommitted use \QUI::getLocale()
* @return string
*/
public static function getEntityTypeTitle(Locale $Locale = null): string
public static function getEntityTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......@@ -77,7 +77,7 @@ public static function getEntityTypeTitle(Locale $Locale = null): string
*
* @throws QUI\Exception
*/
public static function getEntity(int|string $entityId): Invoice|InvoiceTemporary
public static function getEntity(int | string $entityId): Invoice | InvoiceTemporary
{
return InvoiceUtils::getInvoiceByString($entityId);
}
......@@ -90,7 +90,7 @@ public static function getEntity(int|string $entityId): Invoice|InvoiceTemporary
*
* @throws QUI\Exception
*/
public static function getDownloadFileName(int|string $entityId): string
public static function getDownloadFileName(int | string $entityId): string
{
return InvoiceUtils::getInvoiceFilename(self::getEntity($entityId));
}
......@@ -103,7 +103,7 @@ public static function getDownloadFileName(int|string $entityId): string
*
* @throws QUI\Exception
*/
public static function getLocale(int|string $entityId): Locale
public static function getLocale(int | string $entityId): Locale
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -125,7 +125,7 @@ public static function getLocale(int|string $entityId): Locale
* @throws QUI\ERP\Exception
* @throws QUI\Exception
*/
public static function getTemplateData(int|string $entityId): array
public static function getTemplateData(int | string $entityId): array
{
$Invoice = self::getEntity($entityId);
$InvoiceView = $Invoice->getView();
......@@ -168,8 +168,13 @@ public static function getTemplateData(int|string $entityId): array
$Articles = $Invoice->getArticles();
if (get_class($Articles) !== QUI\ERP\Accounting\ArticleListUnique::class) {
$Articles->setUser($Customer);
$Articles = $Articles->toUniqueList();
if (method_exists($Articles, 'setUser')) {
$Articles->setUser($Customer);
}
if (method_exists($Articles, 'toUniqueList')) {
$Articles = $Articles->toUniqueList();
}
}
// Delivery address
......@@ -243,7 +248,7 @@ public static function getTemplateData(int|string $entityId): array
* @param User $User
* @return bool
*/
public static function hasDownloadPermission(int|string $entityId, User $User): bool
public static function hasDownloadPermission(int | string $entityId, User $User): bool
{
if (!QUI::getUsers()->isAuth($User) || QUI::getUsers()->isNobodyUser($User)) {
return false;
......@@ -273,7 +278,7 @@ public static function hasDownloadPermission(int|string $entityId, User $User):
*
* @throws QUI\Exception
*/
public static function getEmailAddress(int|string $entityId): bool|string
public static function getEmailAddress(int | string $entityId): bool | string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -297,7 +302,7 @@ public static function getEmailAddress(int|string $entityId): bool|string
*
* @throws QUI\Exception
*/
public static function getMailSubject(int|string $entityId): string
public static function getMailSubject(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -317,7 +322,7 @@ public static function getMailSubject(int|string $entityId): string
*
* @throws QUI\Exception
*/
public static function getMailBody(int|string $entityId): string
public static function getMailBody(int | string $entityId): string
{
$Invoice = self::getEntity($entityId);
$Customer = $Invoice->getCustomer();
......@@ -335,7 +340,7 @@ public static function getMailBody(int|string $entityId): string
* @return array
*/
protected static function getInvoiceLocaleVar(
Invoice|InvoiceTemporary $Invoice,
Invoice | InvoiceTemporary $Invoice,
QUI\ERP\User $Customer
): array {
$CustomerAddress = $Customer->getAddress();
......@@ -471,7 +476,7 @@ public static function getCustomerVariables(QUI\ERP\User $Customer): array
* @param $date
* @return false|string
*/
public static function dateFormat($date): bool|string
public static function dateFormat($date): bool | string
{
// date
$localeCode = QUI::getLocale()->getLocalesByLang(
......@@ -499,7 +504,7 @@ public static function dateFormat($date): bool|string
* @param Invoice|InvoiceTemporary $Invoice
* @return string|false - Raw <img> "src" attribute with base64 image data or false if code can or must not be generated.
*/
protected static function getEpcQrCodeImageImgSrc(Invoice|InvoiceTemporary $Invoice): bool|string
protected static function getEpcQrCodeImageImgSrc(Invoice | InvoiceTemporary $Invoice): bool | string
{
try {
// Check currency (must be EUR)
......
......@@ -64,7 +64,7 @@ public function __construct(array $paymentData = [])
* @param null|QUI\Locale $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if (!isset($this->attributes['title'])) {
return '';
......@@ -89,7 +89,7 @@ public function getTitle(QUI\Locale $Locale = null): string
* @param null|QUI\Locale $Locale
* @return mixed|string
*/
public function getDescription(QUI\Locale $Locale = null): mixed
public function getDescription(null | QUI\Locale $Locale = null): mixed
{
if (!isset($this->attributes['description'])) {
return '';
......@@ -146,7 +146,7 @@ protected function getPayment(): ?QUI\ERP\Accounting\Payments\Types\Payment
* @param Invoice|InvoiceTemporary|InvoiceView $Invoice
* @return string
*/
public function getInvoiceInformationText(Invoice|InvoiceTemporary|InvoiceView $Invoice): string
public function getInvoiceInformationText(Invoice | InvoiceTemporary | InvoiceView $Invoice): string
{
if ($Invoice instanceof InvoiceView) {
$Invoice = $Invoice->getInvoice();
......
......@@ -19,7 +19,7 @@ class PaymentReceiver implements PaymentReceiverInterface
/**
* @var null|InvoiceTemporary|Invoice $Invoice
*/
protected null|InvoiceTemporary|Invoice $Invoice = null;
protected null | InvoiceTemporary | Invoice $Invoice = null;
/**
* Get entity type descriptor
......@@ -37,7 +37,7 @@ public static function getType(): string
* @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale()
* @return string
*/
public static function getTypeTitle(Locale $Locale = null): string
public static function getTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......@@ -64,7 +64,7 @@ public function __construct($id)
* @throws Exception
* @throws QUI\ERP\Exception
*/
public function getDebtorAddress(): bool|Address
public function getDebtorAddress(): bool | Address
{
return $this->Invoice->getCustomer()->getStandardAddress();
}
......@@ -116,7 +116,7 @@ public function getDate(): DateTime
*
* @return DateTime|false
*/
public function getDueDate(): DateTime|bool
public function getDueDate(): DateTime | bool
{
$date = $this->Invoice->getAttribute('time_for_payment');
......@@ -175,7 +175,7 @@ public function getAmountPaid(): float
*
* @return PaymentInterface|false
*/
public function getPaymentMethod(): bool|PaymentInterface
public function getPaymentMethod(): bool | PaymentInterface
{
try {
return QUI\ERP\Accounting\Payments\Payments::getInstance()->getPayment(
......
......@@ -32,7 +32,7 @@ class Factory extends QUI\Utils\Singleton
* @todo permissions
*/
public function createProcessingStatus(
int|string $id,
int | string $id,
string $color,
array $title,
array $options = []
......@@ -54,7 +54,7 @@ public function createProcessingStatus(
$Config->setValue(
'processing_status',
$id,
(string)$id,
json_encode([
'color' => $color,
'options' => $options
......
......@@ -121,7 +121,7 @@ public function deleteProcessingStatus(int|string $id): void
$Package = QUI::getPackage('quiqqer/invoice');
$Config = $Package->getConfig();
$Config->del('processing_status', $Status->getId());
$Config->del('processing_status', (string)$Status->getId());
$Config->save();
}
......@@ -177,7 +177,7 @@ public function updateProcessingStatus(
$Config->setValue(
'processing_status',
$Status->getId(),
(string)$Status->getId(),
json_encode([
'color' => $color,
'options' => $options
......
......@@ -44,7 +44,7 @@ class Status
* @param int|string $id - Processing status id
* @throws Exception
*/
public function __construct(int|string $id)
public function __construct(int | string $id)
{
$list = Handler::getInstance()->getList();
......@@ -90,7 +90,7 @@ public function getId(): int
* @param null|QUI\Locale $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if (!($Locale instanceof QUI\Locale)) {
$Locale = QUI::getLocale();
......@@ -159,7 +159,7 @@ public function getOptions(): array
* @param null|QUI\Locale $Locale - optional. if no locale, all translations would be returned
* @return array
*/
public function toArray(QUI\Locale $Locale = null): array
public function toArray(null | QUI\Locale $Locale = null): array
{
$title = $this->getTitle($Locale);
......
......@@ -57,7 +57,7 @@ class InvoiceSearch extends Singleton
/**
* @var array|bool
*/
protected array|bool $limit = [0, 20];
protected array | bool $limit = [0, 20];
/**
* @var string
......@@ -85,7 +85,7 @@ class InvoiceSearch extends Singleton
* @param array|string $value
* @throws QUI\Exception
*/
public function setFilter(string $filter, array|string $value): void
public function setFilter(string $filter, array | string $value): void
{
if ($filter === 'search') {
$this->search = $value;
......@@ -201,7 +201,7 @@ public function disableCalcTotal(): void
* @param int|string $from
* @param int|string $to
*/
public function limit(int|string $from, int|string $to): void
public function limit(int | string $from, int | string $to): void
{
$this->limit = [(int)$from, (int)$to];
}
......@@ -437,7 +437,7 @@ protected function getQuery(bool $count = false): array
break;
case 'customer_id':
$value = (int)$filter['value'];
$value = (string)$filter['value'];
$where[] = $flr . ' = ' . $bind;
// remove customer prefix, for better search
......@@ -453,7 +453,7 @@ protected function getQuery(bool $count = false): array
}
$binds[$bind] = [
'value' => $value,
'value' => (int)$value,
'type' => PDO::PARAM_INT
];
......@@ -803,7 +803,7 @@ protected function parseListForGrid(array $data): array
if ($Customer->getAttribute('customerId')) {
$invoiceData['customer_id_display'] = $Customer->getAttribute('customerId');
$invoiceData['customer_id'] = $Customer->getUUID() ?? $Customer->getId();
$invoiceData['customer_id'] = $Customer->getUUID() ?: $Customer->getId();
} else {
$invoiceData['customer_id_display'] = '';
$invoiceData['customer_id'] = '';
......
......@@ -56,7 +56,7 @@ class Invoice
*
* @throws QUI\Exception
*/
public static function getInvoiceByString(int|string $str): QUI\ERP\Accounting\Invoice\Invoice|InvoiceTemporary
public static function getInvoiceByString(int | string $str): QUI\ERP\Accounting\Invoice\Invoice | InvoiceTemporary
{
$Invoices = QUI\ERP\Accounting\Invoice\Handler::getInstance();
......@@ -384,7 +384,7 @@ public static function getMissingAttributeMessage(string $missingAttribute): str
* @param array|string $articles
* @return array|string
*/
public static function formatArticlesArray(array|string $articles): array|string
public static function formatArticlesArray(array | string $articles): array | string
{
$isString = is_string($articles);
......@@ -438,7 +438,7 @@ public static function formatArticlesArray(array|string $articles): array|string
*/
protected static function verificateField(
$value,
array|string $eMessage = 'Error occurred',
array | string $eMessage = 'Error occurred',
int $eCode = 0,
array $eContext = []
): void {
......@@ -457,16 +457,9 @@ protected static function verificateField(
* @throws QUI\Exception
*/
public static function getInvoiceFilename(
QUI\ERP\Accounting\Invoice\Invoice|InvoiceTemporary $Invoice,
QUI\ERP\Accounting\Invoice\Invoice | InvoiceTemporary $Invoice,
?QUI\Locale $Locale = null
): string {
if (
!($Invoice instanceof QUI\ERP\Accounting\Invoice\Invoice) &&
!($Invoice instanceof QUI\ERP\Accounting\Invoice\InvoiceTemporary)
) {
return '';
}
// date
$localeCode = QUI::getLocale()->getLocalesByLang(
QUI::getLocale()->getCurrent()
......@@ -524,9 +517,9 @@ public static function getInvoiceFilename(
* @return int|float
*/
public static function roundInvoiceSum(
float|int $amount,
float | int $amount,
?QUI\ERP\Currency\Currency $Currency = null
): float|int {
): float | int {
if ($Currency === null) {
$Currency = QUI\ERP\Defaults::getCurrency();
......@@ -544,14 +537,14 @@ public static function roundInvoiceSum(
* @param Invoice|InvoiceTemporary $Invoice
* @return int - Unix Timestamp
*/
public static function getInvoiceTimeForPaymentDate(InvoiceTemporary|Invoice $Invoice): int
public static function getInvoiceTimeForPaymentDate(InvoiceTemporary | Invoice $Invoice): int
{
$timeForPayment = $Invoice->getAttribute('time_for_payment');
if ($Invoice instanceof QUI\ERP\Accounting\Invoice\InvoiceTemporary) {
$timeForPayment = (int)$timeForPayment;
if ($timeForPayment || $timeForPayment === 0) {
if ($timeForPayment >= 0) {
$timeForPayment = strtotime('+' . $timeForPayment . ' day');
}
} else {
......@@ -567,7 +560,7 @@ public static function getInvoiceTimeForPaymentDate(InvoiceTemporary|Invoice $In
* @return array
*/
public static function getVatTextArrayFromVatArray(
array|string $vatArray,
array | string $vatArray,
QUI\ERP\Currency\Currency $Currency
): array {
if (is_string($vatArray)) {
......@@ -587,7 +580,7 @@ public static function getVatTextArrayFromVatArray(
* @param array|string $vatArray
* @return array
*/
public static function getVatSumArrayFromVatArray(array|string $vatArray): array
public static function getVatSumArrayFromVatArray(array | string $vatArray): array
{
if (is_string($vatArray)) {
$vatArray = json_decode($vatArray, true);
......@@ -608,7 +601,7 @@ public static function getVatSumArrayFromVatArray(array|string $vatArray): array
* @param array|string $vatArray
* @return int|float
*/
public static function getVatSumFromVatArray(array|string $vatArray): float|int
public static function getVatSumFromVatArray(array | string $vatArray): float | int
{
return array_sum(
self::getVatSumArrayFromVatArray($vatArray)
......@@ -622,7 +615,7 @@ public static function getVatSumFromVatArray(array|string $vatArray): float|int
* @param QUI\ERP\Accounting\Invoice\Invoice|integer|string $Invoice - Invoice or Invoice ID
* @return array
*/
public static function getTransactionsByInvoice(QUI\ERP\Accounting\Invoice\Invoice|int|string $Invoice): array
public static function getTransactionsByInvoice(QUI\ERP\Accounting\Invoice\Invoice | int | string $Invoice): array
{
if (!($Invoice instanceof QUI\ERP\Accounting\Invoice\Invoice)) {
try {
......@@ -671,7 +664,7 @@ public static function addressRequirementThreshold(): float
}
public static function getElectronicInvoice(
InvoiceTemporary|QUI\ERP\Accounting\Invoice\Invoice $Invoice,
InvoiceTemporary | QUI\ERP\Accounting\Invoice\Invoice $Invoice,
$type = ZugferdProfiles::PROFILE_EN16931
): ZugferdDocumentBuilder {
$document = ZugferdDocumentBuilder::CreateNew($type);
......