From: Art Rhyno Date: Wed, 30 Jan 2013 13:34:24 +0000 (-0500) Subject: Hold Slip Formatting for Windsor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ca7b388c0d9749158e0e01cc3e39416b39e22bf1;p=contrib%2FConifer.git Hold Slip Formatting for Windsor The Leddy Library used some custom javascript for adding a due date to the Hold Slip in a previous version of Evergreen. This uses the far cleaner print_win.js setup to bring this back. Signed-off-by: Art Rhyno --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print_win.js b/Open-ILS/xul/staff_client/chrome/content/util/print_win.js index 76f53f5877..8faadf1146 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print_win.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print_win.js @@ -9,6 +9,7 @@ function print_init(type) { if (typeof print_custom == "function") { print_custom(type); } else { + print_do_hold_dates(5); print_do_sums(); print_check_alt(); print_check_noprint(); @@ -163,3 +164,27 @@ function print_do_sums() { } } } + +/* Hold Date Formating for Leddy + * Use example: + * + * + * Due Date: 5 days from Now + */ +function print_do_hold_dates(daysToAdd) { + var holdDate = new Date(); + holdDate.setDate(holdDate.getDate() + daysToAdd); + var d = holdDate.getDate(); + var m = holdDate.getMonth()+1; + var y = holdDate.getFullYear(); + + var holdDue = 'Due Date: ' + y +'-'+ (m<=9?'0'+m:m) +'-'+ (d<=9?'0'+d:d); + var spans = document.getElementsByTagName('span'); + if(!spans) return; + for (var i = 0; i < spans.length; i++) { + var dateset = spans[i].getAttribute("hold_date"); + if(dateset) { + spans[i].textContent = holdDue; + }//if + }//for +}