Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKLOG-39712][BACKLOG-39726][BACKLOG-39709] - Allow the data to be sorted on the server and client side. Provide ability to use only comma or semi colon when constructing email and group list #5502

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions core/src/main/java/org/pentaho/platform/util/ActionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,22 +454,26 @@ public static void sendEmail( Map<String, Object> actionParams, Map<String, Seri
if ( emailGroupResolver == null ) {
emailGroupResolver = new DefaultEmailGroupResolver();
}

emailer.setTo( emailGroupResolver.resolve(to) );
emailer.setCc( emailGroupResolver.resolve(cc) );
emailer.setBcc( emailGroupResolver.resolve(bcc) );

String subject = (String) actionParams.get( "_SCH_EMAIL_SUBJECT" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setSubject( subject );
String resolveToList = emailGroupResolver.resolve(to);
if (resolveToList != null && resolveToList.length() > 0) {
emailer.setTo( emailGroupResolver.resolve( to ) );
emailer.setCc( emailGroupResolver.resolve( cc ) );
emailer.setBcc( emailGroupResolver.resolve( bcc ) );

String subject = ( String ) actionParams.get( "_SCH_EMAIL_SUBJECT" );
if (subject != null && !"".equals( subject ) ) {
emailer.setSubject( subject );
} else {
emailer.setSubject( "Pentaho Scheduler" + ( emailer.getAttachmentName() != null ? " : " + emailer.getAttachmentName() : "" ) );
}
String message = (String) actionParams.get( "_SCH_EMAIL_MESSAGE" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setBody( message );
}
emailer.send();
} else {
emailer.setSubject( "Pentaho Scheduler" + ( emailer.getAttachmentName() != null ? " : " + emailer.getAttachmentName() : "" ) );
}
String message = (String) actionParams.get( "_SCH_EMAIL_MESSAGE" );
if ( subject != null && !"".equals( subject ) ) {
emailer.setBody( message );
logger.error( Messages.getInstance().getErrorString( "ActionUtil.ERROR_0001_INVALID_EMAIL_LIST" ) );
}
emailer.send();
} catch ( Exception e ) {
logger.warn( e.getMessage(), e );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ VersionCheck.NO_RESULT_MESSAGE=Version Check Error: No Results Available
ActionUtil.ERROR_0001_REQUIRED_PARAM_MISSING=Property "{0}" or "{1}" must be set in the action data map
ActionUtil.ERROR_0002_FAILED_TO_CREATE_ACTION=Failed to create an instance of action "{0}"
ActionUtil.ERROR_0003_ACTION_WRONG_TYPE=class {0} must be an instance of "{1}"

ActionUtil.ERROR_0001_INVALID_EMAIL_LIST=Unable to send email. The list of the recipients is invalid
Loading