Last active
August 29, 2015 14:06
-
-
Save dzmitryk/ea7bcd9d77b94da83de8 to your computer and use it in GitHub Desktop.
enrolment sending script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(args) { | |
def enrolment = args.entity | |
if (enrolment.status == EnrolmentStatus.SUCCESS && enrolment.confirmationStatus == ConfirmationStatus.NOT_SENT) { | |
def m = Email.create("Enrolment Confirmation") | |
m.bind(enrolment: enrolment) | |
m.to(enrolment.student.contact) | |
m.send() | |
enrolment.setConfirmationStatus(ConfirmationStatus.SENT) | |
args.context.commitChanges() | |
} | |
} |
context.localObject(arguments["entity"]) is also very cumbersome. Can't all the objects we already localised in our context?
Fixed. I've updated the scripts' gists to their current state.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of the cumbersome "ish.common.types.EnrolmentStatus.SUCCESS.equals(enrolment.status)" can we have:
enrolment.status == EnrolmentStatus.SUCCESS
That just requires the imports to be included in the script.