From 3f2d3a0335fe935e4ec3a310b018b76cdd9f7e3f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 24 Aug 2016 17:01:01 -0400 Subject: [PATCH 1/1] LP#1497335 Show Last Few Circs patron retrieve options In the Show Last Few Circulations window (XUL), disable the "Retrieve Last Patron" button when the most recent circulation is aged. Disable the "Retrieve All These Patrons" button when all circulations displayed are aged. Fixes a sort bug in open-ils.circ.copy_checkout_history.retrieve. Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/Application/Circ.pm | 2 +- .../xul/staff_client/server/circ/circ_summary.xul | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index 530da64057..4d9f881394 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -791,7 +791,7 @@ sub view_circs { return $e->search_action_all_circulation([ {target_copy => $copyid}, - {limit => $count, order_by => { circ => "xact_start DESC" }} + {limit => $count, order_by => { combcirc => "xact_start DESC" }} ]); } diff --git a/Open-ILS/xul/staff_client/server/circ/circ_summary.xul b/Open-ILS/xul/staff_client/server/circ/circ_summary.xul index 26c6e071cb..0c46e993a9 100644 --- a/Open-ILS/xul/staff_client/server/circ/circ_summary.xul +++ b/Open-ILS/xul/staff_client/server/circ/circ_summary.xul @@ -75,6 +75,8 @@ } } + var newest_circ_aged = true; + var all_circs_aged = true; function show_circs() { try { $('r_last').disabled = true; $('r_all').disabled = true; @@ -87,6 +89,12 @@ var gb = $('circs'); for (var j = 0; j < g.circs.length; j++) { + if (g.circs[j].usr()) { // have at least 1 active circ + all_circs_aged = false; + if (j == 0) { // first circ is active + newest_circ_aged = false; + } + } var iframe = document.createElement('iframe'); iframe.setAttribute('style','overflow: none; min-height: 100px;'); iframe.setAttribute('flex','1'); @@ -94,6 +102,12 @@ iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() ); get_contentWindow(iframe).xulG = { 'circ_id' : g.circs[j].id() }; } + + // Disable retrieve patron buttons when there are no + // patrons to retrieve, because related circs are aged. + $('r_all').disabled = all_circs_aged; + $('r_last').disabled = newest_circ_aged; + } catch(E) { g.error.standard_unexpected_error_alert('error showing circs',E); } -- 2.43.2