Mail templates for Jasper Reports

259 views
Skip to first unread message

Yogan Naidoo

unread,
Apr 1, 2021, 9:58:46 AM4/1/21
to iDempiere
Dear Community, need your advice on this:

Most of our documents are attached to Jasper reports. We have a requirement to attach mail templates to the mail button of a rendered report.

Currently thinking of overriding cmd_sendMail in the JkJRViewer class and make the changes there. 

I am not sure which is the best place to put the mail template. We thought to put it in:
1) Report and Process window. So that this would be applicable to all clients but not too much customisation per client is possible.
2) Put a process dropdown on the mail template window. This would provide more flexibility per client and we have the flexibility to configure it under System as well.

We are leaning towards 2). Any ideas or has someone done something similar?

Regards

Patric

unread,
Apr 2, 2021, 2:37:35 AM4/2/21
to iDempiere
Hi Yogan,
we had the same requirement. We using the mail templates for Jasper Reports in iDempiere. Email Template name = doctype name to get the mail template.
If the report has a documentno, we rename the attachment with the documentno.
A parameter #documentinfo in the mail template text1,text2 and text3 is replaced with documentinfos. Also we set cc to the current user mail.
I did the changes in zkjrviewer.

Regards,
Patric

Martin Schönbeck

unread,
Apr 4, 2021, 4:43:38 AM4/4/21
to iDempiere
Hi Yogan,

Yogan Naidoo schrieb am Donnerstag, 1. April 2021 um 15:58:46 UTC+2:

We are leaning towards 2). Any ideas or has someone done something similar?

did you already have a look at our Beluga serverprint plugin? It will do that for you configurable for each document type (or window or both) and also configurable for each business partner if necessary.

Regards,
Martin

Yogan Naidoo

unread,
Apr 5, 2021, 5:43:32 AM4/5/21
to iDempiere
Thanks Patric, that is neat and easy to implement. Will look at it.

Yogan Naidoo

unread,
Apr 9, 2021, 7:49:42 AM4/9/21
to iDempiere
Thanks Martin for sharing.

This plugin looks flexible and comprehensive. After a few missteps, I got it to work for our use case.
I have a few queries:
1) Do you have this plugin in production yet?
2) In the code I was failing on the following sql snippet:

select sp.sbsp_subprintprofile_id from sbsp_printprofile pp, sbsp_copy cp, sbsp_subprintprofile sp 
where sp.sbsp_printprofile_id = pp.sbsp_printprofile_id and sp.ad_client_id = 11 
and cp.ad_client_id = 11 and pp.ad_client_id = 11
and (pp.isstandardprintprofile = 'Y' or pp.sbsp_printprofile_id in (select ppl.sbsp_printprofile_id from sbsp_printprofilelink ppl 
where ppl.ad_client_id = 11 and ppl.ad_org_id = 0 or ppl.ad_org_id = 11 
and (ppl.c_bpartner_id = 17 or ppl.ad_user_id = 100) and ppl.isactive = 'Y'))

My table: sbsp_printprofilelink is empty. How is this populated typically?

With this line from the snippet:
where ppl.ad_client_id = 11 and ppl.ad_org_id = 0 or ppl.ad_org_id = 11 
....should it be like this?:
where ppl.ad_client_id = 11 and (ppl.ad_org_id = 0 or ppl.ad_org_id = 11) 


Regards


Martin Schönbeck

unread,
Apr 9, 2021, 4:32:23 PM4/9/21
to iDempiere
Hi Yodan,

Yogan Naidoo schrieb am Freitag, 9. April 2021 um 13:49:42 UTC+2:
Thanks Martin for sharing.

This plugin looks flexible and comprehensive. After a few missteps, I got it to work for our use case.
I have a few queries:
1) Do you have this plugin in production yet?

Yes, for three or four years now, but of course we are enhancing it from time to time.
 
2) In the code I was failing on the following sql snippet:

select sp.sbsp_subprintprofile_id from sbsp_printprofile pp, sbsp_copy cp, sbsp_subprintprofile sp 
where sp.sbsp_printprofile_id = pp.sbsp_printprofile_id and sp.ad_client_id = 11 
and cp.ad_client_id = 11 and pp.ad_client_id = 11
and (pp.isstandardprintprofile = 'Y' or pp.sbsp_printprofile_id in (select ppl.sbsp_printprofile_id from sbsp_printprofilelink ppl 
where ppl.ad_client_id = 11 and ppl.ad_org_id = 0 or ppl.ad_org_id = 11 
and (ppl.c_bpartner_id = 17 or ppl.ad_user_id = 100) and ppl.isactive = 'Y'))

My table: sbsp_printprofilelink is empty. How is this populated typically?

The sbsp_printprofilelink is used to connect a special profile to a user or a business partner. With this you can e.g. supersede the by default mailed invoice to print it for a business partner without having to change the remaining entries of the default profile. In my explaining video I showed this near the end.

With this line from the snippet:
where ppl.ad_client_id = 11 and ppl.ad_org_id = 0 or ppl.ad_org_id = 11 
....should it be like this?:
where ppl.ad_client_id = 11 and (ppl.ad_org_id = 0 or ppl.ad_org_id = 11) 

I'm not in the office at the moment, but it seems to be a long lasting error there. I assume it wasn't found yet, because the profile links where connected to an org always. I'll check this as soon as back to office and correct it.

Regards,
Martin

Yogan Naidoo

unread,
Apr 13, 2021, 5:00:43 AM4/13/21
to iDempiere
Thanks Martin,

I picked up that the cc email for the email dialog is not being set. See attached screenshot.

emaildialog.png

Martin Schönbeck

unread,
Apr 14, 2021, 5:24:31 AM4/14/21
to iDempiere
Hi Yogan,

the feature to edit the email before sending is relatively new and obviously nobody tested with CC. We have corrected this, a new version is available on https://wiki.idempiere.org/en/Plugin:_Beluga_Serverprint

Regards,
Martin

Yogan Naidoo

unread,
Apr 14, 2021, 5:46:02 AM4/14/21
to iDempiere
Thanks Martin

Martin Schönbeck

unread,
Apr 14, 2021, 9:59:02 AM4/14/21
to iDempiere
Hi Yogan,

maybe there is another problem with mails. Or maybe it's a problem with our mailserver. We are testing a bit more, so don't invest to much time at the moment if something doesn't work as expected.

Regards,
Martin
Reply all
Reply to author
Forward
0 new messages