diff --git a/src/QUI/ERP/Accounting/Invoice/Invoice.php b/src/QUI/ERP/Accounting/Invoice/Invoice.php index 73c7ccc57a7568516e3c425960e39d5d013a6e49..e4b1e8e5ced9b3cde28b37acdc022d7f4531590d 100644 --- a/src/QUI/ERP/Accounting/Invoice/Invoice.php +++ b/src/QUI/ERP/Accounting/Invoice/Invoice.php @@ -899,8 +899,7 @@ public function copy( * @throws QUI\Permissions\Exception */ public function createCreditNote( - QUI\Interfaces\Users\User $PermissionUser = null, - bool|string $globalProcessId = false + 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) { @@ -920,7 +919,7 @@ public function createCreditNote( [$this] ); - $Copy = $this->copy(QUI::getUsers()->getSystemUser(), $globalProcessId); + $Copy = $this->copy(QUI::getUsers()->getSystemUser(), $this->getGlobalProcessId()); $articles = $Copy->getArticles()->getArticles(); // change all prices @@ -1029,7 +1028,7 @@ public function createCreditNote( $Copy->setAttribute('date', date('Y-m-d H:i:s')); $Copy->setAttribute('additional_invoice_text', $additionalText); $Copy->setAttribute('currency_data', $this->getAttribute('currency_data')); - $Copy->setInvoiceType(QUI\ERP\Constants::TYPE_INVOICE_CREDIT_NOTE); + $Copy->setInvoiceType(QUI\ERP\Constants::TYPE_INVOICE_CREDIT_NOTE, QUI::getUsers()->getSystemUser()); if ($this->getAttribute('invoice_address')) { try { @@ -1209,7 +1208,7 @@ public function createReversal( $Copy->setAttribute('date', date('Y-m-d H:i:s')); $Copy->setAttribute('additional_invoice_text', $additionalText); $Copy->setAttribute('currency_data', $this->getAttribute('currency_data')); - $Copy->setInvoiceType(QUI\ERP\Constants::TYPE_INVOICE_REVERSAL); + $Copy->setInvoiceType(QUI\ERP\Constants::TYPE_INVOICE_REVERSAL, QUI::getUsers()->getSystemUser()); if ($this->getAttribute('invoice_address')) { try {