Adds the option to print a single item from the Items Out.
authoredoceo <code@edoceo.com>
Thu, 25 Apr 2013 17:52:43 +0000 (10:52 -0700)
committerBen Shum <bshum@biblio.org>
Fri, 12 Jul 2013 20:45:39 +0000 (16:45 -0400)
A new button and right-click option are created.

Signed-off-by: edoceo <code@edoceo.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/patron/items.js
Open-ILS/xul/staff_client/server/patron/items_overlay.xul

index eb827f5..e9f9f1c 100644 (file)
 <!ENTITY staff.patron.items_overlay.show_noncats.label "Show Non-Cataloged Circulations in List Above">
 <!ENTITY staff.patron.items_overlay.show_noncats.accesskey "N">
 <!ENTITY staff.patron.items_overlay.items_export.label "Export">
+<!ENTITY staff.patron.items_overlay.print_one.label "Print Item Receipt">
 <!ENTITY staff.generic.list_actions.label "List Actions">
 <!ENTITY staff.generic.list_actions.accesskey "L">
 <!ENTITY staff.generic.list_actions.sel_clip.label "Copy to Clipboard">
index a2fc061..afe6dcd 100644 (file)
@@ -149,6 +149,8 @@ patron.items.prototype = {
                     ],
                     'cmd_items_print' : [ ['command'], function() { obj.items_print(1); } ],
                     'cmd_items_print2' : [ ['command'], function() { obj.items_print(2); } ],
+                    'cmd_items_print_selected' : [ ['command'], function() { obj.items_print_selected(1); } ],
+                    'cmd_items_print_selected2' : [ ['command'], function() { obj.items_print_selected(2); } ],
                     'cmd_items_export' : [ ['command'], function() { obj.items_export(1); } ],
                     'cmd_items_export2' : [ ['command'], function() { obj.items_export(2); } ],
                     'cmd_items_renew' : [ ['command'], function() { obj.items_renew({which_list:1}); } ],
@@ -299,7 +301,38 @@ patron.items.prototype = {
             obj.error.standard_unexpected_error_alert('printing 1',E);
         }
     },
+    'items_print_selected': function(which) {
+        var obj = this;
+        try {
+            JSAN.use('patron.util');
+            // JSAN.use('util.functional');
+            var list = ( which == 2 ? obj.list2 : obj.list);
+            // Selected Rows
+            var list_dump = list.dump_with_keys();
+            var pick_list = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+            if (!pick_list || pick_list.length == 0) return;
+
+            // I don't know a better way to just get all the data from one row
+            for (var i=0; i<pick_list.length; i++) {
+                var bc = pick_list[i].barcode;
+                for (var j=0; j<list_dump.length; j++) {
+                    if (pick_list[i].barcode == list_dump[j].barcode) {
+                        pick_list[i] = list_dump[j];
+                    }
+                }
+            }
 
+            var params = {
+                'list': pick_list,
+                'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
+                'printer_context' : 'receipt',
+                'template' : 'items_out'
+            };
+            list.print( params );
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert('items_print_selected has failed',E);
+        }
+    },
     'items_export' : function(which) {
         var obj = this;
         try {
index baa00c7..0da6b2c 100644 (file)
@@ -16,6 +16,7 @@
     <command id="sel_patron"/>
     <command id="cmd_triggered_events"/>
     <command id="cmd_items_print" />
+    <command id="cmd_items_print_selected" />
     <command id="cmd_items_export" />
     <command id="cmd_items_renew" />
     <command id="cmd_items_renew_all" />
@@ -40,6 +41,7 @@
     <command id="sel_patron2"/>
     <command id="cmd_triggered_events2"/>
     <command id="cmd_items_print2" />
+    <command id="cmd_items_print_selected2" />
     <command id="cmd_items_export2" />
     <command id="cmd_items_renew2" />
     <command id="cmd_items_renew_with_date2" />
@@ -59,6 +61,7 @@
 <popupset id="items_popupset">
     <menupopup id="items_actions" position="at_pointer"> 
         <menuitem command="sel_clip" label="&staff.patron.items_overlay.sel_clip.label;" accesskey="&staff.patron.items_overlay.sel_clip.accesskey;"/>
+        <menuitem command="cmd_items_print_selected" label="&staff.patron.items_overlay.print_one.label;"/>
         <menuitem command="sel_bucket" label="&staff.patron.items_overlay.sel_bucket.label;" accesskey="&staff.patron.items_overlay.sel_bucket.accesskey;"/>
         <menuitem label="&staff.patron.items_overlay.show_catalog.label;" command="cmd_show_catalog" />
         <menuitem command="sel_copy_details" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
@@ -81,6 +84,7 @@
     </menupopup>
     <menupopup id="items_actions2" position="at_pointer"> 
         <menuitem command="sel_clip2" label="&staff.patron.items_overlay.sel_clip.label;" accesskey="&staff.patron.items_overlay.sel_clip.accesskey;" />
+        <menuitem command="cmd_items_print_selected2" label="&staff.patron.items_overlay.print_one.label;"/>
         <menuitem command="sel_bucket2" label="&staff.patron.items_overlay.sel_bucket.label;" accesskey="&staff.patron.items_overlay.sel_bucket.accesskey;"/>
         <menuitem label="&staff.patron.items_overlay.show_catalog.label;" command="cmd_show_catalog2" />
         <menuitem command="sel_copy_details2" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
         <menu label="&staff.patron.items_overlay.actions_for_selected_items.label;" accesskey="&staff.patron.items_overlay.actions_for_selected_items.accesskey;">
             <menupopup>
                 <menuitem command="sel_clip" label="&staff.patron.items_overlay.sel_clip.label;" accesskey="&staff.patron.items_overlay.sel_clip.accesskey;"/>
+                <menuitem command="cmd_items_print_selected" label="&staff.patron.items_overlay.print_one.label;" />
                 <menuitem command="sel_bucket" label="&staff.patron.items_overlay.sel_bucket.label;" accesskey="&staff.patron.items_overlay.sel_bucket.accesskey;"/>
                 <menuitem label="&staff.patron.items_overlay.show_catalog.label;" command="cmd_show_catalog" />
                 <menuitem command="sel_copy_details" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
         <menu label="&staff.patron.items_overlay.actions_for_selected_items.label;" old_accesskey="&staff.patron.items_overlay.actions_for_selected_items.accesskey;">
             <menupopup>
                 <menuitem command="sel_clip2" label="&staff.patron.items_overlay.sel_clip.label;" accesskey="&staff.patron.items_overlay.sel_clip.accesskey;" />
+                <menuitem command="cmd_items_print_selected2" label="&staff.patron.items_overlay.print_one.label;" />
                 <menuitem command="sel_bucket2" label="&staff.patron.items_overlay.sel_bucket.label;" accesskey="&staff.patron.items_overlay.sel_bucket.accesskey;"/>
                 <menuitem label="&staff.patron.items_overlay.show_catalog.label;" command="cmd_show_catalog2" />
                 <menuitem command="sel_copy_details2" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
     <checkbox id="checkin_auto_print_slips" oils_persist="checked" 
         label="&staff.circ.checkin_overlay.checkin_auto_print_slips.label;"
         accesskey="&staff.circ.checkin_overlay.checkin_auto_print_slips.accesskey;"/>
+    <button id="item_print_single" label="&staff.patron.items_overlay.print_one.label;" command="cmd_items_print_selected" />
     <button id="items_print" label="&staff.patron_display.items.print_receipt.label;" command="cmd_items_print" accesskey="&staff.patron_display.items.print_receipt.accesskey;" />
     <button id="items_export" label="&staff.patron.items_overlay.items_export.label;" command="cmd_items_export" accesskey=""/>
 </hbox>
 
 <hbox id="items_bottom_ui2" flex="1">
     <spacer flex="1"/>
+    <button id="item_print_single2" label="&staff.patron.items_overlay.print_one.label;" command="cmd_items_print_selected2" />
     <button id="items_print2" label="&staff.patron_display.items.print_receipt.label;" command="cmd_items_print2" old_accesskey="&staff.patron_display.items.print_receipt.accesskey;" />
     <button id="items_export2" label="&staff.patron.items_overlay.items_export.label;" command="cmd_items_export2" accesskey=""/>
 </hbox>