I’m using the “Email Quotation” functionality in the Quotes module and I need the created email to be related to the account the quote is linked to. Currently it does not do that in v7.2.1 (please let me know if newer versions already do this).
I’ve found that this is handled in the file modules/AOS_PDF_Templates/sendEmail.php. I’m pretty sure my only option is to modify that file to check for the existence of custom/modules/AOS_PDF_Templates/sendEmail.php. Unfortunately, the core file would have to be slightly modified, thus not making it a 100% upgrade-safe approach. Am I correct or is there a better way?
Can you find a logic hook that suits your needs? As long as you can catch a specific moment that covers what you need (some record being created or changed) then you could code whatever you need in an upgrade-safe way.
The logic hooks would actually allow me to change the parent_type & parent_id but I found another “problem”. If you set the parent_type=‘Accounts’ & parent_id=aos_quotes.billing_account_id, the “To” address will always default to that account’s email address based on the code from custom/modules/Emails/Compose.php. I want to set it to the aos_quotes.billing_contact_id’s email address. For that, I had to make a tweak in custom/modules/Emails/Compose.php.
I’m headed down a similar path. I want to add a payment link to the body of the email that sends out the Invoice PDF. My initial experimentation in moving sendEmail.php to custom folder appears it doesn’t get recognized. So looks like possibly have to modify the original file, make a note in my customization list so that I remember to re-introduce the code modification after upgrade. Luckily I don’t have a lot of these types of upgrade unsafe mods and I don’t upgrde often.