Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subject and attachment name on Gendoc generated e-mails
(03-21-2021, 12:27 AM)joebordes Wrote: No, you did it correctly, I didn't understand.

I looked into it and remembered that this is how it works. You are sending the email to the account/contact and only that module is supported for merging variables. This comes all the way back from vtiger crm where it was hard to do the merge for other modules. In coreBOS the email module has support for a Merge_Template_With list of IDs that will get their variables merged. So I added the quote (and other inventory modules) to that variable and it seems to be working. Update and give it a try.

Workflow_Email_GenDoc_Attachment_Name only applies to workflows, that is why there is no change in the template name

To make the change of the name you have to pass the subject to gendocAction() so you can substitute the crmid in the line you set in red above and then you have to apply this change in the GenDoc module

diff --git a/modules/evvtgendoc/gendocAction.php b/modules/evvtgendoc/gendocAction.php

index 1b8b841d2..4deec6d04 100644
--- a/modules/evvtgendoc/gendocAction.php
+++ b/modules/evvtgendoc/gendocAction.php
@@ -121,7 +121,7 @@ if ($mergetemplate=='1') {
                        case 'email':
-                               $sname = 'storage/'.$modulei18n.'_'.$record.($format=='doc'?'.odt':'.pdf');
+                               $sname = 'storage/'.$modulei18n.'_'.$einfo[$record].($format=='doc'?'.odt':'.pdf');
                                if (file_exists($sname)) {

you have to be sure to generate the same name in javascript and PHP.

The hard part is getting the information you want in the gendocaction call. I would prefer to use a business map to define how the name should be generated, but that is not a trivial task.

Let me know how it goes

Hello, sorry for the delay.
I can confirm that fields from inventory modules are available for the template. I have a further question: how do I apply a default e-mail template when generating e-mails with gendoc widget? I tried the GV Users_Default_Send_Email_Template but it does not load the specified template, user has to select it.

For the name of the attachment i don't know how to get it. I tried to include something like this:

var nm1 = document.getElementById('mouseArea_quote_no').value;
var emailurl = 'index.php?module=Emails&action=EmailsAjax&file=EditView&attachment='+nm1+'_'+i18n+'_'+crmid+'.'+(format=='pdf' ? 'pdf' : 'odt');
in evvtgendoc.js function gendocAction case 'email' but it does not fill nm1 variable, the result is populated with 'unspecified' in nm1 place.

Messages In This Thread
RE: Subject and attachment name on Gendoc generated e-mails - radu - 04-07-2021, 10:45 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)