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