LP#1497335 Show Last Few Circs patron retrieve options
authorBill Erickson <berickxx@gmail.com>
Wed, 24 Aug 2016 21:01:01 +0000 (17:01 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 24 Aug 2016 22:28:51 +0000 (18:28 -0400)
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 <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
Open-ILS/xul/staff_client/server/circ/circ_summary.xul

index 530da64..4d9f881 100644 (file)
@@ -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" }} 
     ]);
 }
 
index 26c6e07..0c46e99 100644 (file)
@@ -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;    
 
                 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');
                     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);
             }