From a8c1d0cadb8725b0f91056f275a4ab8b9daf2f06 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 20 Jul 2011 15:20:00 -0400 Subject: [PATCH] GUI: Uncheck bills by default in the patron billing interface 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 --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 19 +++++++- ....uncheck_bills_and_unfocus_payment_box.sql | 30 +++++++++++++ .../xul/staff_client/server/patron/bill2.js | 45 ++++++++++++++++--- .../xul/staff_client/server/patron/bill2.xul | 2 +- 4 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 9cf3bbca3c..cd16dde9f7 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -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 index 0000000000..3856226e92 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.circ.billing.uncheck_bills_and_unfocus_payment_box.sql @@ -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; diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 490a94a9c6..76eb5af6cf 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -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 + } + } + } ); + } } } diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.xul b/Open-ILS/xul/staff_client/server/patron/bill2.xul index e2ba9eee49..8dba84da11 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill2.xul @@ -142,7 +142,7 @@