ma wrote:Done!
Thanks again for this. I have a few comments on the fixed version of the loadTemplate function:
1. Since the clone() method of the Mailing class is now used, every component will be loaded from the template. This includes the text- and HTML-components and the following code from EmmWebservice loadTemplate-function is now useless and can be removed:
Code: Select all
// load template for this mailing
if((tmpComp = template.getHtmlTemplate()) != null) {
aMailing.addComponent(tmpComp);
}
if((tmpComp = template.getTextTemplate()) != null) {
aMailing.addComponent(tmpComp);
}
This is now basically dead code that will only result in "check if component key exists+bail out" of the Mailing#addComponent method. You can trace the code to verify this.
2. It seems that you might have forgotten to update the newEmailMailingWithReply method with regards to setting description, shortname and company id. The following lines are moved to
after the loadTemplate call only in newEmailMailing and not newEmailMailingWithReply:
Code: Select all
aMailing.setDescription(description);
aMailing.setShortname(shortname);
aMailing.setCompanyID(1);
I think they should always come after loadTemplate, since clone will otherwise overwrite description+shortname from template.
3. The overwrite check of agnText/agnHtml guarded by:
Code: Select all
if(aMailing.getMailTemplateID() == 0)
is in newEmailMailing but not in newEmailMailingWithReply. Ie. using newEmailMailingWithReply will still overwrite the contents of the template if the check is not added there as well (for both HTML and text components).