LP#1732275: Add a Last Notice date and a Notices count column
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 10 Nov 2017 21:01:41 +0000 (16:01 -0500)
committerKathy Lussier <klussier@masslnc.org>
Thu, 1 Mar 2018 00:49:25 +0000 (19:49 -0500)
This adds the above 2 columns to Patron Items Out grid,
and preps the frontend for using the new service method.

Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Conflicts:
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2

Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js

index 2f705ce..45c467c 100644 (file)
   <eg-grid-field path="target_copy.call_number.suffix.label" label="[% l('CN Suffix') %]" hidden></eg-grid-field>
   <eg-grid-field path="target_copy.call_number.record.*" hidden></eg-grid-field>
   <eg-grid-field path="target_copy.call_number.record.wide_display_entry.*" hidden></eg-grid-field>
+  <eg-grid-field label="[% l('Total Notices') %]" path='action_trigger_event_count'></eg-grid-field>
+  <eg-grid-field label="[% l('Last Notice') %]" path='action_trigger_latest_event_date' dateformat="short" datatype="timestamp"></eg-grid-field>
 </eg-grid>
 </div>
 
index b209d18..4543797 100644 (file)
@@ -141,12 +141,21 @@ function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
                 })
             }
 
-            patronSvc.items_out.push(circ); // toss it into the cache
-
-            // We fetch all circs for client-side sorting, but only
-            // notify the caller for the page of requested circs.  
-            if (rendered++ >= offset && rendered <= count)
-                deferred.notify(circ);
+           // call open-ils to get overdue notice count and  Last notice date
+           
+           egCore.net.request(
+               'open-ils.actor',
+               'open-ils.actor.user.itemsout.notices',
+               egCore.auth.token(), circ.id(), $scope.patron_id)
+           .then(function(notice){
+               if (notice.numNotices){
+                   circ.action_trigger_event_count = notice.numNotices;
+                   circ.action_trigger_latest_event_date = notice.lastDt;
+              }
+               patronSvc.items_out.push(circ);
+           });
+
+              if (rendered++ >= offset && rendered <= count){ deferred.notify(circ) };
         });
 
         return deferred.promise;