[Core]: Add template variable for Contact (Invoicing) - Email Template
Title
Email template is lacking of Contact (Invoicing) which was added to user's information
Feature Description
Email template is lacking of Contact (Invoicing) which was added to user's information
Use Case
For someone use different email addresses for work and for finance or small team has dedicated accountant.
Additional Context (Optional)
No response
Priority Level
Medium
What do you mean?
This template?
application/views/invoice_templates/pdf/InvoicePlane.php
This is the Discord Invite link: https://discord.gg/PPzD2hTrXt
application/helpers/pdf_helper.php gets the data from mdl_invoices->get_by_id
and puts it in the $invoice variable
So you would have to test what is in that $invoice variable using the usual debugging tools. There is a big chance that $invoice->client_* all variables are there, so if you have added contact information on your client, you can see that in your $invoice variable.
Most likely you have added that extra contact information using "custom variables".
In that case don't look for the contents of $invoice, but for $custom_fields
These are the variables given to the PDF template:
$data = [
'invoice' => $invoice,
'invoice_tax_rates' => $CI->mdl_invoice_tax_rates->where('invoice_id', $invoice_id)->get()->result(),
'items' => $items,
'payment_method' => $payment_method,
'output_type' => 'pdf',
'show_item_discounts' => $show_item_discounts,
'custom_fields' => $custom_fields,
'legacy_calculation' => config_item('legacy_calculation'),
];
But use the usual debugging tools to find out the values that are "in" the variables
@nielsdrost7 Sorry bro, my fault. I mean in the Email Templates.
@jmseng That's ok man, I'll take another look for you. Would you mind adding information to the context please? Especially the place where you added extra contact information
- I have 1 customer: Microsoft Corporation
- Finances goes through [email protected]
- Contact goes through [email protected]
Where did you add what?
application/helpers/template_helper.php transforms those beautiful tags into something useful.
So if you want {{{contact_finances}}} and {{{contact_marketing}}} that's possible.
It depends a tiny bit on the context I requested to be added
@nielsdrost7 Ok, let's me explain more for you.
- You go to your profile in the admin area. Under
Contact Informationyou will seeContact (Invoicing)it's name that I believe developer create for same reason as I want. - While editing
Email Template, I want to have a newEmail Template Tagcall{{invoicing_contact}}or similar to get that information.
I see that field accept a text so mean you can use that in many way, your example is good one. In my mind right now, other situation we can use it to store company address.
Open application/helpers/template_helper.php and scroll to Line 25 (parse_template function)
You already see some of the possibilities.
I would have scrolled to "invoice_status" and under/after that break; give a couple of enters.
This is "invoice_status":
case 'invoice_status':
$replace = get_invoice_status($object->invoice_status_id);
break;
So now you need to add your own replace piece
case 'invoicing_contact':
$replace = get_invoicing_contact();
break;
That function doesn't exist.
Open application/helpers/user_helper.php
Copy/paste the format_user function and name it get_invoicing_contact
Very important: If you like that format_user function, you don't need to create a new function
@nielsdrost7 Thank you in advanced! I dont see the document about this so that why I open as a feature request. Hope new update about this come soon. Thanks!
Hope new update about this come soon. Thanks!
Added to the todo-list of InvoicePlane v2