Source code for the WS template copy fix

Use this forum to report bugs and to check for bugfixes and new releases of OpenEMM

Moderator: moderator

Source code for the WS template copy fix

Postby mkalen » Fri Jan 30, 2009 7:00 pm

Could you please attach a patch or Java source code to the following issue: https://sourceforge.net/tracker2/?func= ... tid=848488 ?

I would like to integrate the fix with my customized WebService.

Thanks!
mkalen
 
Posts: 33
Joined: Tue Jan 20, 2009 7:51 pm

Postby maschoff » Mon Feb 02, 2009 12:49 pm

Done!
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Thank you

Postby mkalen » Mon Feb 02, 2009 12:58 pm

Great! Thanks for your prompt response.
Cheers,
Martin
mkalen
 
Posts: 33
Joined: Tue Jan 20, 2009 7:51 pm

Re: Source code for the WS template copy fix

Postby mkalen » Mon Feb 02, 2009 2:06 pm

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).
mkalen
 
Posts: 33
Joined: Tue Jan 20, 2009 7:51 pm

Postby maschoff » Thu Feb 19, 2009 3:37 pm

Thanks for your detailed feedback! Please see this bug fix at SourceForge:

https://sourceforge.net/tracker2/?func= ... _id=168937
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany


Return to Bugs, bug fixes & releases

Who is online

Users browsing this forum: No registered users and 1 guest

cron