Skip to content

Commit

Permalink
Merge branch 'feature-PRESIDECMS-2980_email-centre-scheduled-email-ha…
Browse files Browse the repository at this point in the history
…d-to-be-saved-twice' into hotfix-10.27.25
  • Loading branch information
DominicWatson committed Dec 10, 2024
2 parents 97ea40e + 6f246d4 commit ba39bae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
8 changes: 7 additions & 1 deletion system/services/email/EmailTemplateService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,13 @@ component {
* @markAsSent.hint Whether or not to mark a 'fixedschedule' template as sent
*/
public string function updateScheduledSendFields( required string templateId, boolean markAsSent=false ) {
var template = getTemplate( id=arguments.templateId, allowDrafts=true, fromVersionTable=false );
var template = getTemplate(
id = arguments.templateId
, allowDrafts = true
, fromVersionTable = false
, useRequestCache = false
);

var updatedData = { schedule_next_send_date = "" };

if ( template.sending_method == "scheduled" ) {
Expand Down
28 changes: 14 additions & 14 deletions tests/unit/api/email/EmailTemplateServiceTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_sent = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate").$args( template=template, id=templateId , isDraft=true ).$results( templateId );
service.$( "_getNow", nowish );

Expand All @@ -215,7 +215,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down Expand Up @@ -245,7 +245,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -272,7 +272,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = DateAdd( "ww", -1, nowish )
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -299,7 +299,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = nowish
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -325,7 +325,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = DateAdd( "ww", 4, nowish )
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down Expand Up @@ -353,7 +353,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = nextSendDate
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -379,7 +379,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = DateAdd( "ww", 4, nowish )
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -406,7 +406,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -433,7 +433,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down Expand Up @@ -461,7 +461,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down Expand Up @@ -496,7 +496,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down Expand Up @@ -526,7 +526,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_next_send_date = ""
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand All @@ -553,7 +553,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
, schedule_sent = true
};

service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false ).$results( template );
service.$( "getTemplate" ).$args( id=templateId, allowDrafts=true, fromVersionTable=false, useRequestCache=false ).$results( template );
service.$( "saveTemplate", templateId );
service.$( "_getNow", nowish );

Expand Down

0 comments on commit ba39bae

Please sign in to comment.