webstaff: LP#1436980 Total Circulations in Patron Bills
authorVictoria Lewis <vlewis@catalystitservices.com>
Fri, 24 Jul 2015 22:08:15 +0000 (15:08 -0700)
committerMike Rylander <mrylander@gmail.com>
Wed, 16 Sep 2015 17:24:08 +0000 (13:24 -0400)
Add code to display Total Circulations in
Item Summary on Bills page.

Signed-off-by: Victoria Lewis <vlewis@catalystitservices.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/staff/circ/patron/t_xact_details.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js

index 059153b..9e83fe3 100644 (file)
     </div>
     <div class="col-md-2 strong-text">[% l('Total Circulations') %]</div>
     <div class="col-md-2">
-      TODO
+      {{total_circs}}
     </div>
   </div>
 </div>
index 2c7d18d..9f1b29b 100644 (file)
@@ -587,6 +587,16 @@ function($scope,  $q , $routeParams , egCore , egGridDataProvider , patronSvc ,
     egBilling.fetchXact(xact_id).then(function(xact) {
         $scope.xact = xact;
 
+        var copyId = xact.circulation().target_copy().id();
+        var circ_count = 0;
+        egCore.pcrud.search('circbyyr',
+            {copy : copyId}, null, {atomic : true})
+        .then(function(counts) {
+            angular.forEach(counts, function(count) {
+                circ_count += Number(count.count());
+            });
+            $scope.total_circs = circ_count;
+        });
         // set the title.  only needs to be done on initial page load
         if (xact.circulation()) {
             if (xact.circulation().target_copy().call_number().id() == -1) {