LP#1378383 - Improve feedback message when item circ history is limited user/cesardv/lp1378383_webstaff_obey_circ_hist_max_checkouts
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 18 Aug 2017 19:36:13 +0000 (15:36 -0400)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 18 Aug 2017 19:36:13 +0000 (15:36 -0400)
There was ambiguity for the user to tell the difference (from the displayed message)
 if an item truly has no circulations, or if they see no circs due to the relevant
 permission setting being set to 0 (Maximum previous checkouts)

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Open-ILS/src/templates/staff/cat/item/t_circ_list_pane.tt2
Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js

index 3cab22b..dbf93ac 100644 (file)
@@ -1,9 +1,14 @@
-<div class="col-md-12" ng-show="!circ_list.length">
+<div class="col-md-12" ng-show="!isMaxCircHistoryZero && circ_list.length == 0">
   <div class="alert alert-info">
     [% l('Item has not circulated.') %]
   </div>
 </div>
-<div class="row" ng-show="circ_list.length">
+<div class="col-md-12" ng-show="isMaxCircHistoryZero">
+  <div class="alert alert-info">
+    [% l('Circulation History not available for display.') %]
+  </div>
+</div>
+<div class="row" ng-show="!isMaxCircHistoryZero && circ_list.length">
   <div class="flex-row">
       <div class="flex-cell well">
           <button class="btn btn-default" ng-click="retrieveAllPatrons()">
@@ -14,7 +19,7 @@
 </div>
 
 
-<div class="row" ng-repeat="circ in circ_list">
+<div class="row" ng-show="!isMaxCircHistoryZero" ng-repeat="circ in circ_list">
   <div class="flex-row">
     <div class="flex-cell well">
       <a ng-if="circ.usr()" target="_self"
index 8a165b3..c7b1ded 100644 (file)
   </div>
 </div>
 
-<div class="col-md-6" ng-show="!circ">
+<div class="col-md-6" ng-show="!isMaxCircHistoryZero && !circ">
   <div class="alert alert-info">
     [% l('No Recent Circ Group') %]
   </div>
 </div>
-<div class="col-md-6" ng-show="circ">
+<div class="col-md-6" ng-show="isMaxCircHistoryZero">
+  <div class="alert alert-info">
+    [% l('Most Recent Circ Group not available for display.') %]
+  </div>
+</div>
+<div class="col-md-6" ng-show="!isMaxCircHistoryZero && circ">
   <div class="flex-row">
     <div class="flex-cell flex-2 strong-text-2">
       [% l('Most Recent Circ Group') %]
index 8f34c67..5a6a69e 100644 (file)
@@ -1448,6 +1448,8 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
             return fetchMaxCircHistory();
         })
         .then(function(maxHistCount){
+            if(!count) $scope.isMaxCircHistoryZero = true;
+
             egCore.pcrud.search('circ',
                 {target_copy : copyId},
                 {   flesh : 2,
@@ -1463,7 +1465,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
                         au : ['card']
                     },
                     order_by : {circ : 'xact_start desc'},
-                    limit :  maxHistCount
+                    limit : 1
                 }
 
             ).then(null, null, function(circ) {
@@ -1509,7 +1511,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
             'circ.item_checkout_history.max')
         .then(function(set) {
             maxHistory = set['circ.item_checkout_history.max'] || 4;
-            return maxHistory;
+            return Number(maxHistory);
         });
     }
 
@@ -1543,7 +1545,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
         var copy_org = 
             itemSvc.copy.call_number().id() == -1 ?
             itemSvc.copy.circ_lib().id() :
-            itemSvc.copy.call_number().owning_lib().id()
+            itemSvc.copy.call_number().owning_lib().id();
 
         // there is an extra layer of permissibility over circ
         // history views
@@ -1558,6 +1560,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
             return fetchMaxCircHistory();
 
         }).then(function(count) {
+           if(!count) $scope.isMaxCircHistoryZero = true;
 
             egCore.pcrud.search('combcirc', 
                 {target_copy : copyId},
@@ -1572,7 +1575,8 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
                         au : ['card']
                     },
                     order_by : {combcirc : 'xact_start desc'}, 
-                    limit :  count
+                    // fetch at least one to see if copy ever circulated
+                    limit :  $scope.isMaxCircHistoryZero ? 1 : count
                 }
 
             ).then(null, null, function(circ) {