/* * Displaying a one off popup to users to advise of upcoming maintenance. * * Display a one off message to users to let them know about upcoming IT * maintenance. Once displayed the user will not see the message again. */ function printJobHook(inputs, actions) { /* * This print hook will need access to all job details * so return if full job analysis is not yet complete. * The only job details that are available before analysis * are metadata such as username, printer name, and date. * * See reference documentation for full explanation. */ if (!inputs.job.isAnalysisComplete) { return; } // Set variables var viewed = inputs.user.getProperty("displayed"); // Get the current value of the user property "displayed" and write to variable "viewed" var dEndDate = new Date(2018, 01, 06, 0, 0, 0, 0); // Set variable for the expiry date var dCurrentDate = new Date(); // Set variable for the current date // Compare current date to end date, and also check if the value of the user property is null, if null then the key doesn't exist if (dEndDate > dCurrentDate && viewed == null) { // Display HTML message to user. actions.client.promptOK( "" + "
" + "
" + " Scheduled Maintenance
" + " " + "
" + "
" + " There is scheduled IT maintenance planned for the network

" + " This will take place on Saturday 6th January 2018 between 9am and 12pm.
" + " Printing will be unavailable during this time.

" + " We apologise for any inconvenience caused.

" + " If you have any questions please contact the IT team using the link below:

" + "
" + "
" + " Support Portal
" + "
" + "

" + "
" + "
" + "",{'hideJobDetails': true, 'dialogTitle': "IT Announcement", 'dialogDesc' : "Scheduled maintenance is coming up. Check out the details below."}); } // Set the property against the user when job is completed (even if it was cancelled). This stops the message being displayed again. actions.user.onCompletionSaveProperty("displayed", "yes", {'saveWhenCancelled' : true}) }​