Skip to content

Transaktions-Buchung auf Rechnung sehr verwirrend / falsch

Vorgehen:

  1. Zahlungs-Transaktion erstellen über \QUI\ERP\Accounting\Payments\Transactions\Factory::createPaymentTransaction()
  2. Das Invoice-Modul reagiert darauf über \QUI\ERP\Accounting\Invoice\EventHandler::onTransactionCreate()
  3. In $Invoice->addTransaction() wird ein QUI\ERP\Accounting\Calc::calculatePayments($this) ausgeführt (s. https://dev.quiqqer.com/quiqqer/invoice/-/blob/master/src/QUI/ERP/Accounting/Invoice/Invoice.php#L925)

Das bewirkt folgendes:

Probleme:

  • Es werden keinerlei quiqqerInvoiceAddTransaction-Events gefeuert
  • Die Invoice ist in der Datenbank NICHT (!) als bezahlt markiert
  • Die Invoice wird erst dann als bezahlt markiert, wenn irgendwo $Invoice->calculatePayments() aufgerufen wird, weil da der paid_status auch in die Datenbank geschrieben wird

Generell ist der Zahlungsstatus der Invoice davon abhängig, das irgendwo $Invoice->calculatePayments() gemacht wird. Das ist aber nicht zwangsweise gegeben, nachdem man eine Transaktion hinzufügt. Das funktioniert aktuell nur, weil wir überall, wo die Rechnung geladen wird, zufällig auch $Invoice->getPaidStatusInformation() aufrufen.

Im Endeffekt: