LP#1282704: Serials: in routing lists, avoid extra page breaks wasting paper at print...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 20 Feb 2014 17:21:57 +0000 (12:21 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 9 Apr 2014 14:04:38 +0000 (07:04 -0700)
If you're using batch receive, and you have two copies (and therefore
two streams) that you're receiving with the Routing List? checkbox
checked, but only one of those streams actually has a routing list,
you'll note before this patch is applied that you get an extra page of
blank paper if you print the routing list that pops up.

This fixes that.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/web/js/ui/default/serial/print_routing_list_users.js

index 9d5f852..917ff75 100644 (file)
@@ -9,6 +9,8 @@ function ListRenderer() {
     var self = this;
 
     this.render = function() {
+        var rendered_something = false;
+
         for (var i = 0; i < this.streams.length; i++) {
             var stream = this.streams[i];
 
@@ -35,7 +37,7 @@ function ListRenderer() {
 
             this.render_users(stream, list);
 
-            if (i) {
+            if (rendered_something) {
                 dojo.create(
                     "hr",
                     {"style": "page-break-after: always"}, this.target, "last"
@@ -43,6 +45,7 @@ function ListRenderer() {
             }
 
             dojo.place(list, this.target, "last");
+            rendered_something = true;
         }
 
         return this; /* for chaining */