From c67694794cad3fba07af81b3fadd5777c88d22b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 31 Dec 2014 16:05:53 -0500 Subject: [PATCH] LP#1402797 browser client noncat circ display Adds a new tab to the patron items out page for Non-Cataloged Circulations. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../staff/circ/patron/t_items_out.tt2 | 32 ++++++++++-- .../ui/default/staff/circ/patron/items_out.js | 52 ++++++++++++++++++- 2 files changed, 78 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 index 5c87466d69..ca3eef1f26 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 @@ -1,6 +1,6 @@ -
+
-
- [% l('Items Checked Out') %] -
+ + + + + + + + + + + +
+
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js index 7558251dd9..f8f4dd8e40 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js @@ -9,7 +9,16 @@ angular.module('egPatronApp') 'egGridDataProvider','$modal','egCirc','egConfirmDialog','egBilling', function($scope, $q, $routeParams, egCore , egUser, patronSvc , egGridDataProvider , $modal , egCirc , egConfirmDialog , egBilling) { - $scope.initTab('items_out', $routeParams.id); + + // list of noncatatloged circulations. Define before initTab to + // avoid any possibility of race condition, since they are loaded + // during init, but may be referenced before init completes. + $scope.noncat_list = []; + + $scope.initTab('items_out', $routeParams.id).then(function() { + // sort inline to support paging + $scope.noncat_list = patronSvc.noncat_ids.sort(); + }); // cache of circ objects for grid display patronSvc.items_out = []; @@ -60,6 +69,13 @@ function($scope, $q, $routeParams, egCore , egUser, patronSvc , provider.refresh(); } + $scope.show_noncat_list = function() { + // don't need a full reset_page() to swap tabs + $scope.items_out_display = 'noncat'; + patronSvc.items_out = []; + provider.refresh(); + } + // Reload the user to pick up changes in items out, fines, etc. // Reload circs since the contents of the main vs. alt list may // have changed. @@ -112,6 +128,35 @@ function($scope, $q, $routeParams, egCore , egUser, patronSvc , }); } + function fetch_noncat_circs(id_list, offset, count) { + if (!id_list.length) return $q.when(); + + return egCore.pcrud.search('ancc', {id : id_list}, + { flesh : 1, + flesh_fields : {ancc : ['item_type','staff']}, + limit : count, + offset : offset, + // we need an order-by to support paging + order_by : {circ : ['circ_time']} + + }).then(null, null, function(noncat_circ) { + + // calculate the virtual due date from the item type duration + var seconds = egCore.date.intervalToSeconds( + noncat_circ.item_type().circ_duration()); + var d = new Date(Date.parse(noncat_circ.circ_time())); + d.setSeconds(d.getSeconds() + seconds); + noncat_circ.duedate(d.toISOString()); + + // local flesh org unit + noncat_circ.circ_lib(egCore.org.get(noncat_circ.circ_lib())); + + patronSvc.items_out.push(noncat_circ); // cache it + return noncat_circ; + }); + } + + // decide which list each circ belongs to function promote_circs(list, display_code, open) { if (open) { @@ -167,6 +212,11 @@ function($scope, $q, $routeParams, egCore , egUser, patronSvc , patronSvc.items_out, offset, count); } + if ($scope.items_out_display == 'noncat') { + // if there are any noncat circ IDs, we already have them + return fetch_noncat_circs(id_list, offset, count); + } + // See if we have the circ IDs for this range already loaded. // this would happen navigating to a subsequent page. if (id_list[offset]) { -- 2.43.2