From 7a2bae093fb6b590b11cdb034264636eb851e298 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Wed, 18 Jan 2012 11:28:13 -0500 Subject: [PATCH] Add Checkin Alert to Copy Locations If enabled bring up a ROUTE TO prompt for the location at reshelving time. Also, while at it, add Prefix/Suffix to the "new" section of the editor. Signed-off-by: Thomas Berezansky Signed-off-by: Bill Erickson --- Open-ILS/examples/fm_IDL.xml | 1 + .../lib/OpenILS/Application/Storage/CDBI/asset.pm | 2 +- Open-ILS/src/sql/Pg/040.schema.asset.sql | 1 + .../sql/Pg/upgrade/XXXX.copy_location_alert.sql | 2 ++ Open-ILS/web/opac/locale/en-US/lang.dtd | 4 +++ .../staff_client/server/admin/copy_locations.js | 10 +++++++ .../staff_client/server/admin/copy_locations.xhtml | 34 ++++++++++++++++++++++ Open-ILS/xul/staff_client/server/circ/util.js | 16 +++++----- 8 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 8c481ec5ed..4b63e64988 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3772,6 +3772,7 @@ SELECT usr, + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm index 2b541cc95a..2c84f6263f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm @@ -10,7 +10,7 @@ use base qw/asset/; __PACKAGE__->table( 'asset_copy_location' ); __PACKAGE__->columns( Primary => qw/id/ ); -__PACKAGE__->columns( Essential => qw/name owning_lib holdable hold_verify opac_visible circulate label_prefix label_suffix/ ); +__PACKAGE__->columns( Essential => qw/name owning_lib holdable hold_verify opac_visible circulate label_prefix label_suffix checkin_alert/ ); #------------------------------------------------------------------------------- package asset::copy_location_order; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 3beb24e0bf..92fd81c5a8 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -31,6 +31,7 @@ CREATE TABLE asset.copy_location ( circulate BOOL NOT NULL DEFAULT TRUE, label_prefix TEXT, label_suffix TEXT, + checkin_alert BOOL NOT NULL DEFAULT FALSE, CONSTRAINT acl_name_once_per_lib UNIQUE (name, owning_lib) ); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql new file mode 100644 index 0000000000..5c48390841 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql @@ -0,0 +1,2 @@ +ALTER TABLE asset.copy_location + ADD COLUMN checkin_alert BOOL NOT NULL DEFAULT FALSE; diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 1af018fd51..a3a9e7d523 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1976,7 +1976,11 @@ + + + + diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.js b/Open-ILS/xul/staff_client/server/admin/copy_locations.js index cd673cc712..542a33d4c8 100644 --- a/Open-ILS/xul/staff_client/server/admin/copy_locations.js +++ b/Open-ILS/xul/staff_client/server/admin/copy_locations.js @@ -114,6 +114,9 @@ function clCreateNew() { cl.hold_verify( ($('cl_new_hold_verify_yes').checked) ? 1 : 0 ); cl.opac_visible( ($('cl_new_vis_yes').checked) ? 1 : 0 ); cl.circulate( ($('cl_new_circulate_yes').checked) ? 1 : 0 ); + cl.checkin_alert( $('cl_new_checkin_alert_yes').checked ? 1 : 0 ); + cl.label_prefix( $('cl_new_label_prefix').value ); + cl.label_suffix( $('cl_new_label_suffix').value ); var req = new Request(CREATE_CL, SESSION, cl); req.send(true); @@ -160,6 +163,7 @@ function clBuildRow( tbody, row, cl ) { appendClear($n( row, 'cl_hold_verify'), (isTrue(cl.hold_verify())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) ); appendClear($n( row, 'cl_visible'), (isTrue(cl.opac_visible())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) ); appendClear($n( row, 'cl_circulate'), (isTrue(cl.circulate())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) ); + appendClear($n( row, 'cl_checkin_alert'), (isTrue(cl.checkin_alert())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) ); $n( row, 'cl_label_prefix').appendChild(text(cl.label_prefix() || '')); $n( row, 'cl_label_suffix').appendChild(text(cl.label_suffix() || '')); @@ -202,6 +206,8 @@ function clEdit( cl, tbody, row ) { else arr[5].checked = true; if(isTrue(cl.hold_verify())) arr[6].checked = true; else arr[7].checked = true; + if(isTrue(cl.checkin_alert())) arr[8].checked = true; + else arr[9].checked = true; var label_prefix = $n(r, 'cl_edit_label_prefix'); if (cl.label_prefix()) { @@ -237,6 +243,8 @@ function _clOptions(r) { arr[5] = $n( $n(r,'cl_edit_circulate_no'), 'cl_edit_circulate'); arr[6] = $n( $n(r,'cl_edit_hold_verify_yes'), 'cl_edit_hold_verify'); arr[7] = $n( $n(r,'cl_edit_hold_verify_no'), 'cl_edit_hold_verify'); + arr[8] = $n( $n(r,'cl_edit_checkin_alert_yes'), 'cl_edit_checkin_alert'); + arr[9] = $n( $n(r,'cl_edit_checkin_alert_no'), 'cl_edit_checkin_alert'); return arr; } @@ -251,6 +259,8 @@ function clEditCommit( tbody, r, cl ) { else cl.circulate(0); if(arr[6].checked) cl.hold_verify(1); else cl.hold_verify(0); + if(arr[8].checked) cl.checkin_alert(1); + else cl.checkin_alert(0); cl.name($n(r, 'cl_edit_name').value); cl.label_prefix($n(r, 'cl_edit_label_prefix').value); cl.label_suffix($n(r, 'cl_edit_label_suffix').value); diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml b/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml index d42234bfb9..66c5601504 100644 --- a/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml @@ -95,6 +95,28 @@ + &staff.server.admin.copy_locations.editor.checkin_alert.label; + + &staff.server.admin.copy_locations.editor.yes; + + &staff.server.admin.copy_locations.editor.no; + + +   +   + + + &staff.server.admin.copy_locations.editor.prefix.label; + + + + &staff.server.admin.copy_locations.editor.suffix.label; + + + + + @@ -115,6 +137,7 @@ &staff.server.admin.copy_locations.editor.hold_verify; &staff.server.admin.copy_locations.editor.opac_visible; &staff.server.admin.copy_locations.editor.circulate; + &staff.server.admin.copy_locations.editor.checkin_alert; &staff.server.admin.copy_locations.editor.prefix; &staff.server.admin.copy_locations.editor.suffix; &staff.server.admin.copy_locations.editor.edit; @@ -132,6 +155,7 @@ + @@ -197,6 +221,16 @@ + + &staff.server.admin.copy_locations.editor.yes; + + + + &staff.server.admin.copy_locations.editor.no; + + + + diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index c692edd264..76ab082cbe 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2791,10 +2791,15 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += '\n\n'; } + var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; + /* SUCCESS / NO_CHANGE / ITEM_NOT_CATALOGED */ if (check.ilsevent == 0 || check.ilsevent == 3 || check.ilsevent == 1202) { - try { check.route_to = data.lookup('acpl', check.copy.location() ).name(); } - catch(E) { + try { + var acpl = data.lookup('acpl', check.copy.location()); + check.route_to = acpl.name(); + check.checkin_alert = isTrue(acpl.checkin_alert()) && !suppress_popups; + } catch(E) { print_data.error_msg = document.getElementById('commonStrings').getString('common.error'); print_data.error_msg += '\nFIXME: ' + E + '\n'; msg += print_data.error_msg; @@ -2832,7 +2837,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che case 7: /* RESHELVING */ check.what_happened = 'success'; sound.special('checkin.success'); - if (msg) { + if (msg || check.checkin_alert) { print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]); print_data.route_to = check.route_to; msg += print_data.route_to_msg; @@ -2994,7 +2999,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += '\n'; } var rv = 0; - var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; if (suppress_popups) { rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox } @@ -3088,7 +3092,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che sound.special('checkin.cataloging'); check.route_to = 'CATALOGING'; print_data.route_to; - var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; var x = document.getElementById('do_not_alert_on_precat'); var do_not_alert_on_precats = x ? ( x.getAttribute('checked') == 'true' ) : false; if ( !suppress_popups && !do_not_alert_on_precats ) { @@ -3401,7 +3404,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } } var rv = 0; - var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; if (suppress_popups) { rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox } @@ -3483,7 +3485,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che sound.special('checkin.not_found'); check.route_to = 'CATALOGING'; var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]); - var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups']; if (!suppress_popups) { error.yns_alert( mis_scan_msg, @@ -3515,7 +3516,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che sound.special('checkin.hold_capture_delayed'); var rv = 0; msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description'); - var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popupst']; if (!suppress_popups) { rv = error.yns_alert_formatted( msg, -- 2.11.0