Add print_custom.js for tadlSlipDate
authorJason Etheridge <jason@esilibrary.com>
Wed, 29 Feb 2012 16:09:34 +0000 (11:09 -0500)
committerJeff Godin <jgodin@tadl.org>
Thu, 26 Jul 2012 07:04:59 +0000 (03:04 -0400)
We use tadlSlipDate on hold slips. This replaces that element with a
formatted date 7 days in the future.

Originally from https://gist.github.com/179cd9a682a509537cb8

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/xul/staff_client/chrome/content/util/print_custom.js [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print_custom.js b/Open-ILS/xul/staff_client/chrome/content/util/print_custom.js
new file mode 100644 (file)
index 0000000..f59ec82
--- /dev/null
@@ -0,0 +1,17 @@
+function print_custom(type) {
+    var type; // we don't care about type
+
+    var elements = document.getElementsByClassName("rcpt");
+    var i;
+
+    for (i = 0; i < elements.length; i++) {
+        e = elements[i];
+        if (e.className.match(/tadlSlipDate/gi)) {
+            var pullDate = new Date();
+            pullDate.setDate(pullDate.getDate() + 7);
+            var writeString = parseInt(pullDate.getMonth()+1) + '/' + pullDate.getDate();
+            e.innerHTML = writeString;
+        }
+    }
+
+}