GUI: Uncheck bills by default in the patron billing interface
authorJason Etheridge <jason@esilibrary.com>
Wed, 20 Jul 2011 19:20:00 +0000 (15:20 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 25 Jul 2011 21:12:19 +0000 (17:12 -0400)
Org unit setting and behavior.  Also defaults the focus to the Uncheck All
button instead of the Payment Received field in that interface.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/bill2.js
Open-ILS/xul/staff_client/server/patron/bill2.xul

index 9cf3bbc..cd16dde 100644 (file)
@@ -2751,7 +2751,24 @@ INSERT into config.org_unit_setting_type
     oils_i18n_gettext( 'org.patron_opt_default', 'Circ: Patron Opt-In Default', 'coust', 'label'),
     oils_i18n_gettext( 'org.patron_opt_default', 'This is the default depth at which a patron is opted in; it is calculated as an org unit relative to the current workstation.', 'coust', 'label'),
     'integer')
-
+,( 
+        'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+        oils_i18n_gettext(
+            'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+            'GUI: Uncheck bills by default in the patron billing interface',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+            'Uncheck bills by default in the patron billing interface,'
+            || ' and focus on the Uncheck All button instead of the'
+            || ' Payment Received field.',
+            'coust',
+            'description'
+        ),
+        'bool'
+    )
 ;
 
 UPDATE config.org_unit_setting_type
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql
new file mode 100644 (file)
index 0000000..3856226
--- /dev/null
@@ -0,0 +1,30 @@
+-- Evergreen DB patch XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql
+--
+-- New org setting ui.circ.billing.uncheck_bills_and_unfocus_payment_box
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) 
+    VALUES ( 
+        'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+        oils_i18n_gettext(
+            'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+            'GUI: Uncheck bills by default in the patron billing interface',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.circ.billing.uncheck_bills_and_unfocus_payment_box',
+            'Uncheck bills by default in the patron billing interface,'
+            || ' and focus on the Uncheck All button instead of the'
+            || ' Payment Received field.',
+            'coust',
+            'description'
+        ),
+        'bool'
+    );
+
+COMMIT;
index 490a94a..76eb5af 100644 (file)
@@ -47,9 +47,21 @@ function my_init() {
             $('credit_forward').setAttribute('value',util.money.sanitize( g.patron.credit_forward_balance() ));
         }
 
-        default_focus();
-
-        tally_all();
+        if (g.data.hash.aous['ui.circ.billing.uncheck_bills_and_unfocus_payment_box']) {
+            g.funcs.push(
+                function() {
+                    $('uncheck_all').focus();
+                    tally_all();
+                }
+            );
+        } else {
+            g.funcs.push(
+                function() {
+                    default_focus();
+                    tally_all();
+                }
+            );
+        }
 
     } catch(E) {
         var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill2.xul', E]);
@@ -406,8 +418,31 @@ function check_all_refunds() {
 
 function gen_list_append_func(r) {
     return function() {
-        if (typeof r == 'object') { g.row_map[ r.id() ] = g.bill_list.append( { 'retrieve_id' : r.id(), 'flesh_immediately' : true, 'row' : { 'my' : { 'checked' : true, 'mbts' : r } } } );
-        } else { g.row_map[r] = g.bill_list.append( { 'retrieve_id' : r, 'flesh_immediately' : true, 'row' : { 'my' : { 'checked' : true } } } ); }
+        var default_check_state = g.data.hash.aous[
+            'ui.circ.billing.uncheck_bills_and_unfocus_payment_box'
+        ] ? false : true;
+        if (typeof r == 'object') {
+            g.row_map[ r.id() ] = g.bill_list.append( {
+                'retrieve_id' : r.id(),
+                'flesh_immediately' : true,
+                'row' : {
+                    'my' : {
+                        'checked' : default_check_state,
+                        'mbts' : r
+                    }
+                }
+            } );
+        } else {
+            g.row_map[r] = g.bill_list.append( {
+                'retrieve_id' : r,
+                'flesh_immediately' : true,
+                'row' : {
+                    'my' : {
+                        'checked' : default_check_state
+                    }
+                }
+            } );
+        }
     }
 }
 
index e2ba9ee..8dba84d 100644 (file)
                 <hbox>
                     <hbox id="bill_list_actions" />
                     <button label="&staff.patron.bills_overlay.check_all.label;" accesskey="&staff.patron.bills_overlay.check_all.accesskey;" oncommand="check_all();"/>
-                    <button label="&staff.patron.bills_overlay.uncheck_all.label;" accesskey="&staff.patron.bills_overlay.uncheck_all.accesskey;" oncommand="uncheck_all();"/>
+                    <button id="uncheck_all" label="&staff.patron.bills_overlay.uncheck_all.label;" accesskey="&staff.patron.bills_overlay.uncheck_all.accesskey;" oncommand="uncheck_all();"/>
                     <button label="&staff.patron.bills_overlay.check_all_refunds.label;" accesskey="&staff.patron.bills_overlay.check_all_refunds.accesskey;" oncommand="check_all_refunds();"/>
                     <button id="print" label="&staff.patron.bills_overlay.print_bills.label;" accesskey="&staff.patron.bills_overlay.print_bills.accesskey;" oncommand="print_bills();"/>
                     <spacer flex="1"/>