Skip to content

Commit

Permalink
PRESIDECMS-2707 Fix messaging error if next_scheduled_send_date is in…
Browse files Browse the repository at this point in the history
… the past
  • Loading branch information
sebduggan authored and DominicWatson committed Sep 18, 2023
1 parent 288ce8c commit 4d9811f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions system/handlers/admin/emailCenter/CustomTemplates.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -804,22 +804,27 @@ component extends="preside.system.base.AdminHandler" {
}

if ( args.sendMethod == "scheduled" ){
var nowish = Now();
args.sendDate = args.scheduleType == "repeat" ? ( template.schedule_next_send_date ?: "" ) : ( template.schedule_date ?: "" );

if ( IsDate( args.sendDate ) && args.sendDate > Now() ) {
if ( IsDate( args.sendDate ) && args.sendDate > nowish ) {
args.estimatedSendCount = emailMassSendingService.getTemplateRecipientCount( templateId );
}

if ( args.scheduleType == "repeat" ) {
if ( IsDate( args.sendDate ) ) {
defaultNotice.message = translateResource( uri="cms:emailcenter.next.send.date.alert", data=[ DateTimeFormat( args.sendDate, "d mmm, yyyy HH:nn"), NumberFormat( args.estimatedSendCount ) ] );
if ( args.sendDate > nowish ) {
defaultNotice.message = translateResource( uri="cms:emailcenter.next.send.date.alert", data=[ DateTimeFormat( args.sendDate, "d mmm, yyyy HH:nn"), NumberFormat( args.estimatedSendCount ) ] );
} else {
defaultNotice.message = translateResource( uri="cms:emailcenter.next.send.date.in.past.alert", data=[ DateTimeFormat( args.sendDate, "d mmm, yyyy HH:nn") ] );
}
} else {
defaultNotice.message = translateResource( uri="cms:emailcenter.next.send.date.unknown.alert" );
defaultNotice.class = "warn";
defaultNotice.icon = "fa-exclamation-triangle";
}
} else if ( IsDate( args.sendDate ) ) {
if ( args.sendDate > Now() ) {
if ( args.sendDate > nowish ) {
defaultNotice.message = translateResource( uri="cms:emailcenter.send.date.alert", data=[ DateTimeFormat( args.sendDate, "d mmm, yyyy HH:nn"), NumberFormat( args.estimatedSendCount ) ]);
} else if ( args.queued ) {
defaultNotice.message = translateResource( uri="cms:emailcenter.sending.alert", data=[ NumberFormat( args.queued ), NumberFormat( args.sent ) ] );
Expand Down
1 change: 1 addition & 0 deletions system/i18n/cms.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,7 @@ emailcenter.send.date.unknown.alert=This email has not been scheduled to send. E
emailcenter.send.date.in.past.alert=This email has as scheduled send date in the past: <strong>{1}</strong>. However, no emails have been sent. You may wish to edit the email settings to schedule the send.
emailcenter.next.send.date.alert=Next scheduled send: <strong>{1}</strong>. Estimated recipient count: <strong>{2}</strong>.
emailcenter.next.send.date.unknown.alert=Next scheduled send: unknown
emailcenter.next.send.date.in.past.alert=This email has as scheduled send date in the past: <strong>{1}</strong>. However, this should be corrected by the background email sending task very soon.
emailcenter.manual.send.alert=This email is set to send manually. Use the <strong>"Send"</strong> button at the top right of your screen to begin the sending process.
emailcenter.blueprints.page.title=Manage Email blueprints
Expand Down

0 comments on commit 4d9811f

Please sign in to comment.