Filters for the triggered events interface, and support for items instead of patrons...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Nov 2009 22:41:20 +0000 (22:41 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Nov 2009 22:41:20 +0000 (22:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14889 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/trigger_events.js
Open-ILS/xul/staff_client/server/patron/trigger_events.xul

index c69d5c1..1a2e394 100644 (file)
 <!ENTITY staff.patron_display.trigger_event.menu.actions.cancel.accesskey "C">
 <!ENTITY staff.patron_display.trigger_event.menu.actions.reset.label "Reset Event">
 <!ENTITY staff.patron_display.trigger_event.menu.actions.reset.accesskey "R">
+<!ENTITY staff.patron_display.trigger_event.radio_button.circ_events.label "Circ Events">
+<!ENTITY staff.patron_display.trigger_event.radio_button.circ_events.accesskey "C">
+<!ENTITY staff.patron_display.trigger_event.radio_button.hold_events.label "Hold Events">
+<!ENTITY staff.patron_display.trigger_event.radio_button.hold_events.accesskey "H">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.pending.label "Pending">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.pending.accesskey "P">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.complete.label "Complete">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.complete.accesskey "t">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.error.label "Error">
+<!ENTITY staff.patron_display.trigger_event.checkbox_filter.error.accesskey "E">
 <!ENTITY staff.patron_editor_interface_label "Patron Edit">
 <!ENTITY staff.patron_interface_label "Patron ">
 <!ENTITY staff.patron_navbar.bills 'Bills'>
index 1b0ea84..a4a833d 100644 (file)
@@ -145,6 +145,8 @@ const api = {
     'FM_ATC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve_by_lib', 'secure' : false },
     'FM_ATEV_APROPOS_AHR' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.events.ahr', 'secure' : true },
     'FM_ATEV_APROPOS_CIRC' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.events.circ', 'secure' : true },
+    'FM_ATEV_APROPOS_AHR_VIA_COPY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.copy.events.ahr', 'secure' : true },
+    'FM_ATEV_APROPOS_CIRC_VIA_COPY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.copy.events.circ', 'secure' : true },
     'FM_ATEV_CANCEL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.event.cancel.batch', 'secure' : false },
     'FM_ATEV_RESET' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.event.reset.batch', 'secure' : false },
     'FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve_id_by_barcode_or_username' },
index f7d2dd8..d5cecc7 100644 (file)
@@ -1,4 +1,4 @@
-var list; var error; var net; var rows; var archived_rows;
+var list; var error; var net; var rows;
 
 function $(id) { return document.getElementById(id); }
 
@@ -38,6 +38,11 @@ function trigger_event_init() {
         init_list();
         $('cmd_cancel_event').addEventListener('command', gen_event_handler('cancel'), false);
         $('cmd_reset_event').addEventListener('command', gen_event_handler('reset'), false);
+        $('circ').addEventListener('command', function() { populate_list(); }, false);
+        $('ahr').addEventListener('command', function() { populate_list(); }, false);
+        $('pending').addEventListener('command', function() { populate_list(); }, false);
+        $('complete').addEventListener('command', function() { populate_list(); }, false);
+        $('error').addEventListener('command', function() { populate_list(); }, false);
         populate_list();
         default_focus();
 
@@ -134,6 +139,8 @@ function handle_selection(ev) { // handler for list row selection event
 function populate_list() {
     try {
 
+        $('circ').disabled = true; $('ahr').disabled = true; $('pending').disabled = true; $('complete').disabled = true; $('error').disabled = true;
+
         rows = {};
         list.clear();
 
@@ -153,20 +160,28 @@ function populate_list() {
         function onError(r) {
             var evt = openils.Util.readResponse(r);
             alert('error, evt = ' + js2JSON(evt));
+            $('circ').disabled = false; $('ahr').disabled = false; $('pending').disabled = false; $('complete').disabled = false; $('error').disabled = false;
         }
 
-        var methods = ['FM_ATEV_APROPOS_CIRC','FM_ATEV_APROPOS_AHR'];
-        for (var i in methods) {
-            fieldmapper.standardRequest(
-                [api[methods[i]].app, api[methods[i]].method ],
-                {   async: true,
-                    params: [ses(), xul_param('patron_id')],
-                    onresponse : onResponse,
-                    onerror : onError,
-                    oncomplete : function() {}
+        var method = $('circ').checked ? 'FM_ATEV_APROPOS_CIRC' : 'FM_ATEV_APROPOS_AHR';
+        if (xul_param('copy_id')) { method += '_VIA_COPY'; }
+
+        var filter = {"event":{"state":"complete"}, "offset":0, "limit":10, "order_by":[{"class":"atev", "field":"run_time", "direction":"desc"}]};
+
+        if ($('pending').checked) { filter.event.state = 'pending'; filter.order_by[0].direction = 'asc'; }
+        if ($('error').checked) { filter.event.state = 'error'; }
+
+        fieldmapper.standardRequest(
+            [api[method].app, api[method].method ],
+            {   async: true,
+                params: [ses(), xul_param('copy_id') || xul_param('patron_id'), filter],
+                onresponse : onResponse,
+                onerror : onError,
+                oncomplete : function() {
+                    $('circ').disabled = false; $('ahr').disabled = false; $('pending').disabled = false; $('complete').disabled = false; $('error').disabled = false;
                 }
-            );
-        }
+            }
+        );
 
     } catch(E) {
         var err_prefix = 'trigger_events.js -> populate_list() : ';
index a133856..73d4dbd 100644 (file)
@@ -17,7 +17,7 @@
 <!-- OVERLAYS -->
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
 
-<window id="trigger_event_win" onload="try { trigger_event_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+<window id="trigger_event_win" onload="try { font_helper(); persist_helper(); trigger_event_init(); } catch(E) { alert(E); }"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
         <caption id="trigger_event_caption" label="&staff.patron_display.trigger_event.caption;"/>
         <vbox flex="0">
             <hbox flex="1">
+                <toolbar id="filters" flex="1">
+                    <toolbarbutton id="circ" label="&staff.patron_display.trigger_event.radio_button.circ_events.label;" accesskey="&staff.patron_display.trigger_event.radio_button.circ_events.accesskey;" 
+                        type="radio" group="atev_type" checked="true" style="-moz-user-focus: normal" oils_persist="checked" oils_persist_no_poke="true"
+                        oncommand="oils_persist(document.getElementById('ahr'));" />
+                    <toolbarbutton id="ahr" label="&staff.patron_display.trigger_event.radio_button.hold_events.label;" accesskey="&staff.patron_display.trigger_event.radio_button.hold_events.accesskey;" 
+                        type="radio" group="atev_type" style="-moz-user-focus: normal" oils_persist="checked" oils_persist_no_poke="true"
+                        oncommand="oils_persist(document.getElementById('circ'));" />
+                    <toolbarseparator/>
+                    <toolbarbutton id="pending" label="&staff.patron_display.trigger_event.checkbox_filter.pending.label;" accesskey="&staff.patron_display.trigger_event.checkbox_filter.pending.accesskey;" 
+                        type="radio" group="atev_status" checked="true" style="-moz-user-focus: normal" oils_persist="checked" oils_persist_no_poke="true"
+                        oncommand="oils_persist(document.getElementById('complete')); oils_persist(document.getElementById('error'));"/>
+                    <toolbarbutton id="complete" label="&staff.patron_display.trigger_event.checkbox_filter.complete.label;" accesskey="&staff.patron_display.trigger_event.checkbox_filter.complete.accesskey;" 
+                        type="radio" group="atev_status" style="-moz-user-focus: normal" oils_persist="checked" oils_persist_no_poke="true"
+                        oncommand="oils_persist(document.getElementById('pending')); oils_persist(document.getElementById('error'));"/>
+                    <toolbarbutton id="error" label="&staff.patron_display.trigger_event.checkbox_filter.error.label;" accesskey="&staff.patron_display.trigger_event.checkbox_filter.error.accesskey;" 
+                        type="radio" group="atev_status" style="-moz-user-focus: normal" oils_persist="checked" oils_persist_no_poke="true"
+                        oncommand="oils_persist(document.getElementById('pending')); oils_persist(document.getElementById('complete'));"/>
+                </toolbar>
                 <spacer flex="1" />
                 <progressmeter id="progress" flex="1" hidden="true" mode="undetermined"/>
                 <menubar>
                     <menu label="&staff.patron_display.trigger_event.menu.actions.label;" 
                         accesskey="&staff.patron_display.trigger_event.menu.actions.accesskey;" 
-                        type="menu" style="-moz-user-focus: normal">
+                        style="-moz-user-focus: normal">
                         <menupopup>
                             <menuitem command="cmd_cancel_event" label="&staff.patron_display.trigger_event.menu.actions.cancel.label;" accesskey="&staff.patron-display.menu.actions.cancel.accesskey;"/>
                             <menuitem command="cmd_reset_event" label="&staff.patron_display.trigger_event.menu.actions.reset.label;" accesskey="&staff.patron-display.menu.actions.reset.accesskey;"/>