LP#1670242 Webstaff checkin transit holds addr fix
authorBill Erickson <berickxx@gmail.com>
Fri, 12 May 2017 20:22:14 +0000 (16:22 -0400)
committerKathy Lussier <klussier@masslnc.org>
Wed, 17 May 2017 19:05:09 +0000 (15:05 -0400)
Gracefully handle cases where a checkin results in a transit to a branch
with no holds address.  Route dialog and print templates now display "We
do not have a holds address for this library. "

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/circ/share/t_transit_dialog.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_transit_slip.tt2
Open-ILS/src/templates/staff/share/print_templates/t_transit_slip.tt2
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index 69d9271..2562e6a 100644 (file)
       <div>
         <address>
           <strong>{{dest_location.name}}</strong><br>
-          {{dest_address.street1}} {{dest_address.street2}}<br/>
-          {{dest_address.city}}, {{dest_address.state}} {{dest_address.post_code}}<br/>
+          <span ng-if="dest_address">
+            {{dest_address.street1}} {{dest_address.street2}}<br/>
+            {{dest_address.city}}, {{dest_address.state}} {{dest_address.post_code}}
+          </span>
+          <span ng-if="!dest_address">
+            [% l('We do not have a holds address for this library.') %]
+          </span>
+          <br/>
           <abbr title="[% l('Phone') %]">P:</abbr> {{dest_location.phone}}
         </address>
       </div>
index eb002b8..a0aa6ef 100644 (file)
@@ -24,11 +24,16 @@ Template for printing hold transit slips. Fields include:
 <div>
   <div>[% l('This item needs to be routed to [_1]', '<b>{{dest_location.shortname}}</b>') %]</div>
   <div>{{dest_location.name}}</div>
-  <div>{{dest_address.street1}}
-  <div>{{dest_address.street2}}</div>
-  <div>{{dest_address.city}},
-       {{dest_address.state}}
-       {{dest_address.post_code}}</div>
+  <div ng-if="dest_address">
+    <div>{{dest_address.street1}}</div>
+    <div>{{dest_address.street2}}</div>
+    <div>{{dest_address.city}},
+        {{dest_address.state}}
+        {{dest_address.post_code}}</div>
+  </div>
+  <div ng-if="!dest_address">
+    [% l('We do not have a holds address for this library.') %]
+  </div>
   <br/>
 
   [% l('Barcode: [_1]', '{{copy.barcode}}') %]</div>
index afd5aab..ccf9e8c 100644 (file)
@@ -15,11 +15,16 @@ Template for printing a transit slip. Fields include:
 <div>
   <div>[% l('This item needs to be routed to [_1]', '<b>{{dest_location.shortname}}</b>') %]</div>
   <div>{{dest_location.name}}</div>
-  <div>{{dest_address.street1}}
-  <div>{{dest_address.street2}}</div>
-  <div>{{dest_address.city}},
-       {{dest_address.state}}
-       {{dest_address.post_code}}</div>
+  <div ng-if="dest_address">
+    <div>{{dest_address.street1}}</div>
+    <div>{{dest_address.street2}}</div>
+    <div>{{dest_address.city}},
+        {{dest_address.state}}
+        {{dest_address.post_code}}</div>
+  </div>
+  <div ng-if="!dest_address">
+    [% l('We do not have a holds address for this library.') %]
+  </div>
   <br/>
 
   [% l('Barcode: [_1]', '{{copy.barcode}}') %]</div>
index 4c48ae6..d669400 100644 (file)
@@ -624,6 +624,8 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
         var org = egCore.org.get(org_id);
         var addr_id = org[addr_type]();
 
+        if (!addr_id) return $q.when(null);
+
         if (egCore.env.aoa && egCore.env.aoa.map[addr_id]) 
             return $q.when(egCore.env.aoa.map[addr_id]); 
 
@@ -1404,7 +1406,9 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
                 // route_dialog includes the "route to holds shelf" 
                 // dialog, which has no transit
                 print_context.transit = egCore.idl.toHash(data.transit);
-                print_context.dest_address = egCore.idl.toHash(data.address);
+                if (data.address) {
+                    print_context.dest_address = egCore.idl.toHash(data.address);
+                }
                 print_context.dest_location =
                     egCore.idl.toHash(egCore.org.get(data.transit.dest()));
             }