I have installed a test version of 1.5.0, taking a backup of my database then essentially doing a clean install and then copying my templates and other assets over but I am still facing the same problem I had when I tried Beta 3 - I cannot get the custom fields to show on my invoice (mainly because I do not understand the new format and I’m not sure if the wiki actually refers to the new format).
My existing fields seem to have migrated over fine, but to be sure, I have set up a brand new field called “TEST” under the Invoice node and still cannot work it out.
The following code used to show the contact name on my invoice (if one was present) now I just get a PHP error;
<?php if ($invoice->client_custom_contact) {
echo 'FAO: ' . $invoice->client_custom_contact . '<br/>';
} ?>
In my config, the above field (as migrated by 1.5.0) is configured as follows;
Table: Client
Label: Contact
Type: Text
Order: 999
In my invoice which I am using to test this, “Contact” has a value of “TEST”.
I have added the
<pre><?php print_r($custom_fields); ?></pre>
Code to the bottom of my invoice, and I can see the fields are populated, but how to add them to my invoice is not clear at all (the wiki text and screenshot are not aligned so I wonder if it’s still not updated for 1.5.0?)
[client] => Array
(
[Company Number] => XXX
[Contact] => TEST
[Invoice Terms] => 14
[Purchase Order Number] => TEST
)
The following error (quite understandably) is logged for each custom field in my templates;
ERROR - 2017-04-24 08:57:38 --> Severity: Notice --> Undefined property: stdClass::$client_custom_contact /xxx/xxx/invoices/application/views/invoice_templates/pdf/xxx-default.php 69