Skip to content

Error to generate pdf when invoice balance == 0 (if qr activated) #1214

@sudwebdesign

Description

@sudwebdesign

Become an error (with qr library) and pdf not generated.

step to reproduce

  • 1: edit an invoice and for all item set for full discount (total == 0)
  • 2: get pdf (admin or public)
  • 3: Show only html

Note:
invoice have a paid image (in public access GUI)

Screen shots (of amounts)

Admin invoice edit

Image

Print (Only html showed)

Image

Note (in production IP say nothing)

Public access (GUI)

Image

Note in development mode, IP say:
An uncaught Exception was encountered

SepaQr\Exception

Message: ** Amount of the credit transfer cannot be smaller than 0.01 Euro **
Full Backtrace LOG
An uncaught Exception was encountered

Type: SepaQr\Exception

Message: Amount of the credit transfer cannot be smaller than 0.01 Euro

Filename: vendor/smhg/sepa-qr-data/src/Data.php

Line Number: 129

Backtrace:

File: application/libraries/QrCode.php
Line: 51
Function: setAmount

File: application/libraries/QrCode.php
Line: 59
Function: paymentData

File: application/helpers/invoice_helper.php
Line: 133
Function: generate

File: application/views/invoice_templates/pdf/InvoicePlane.php
Line: 271
Function: invoice_qrcode

File: application/third_party/MX/Loader.php
Line: 480
Function: include

File: application/third_party/MX/Loader.php
Line: 428
Function: _ci_load

File: application/helpers/pdf_helper.php
Line: 127
Function: view

File: application/modules/invoices/controllers/Invoices.php
Line: 283
Function: generate_invoice_pdf

File: index.php
Line: 319
Function: require_once

Solution

Change

<?php if (get_setting('qr_code')) : ?>

To

<?php if ($invoice->invoice_balance > 0 and get_setting('qr_code')) : ?>

In

  • application/views/invoice_templates/pdf/InvoicePlane.php
  • application/views/invoice_templates/pdf/InvoicePlane - overdue.php

@nielsdrost7
This patch is effective on my local draft files and it work well (qr & bank info not showed) in pdf

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions