Custom fields in partial_invoice_table.php

Hi to all,

I’m from Italy, and I have a special tax system. For the Italian law, I’ve to add a number called “marca da bollo” to each invoice, so I created a custom field and in the pdf template I print the number when I need it.

To make easy for me to detect which invoice has a specific number (“marca da bollo”), I edited the file partial_invoice_table.php, and with the previous custom field system (until version 1.4.10), this part of code worked well:

<th><?php echo lang('client_name'); ?></th>
<th><?php echo "Marca da bollo"; ?></th>
<th style="text-align: right;"><?php echo lang('amount'); ?></th>


  <a href="<?php echo site_url('clients/view/' . $invoice->client_id); ?>" title="<?php echo lang('view_client'); ?>">
     <?php echo $invoice->client_name; ?>
  <?php echo nl2br($invoice->invoice_custom_id_marca_da_bollo); ?>
<td class="amount <?php if ($invoice->invoice_sign == '-1') { echo 'text-danger'; }; ?>">
  <?php echo format_currency($invoice->invoice_total); ?>

Now, obviously, if I try to print the custom field with the new syntax $custom_fields['invoice']['ID marca da bollo'], I get an error telling me that $custom_fields it’s not declared.

My question is: how can I get the custom field provided above and print it in the partial_invoice_table.php file?

Thanks in advance for the collaboration.

Please take a look at

Hi, thank you so much!

Adding this fixed the problem for me:

<?php $CI = &get_instance();
$custom_fields = array(
  'invoice' => $CI->mdl_custom_fields->get_values_for_fields('mdl_invoice_custom', $invoice->invoice_id),
); ?>
  echo nl2br($custom_fields['invoice']['ID marca da bollo']);
1 Like

Using code from Custom fields in partial_invoice_table.php, I added columns with custom or looked-up values to either quote and invoice which worked well but when I went to the client form, it crashed complaining about the partial_invoice_table.php or partial_quote_table.php changes I did.

I had to revert all changes to get the client page to work again.

Luckily, the same edits to the dashboard are supported!

I guess this is because the invoice, quote and payments views are ‘linked’ to the client view but do not succeed to fix this dependency.

I’ve found a workaround to fix this issue, you can find the workaround here.

With this fix, I’ve disabled the custom fields in table view when InvoicePlane is displaying the client view and not the invoice view.

I hope it can help.

With your variable flag method I could add to quotes and invoice partial tables without messing up the corresponding views in the clients pages.

grazie Valentino :wink:

1 Like

Thank you for this solution, I was able to add my customs fields in quotes and delete the error in client view, but what if I want this custom field to be shown in client quotes also ?? anybody had another solution ?
PS: I have an old version 1.5.3 that I can’t upgrade because I did a lot of changes.

thank you