LP#1497335 Browser client item details aged circs
authorBill Erickson <berickxx@gmail.com>
Thu, 28 Jul 2016 21:04:05 +0000 (17:04 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 28 Jul 2016 21:04:08 +0000 (17:04 -0400)
1. Use all_circulation (combcirc) class (now accessible via pcrud) to
render the item Circ History List tab.  In cases where a combcirc object
has no 'usr' value, the interface displays <Aged Circulation> where
the patron's name would normally be.

2. Handle null 'usr' values in the item status Recent Circ History tab.
When a renewal chain summary has no 'usr' value, the interface displays
<Aged Circulation> where the patron's name would normally be.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/fm_IDL.xml
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 d036b3d..f36c755 100644 (file)
@@ -4116,7 +4116,7 @@ SELECT  usr,
                        </actions>
                </permacrud>
        </class>
-       <class id="combcirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::all_circulation" oils_persist:tablename="action.all_circulation" reporter:core="true" reporter:label="Combined Aged and Active Circulations" oils_persist:readonly="true">
+       <class id="combcirc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::all_circulation" oils_persist:tablename="action.all_circulation" reporter:core="true" reporter:label="Combined Aged and Active Circulations" oils_persist:readonly="true">
                <fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
                        <field reporter:label="Check In Library" name="checkin_lib" reporter:datatype="org_unit"/>
                        <field reporter:label="Check In Staff" name="checkin_staff" reporter:datatype="link"/>
@@ -4199,6 +4199,11 @@ SELECT  usr,
                        <link field="parent_circ" reltype="might_have" key="id" map="" class="acirc"/>
                        <link field="usr" reltype="has_a" key="id" map="" class="au"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="VIEW_CIRCULATIONS" context_field="circ_lib" />
+                       </actions>
+               </permacrud>
        </class>
        <class id="acirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::aged_circulation" oils_persist:tablename="action.aged_circulation" reporter:core="true" reporter:label="Aged (patronless) Circulation">
                <fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
index 05ee925..c6d81b5 100644 (file)
 <div class="row" ng-repeat="circ in circ_list">
   <div class="flex-row">
     <div class="flex-cell well">
-      <a href="./circ/patron/{{circ.usr().id()}}/checkout" target="_self">
+      <a ng-if="circ.usr()" target="_self"
+        href="./circ/patron/{{circ.usr().id()}}/checkout">
         [% l('[_1], [_2] [_3] : [_4]', 
           '{{circ.usr().family_name()}}'
           '{{circ.usr().first_given_name()}}'
           '{{circ.usr().second_given_name()}}'
           '{{circ.usr().card().barcode()}}') %]
       </a>
+      <span ng-if="!circ.usr()">[% l('<Aged Circulation>') | html %]</span>
       <span class="pad-horiz">[% l('Circulation ID: [_1]', '{{circ.id()}}') %]</span>
     </div>
     <div>
index 24a3241..512f5c3 100644 (file)
     <div class="flex-cell">[% l('Patron') %]</div>
     <div class="flex-cell well">
       <a href="./circ/patron/{{prev_circ_usr.id()}}/checkout" 
-        ng-if="prev_circ_summary" target="_self">
+        ng-if="prev_circ_usr" target="_self">
         [% l('[_1], [_2] [_3] : [_4]', 
-          '{{prev_circ_usr.family_name()}}'
-          '{{prev_circ_usr.first_given_name()}}'
-          '{{prev_circ_usr.second_given_name()}}'
-          '{{prev_circ_usr.card().barcode()}}') %]
+        '{{prev_circ_usr.family_name()}}'
+        '{{prev_circ_usr.first_given_name()}}'
+        '{{prev_circ_usr.second_given_name()}}'
+        '{{prev_circ_usr.card().barcode()}}') %]
       </a>
+      <span ng-show="!prev_circ_usr">
+        [% l('<Aged Circulation>') | html %]
+    </span>
     </div>
   </div>
 
index a8781dc..78a555b 100644 (file)
@@ -902,6 +902,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
         delete $scope.circ;
         delete $scope.circ_summary;
         delete $scope.prev_circ_summary;
+        delete $scope.prev_circ_usr;
         if (!copyId) return;
         
         egCore.pcrud.search('circ', 
@@ -945,12 +946,12 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
             ).then(null, null, function(summary) {
                 $scope.prev_circ_summary = summary.summary;
 
-                egCore.pcrud.retrieve('au', summary.usr,
-                    {flesh : 1, flesh_fields : {au : ['card']}})
+                if (summary.usr) { // aged circs have no 'usr'.
+                    egCore.pcrud.retrieve('au', summary.usr,
+                        {flesh : 1, flesh_fields : {au : ['card']}})
 
-                .then(function(user) {
-                    $scope.prev_circ_usr = user;
-                });
+                    .then(function(user) { $scope.prev_circ_usr = user });
+                }
             });
         });
     }
@@ -976,7 +977,8 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
     $scope.retrieveAllPatrons = function() {
         var users = new Set();
         angular.forEach($scope.circ_list.map(function(circ) { return circ.usr(); }),function(usr) {
-            users.add(usr);
+            // aged circs have no 'usr'.
+            if (usr) users.add(usr);
         });
         users.forEach(function(usr) {
             $timeout(function() {
@@ -1010,11 +1012,11 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
 
         }).then(function(count) {
 
-            egCore.pcrud.search('circ', 
+            egCore.pcrud.search('combcirc', 
                 {target_copy : copyId},
                 {   flesh : 2,
                     flesh_fields : {
-                        circ : [
+                        combcirc : [
                             'usr',
                             'workstation',                                         
                             'checkin_workstation',                                 
@@ -1022,7 +1024,7 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
                         ],
                         au : ['card']
                     },
-                    order_by : {circ : 'xact_start desc'}, 
+                    order_by : {combcirc : 'xact_start desc'}, 
                     limit :  count
                 }