Skip to content

"payments" array variable gets lost for invoices, when there have been any payments #1096

@der-peer

Description

@der-peer

The variables available for use in an invoice pdf consist of an array "payments".
If there has been no payment, the array is there and empty.
As soon as a payment has been added, the array is no longer available.

Expected Behavior

The array should be there and contain the payments, that are connected with the invoice. Each with date, payment type and amount (at least).

Current Behavior

to see it: enable output of variables in the pdf: print_r($invoice);

With no payment, output contains:

...  
[payment_method] => 1  
[creditinvoice_parent_id] =>  
[payments] => Array  
  (  
  )  

As soon, as a payment is added, the part "payments" is gone. It can also not be queried via $invoice->payments.

Steps to Reproduce

see above

Context (Environment)

Up to v1.5.9 I was able to use the payments-array, to print a "paid"-stamp on my invoices, when the balance was 0. I even was able to insert the date of the final payment, to see if everything was fine. Like this:

		<?php if ($invoice->invoice_balance == 0) { ?>
                        <div id="paidstamp">
                              <p><?php echo date_from_mysql(max(array_column($invoice->payments, "payment_date"))); ?></p>
                        </div>
                 <?php } ?>

It doesn't work anymore, therefore had to delete my "stamp" 😥

Failure Logs

The logs under application/logs don't say anything about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions