sinabe / dolibarr-swissqr

Swiss QR invoice for Dolibarr
7 stars 3 forks source link

Error 500 when previewing the invoice in setup screen #5

Open martignoni opened 1 year ago

martignoni commented 1 year ago

An error 500 occurs when previewing the invoice specimen in the setup screen. The PDF works however correctly when creating an invoice using the invoice module.

Steps to reproduce:

  1. Install SwissQR module and activate it following instructions
  2. On Setup -> Modules/Applications -> Invoices, click the Preview icon
  3. Error 500 is displayed

Trace in error log:

2023/03/11 18:01:51 [error] 1893167#1893167: *1117659 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Sprain\SwissQrBill\DataGroup\Element\CombinedAddress::create() must be of the type string, null given, called in .../html/core/modules/facture/doc/pdf_swissqr.modules.php on line 928 and defined in .../html/core/modules/facture/doc/vendor/sprain/swiss-qr-bill/src/DataGroup/Element/CombinedAddress.php:54
Stack trace:
#0 .../html/core/modules/facture/doc/pdf_swissqr.modules.php(928): Sprain\SwissQrBill\DataGroup\Element\CombinedAddress::create()
#1 .../html/core/modules/facture/doc/pdf_swissqr.modules.php(860): pdf_swissqr->qrinvoice()
#2 .../html/admin/facture.php(112): pdf_swissqr->write_file()
#3 {main}
  thrown in .../html/core/modules/facture/doc/vendor/sprain/swiss-qr-bill/src/DataGroup/Element/CombinedAddress.php on line 54" while reading response header from upstream, client: 51.154.14.55, server: redacted, request: "GET /admin/facture.php?action=specimen&module=swissqr HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "redacted", referrer: "https://redacted/admin/facture.php?save_lastsearch_values=1&backtopage=%2Fadmin%2Fmodules.php%3Fsearch_keyword%3Dfac"

Context:

PS. A big thank you for this (very useful) module ❤️