print_custom: call sums func, add phone numbers
authorJeff Godin <jgodin@tadl.org>
Thu, 8 May 2014 15:47:03 +0000 (11:47 -0400)
committerJeff Godin <jgodin@tadl.org>
Sun, 22 May 2016 03:59:52 +0000 (23:59 -0400)
Call the print_do_sums function so that span-based summing will
work, and add a class-based replacement called tadlPhoneNumber
(accepts library shortname as an argument).

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/xul/staff_client/chrome/content/util/print_custom.js

index 7554143..1aac456 100644 (file)
@@ -1,6 +1,11 @@
 function print_custom(type) {
     var type; // we don't care about type
 
+    // call print_do_sums
+    if (typeof print_do_sums == "function") {
+        print_do_sums();
+    }
+
     var elements = document.getElementsByClassName("rcpt");
     var i;
 
@@ -22,6 +27,27 @@ function print_custom(type) {
                 slipName = family_name.substring(0,20).toUpperCase() + ' ' + first_given_name.substring(0,2).toUpperCase();
             }
             e.innerHTML = slipName;
+        } else if (e.className.match(/tadlPhoneNumber/gi)) {
+            var phone_number;
+            var lib_shortname = document.getElementById('lib_shortname').textContent;
+
+            if (lib_shortname) {
+                var phonemap = {
+                    'TADL-EBB': '231-922-2085',
+                    'TADL-FLPL': '231-879-4101',
+                    'TADL-IPL': '231-276-6767',
+                    'TADL-KBL': '231-263-5484',
+                    'TADL-PCL': '231-223-7700',
+                    'TADL-WOOD': '231-932-8500',
+                }
+
+                phone_number = phonemap[lib_shortname];
+
+                if (phone_number) {
+                    e.innerHTML = phone_number;
+                }
+
+            }
         }
     }