From f661516725884b0884cf9bb9691a28076374ed7c Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 16 Aug 2010 18:44:08 +0000
Subject: [PATCH] ui.circ.suppress_checkin_popups disables dialog prompts
 during check-in, but in the case print slip dialogs, it should still print
 the slips if the Auto-Print Hold and Transit Slips checkbox is toggled on
 (the action is still occuring).  However, only the dedicated Check-In
 interface had such a checkbox, and if you were to check-in from Item Status
 or Items Out with that org unit setting active, you'd have no option to print
 any slips associated with the check-in.  This fixes all that

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17229 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/xul/staff_client/server/circ/copy_status.js          | 9 ++++++++-
 Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul | 3 +++
 Open-ILS/xul/staff_client/server/patron/items.js              | 7 ++++++-
 Open-ILS/xul/staff_client/server/patron/items_overlay.xul     | 3 +++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js
index 1a7bf35fbc..581a60ab8e 100644
--- a/Open-ILS/xul/staff_client/server/circ/copy_status.js
+++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js
@@ -246,10 +246,17 @@ circ.copy_status.prototype = {
                         function() {
                             try {
                                 var funcs = [];
+                                var auto_print = document.getElementById('checkin_auto_print_slips');
+                                if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
                                 JSAN.use('circ.util');
                                 for (var i = 0; i < obj.selection_list.length; i++) {
                                     var barcode = obj.selection_list[i].barcode;
-                                    var checkin = circ.util.checkin_via_barcode( ses(), { 'barcode' : barcode } );
+                                    var checkin = circ.util.checkin_via_barcode(
+                                        ses(),
+                                        { 'barcode' : barcode },
+                                        false /* backdate */,
+                                        auto_print
+                                    );
                                     funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
                                 }
                                 for (var i = 0; i < funcs.length; i++) { funcs[i](); }
diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
index 9f270fe750..770400a85b 100644
--- a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
@@ -192,6 +192,9 @@
     <checkbox id="trim_list" label="&staff.circ.copy_status_overlay.trim_list.label;" checked="true" oils_persist="checked" oncommand="try{this.setAttribute('checked',this.checked);}catch(E){alert(E);}" />
     <checkbox id="strict_barcode" label="&staff.circ.copy_status_overlay.strict_barcode.label;" checked="false" oils_persist="checked" oncommand="try{this.setAttribute('checked',this.checked);}catch(E){alert(E);}" /> 
     <spacer flex="1"/>
+    <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;"/>
 </hbox>
 
 </overlay>
diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js
index cd26fbc07d..d9a804e49c 100644
--- a/Open-ILS/xul/staff_client/server/patron/items.js
+++ b/Open-ILS/xul/staff_client/server/patron/items.js
@@ -548,12 +548,17 @@ patron.items.prototype = {
             }
             var r = window.confirm(msg);
             if (!r) { return; }
+            var auto_print = document.getElementById('checkin_auto_print_slips');
+            if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
             JSAN.use('circ.util');
             for (var i = 0; i < retrieve_ids.length; i++) {
                 var copy_id = retrieve_ids[i].copy_id;
                 dump('Check in copy_id = ' + copy_id + ' barcode = ' + retrieve_ids[i].barcode + '\n');
                 var robj = circ.util.checkin_via_barcode(
-                    ses(), { 'copy_id' : copy_id }
+                    ses(),
+                    { 'copy_id' : copy_id },
+                    false /* backdate */,
+                    auto_print
                 );
                 /* circ.util.checkin_via_barcode handles errors currently */
             }
diff --git a/Open-ILS/xul/staff_client/server/patron/items_overlay.xul b/Open-ILS/xul/staff_client/server/patron/items_overlay.xul
index 78f9ce3a9b..f38ce03cf2 100644
--- a/Open-ILS/xul/staff_client/server/patron/items_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/patron/items_overlay.xul
@@ -180,6 +180,9 @@
 <hbox id="items_bottom_ui" flex="1">
     <button id="noncat" label="&staff.patron.items_overlay.show_noncats.label;" command="cmd_show_noncats" accesskey="&staff.patron.items_overlay.show_noncats.accesskey;"/>
     <spacer flex="1"/>
+    <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="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>
-- 
2.11.0