From 10a0644e23c7730f18849f50957dfc10358c23c0 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 20 Jul 2010 21:15:59 +0000 Subject: [PATCH] added support for selecting individual copy statuses that will prevent checkout at self-check even when the generic copy_not_available event has been overridden to allow for non-standard copy circs from selfcheck. TODO: ui for managing the list git-svn-id: svn://svn.open-ils.org/ILS/trunk@16990 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 18 ++++++++++++++++ .../0344.data.sc_copy_status_block_setting.sql | 23 ++++++++++++++++++++ .../web/js/ui/default/circ/selfcheck/selfcheck.js | 25 ++++++++++++++++++---- 4 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0344.data.sc_copy_status_block_setting.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 08bd34c42..6c92fac02 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0343'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0344'); -- berick CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 066058b72..0340144c8 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -5928,3 +5928,21 @@ INSERT INTO config.usr_setting_type (name, opac_visible, label, description, dat 'string' ); +INSERT INTO config.org_unit_setting_type (name, label, description, datatype) + VALUES ( + 'circ.selfcheck.block_checkout_on_copy_status', + oils_i18n_gettext( + 'circ.selfcheck.block_checkout_on_copy_status', + 'Selfcheck: Block copy checkout status', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.selfcheck.block_checkout_on_copy_status', + 'List of copy status IDs that will block checkout even if the generic COPY_NOT_AVAILABLE event is overridden', + 'coust', + 'description' + ), + 'array' + ); + diff --git a/Open-ILS/src/sql/Pg/upgrade/0344.data.sc_copy_status_block_setting.sql b/Open-ILS/src/sql/Pg/upgrade/0344.data.sc_copy_status_block_setting.sql new file mode 100644 index 000000000..7782a6443 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0344.data.sc_copy_status_block_setting.sql @@ -0,0 +1,23 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0344'); + +INSERT INTO config.org_unit_setting_type (name, label, description, datatype) + VALUES ( + 'circ.selfcheck.block_checkout_on_copy_status', + oils_i18n_gettext( + 'circ.selfcheck.block_checkout_on_copy_status', + 'Selfcheck: Block copy checkout status', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.selfcheck.block_checkout_on_copy_status', + 'List of copy status IDs that will block checkout even if the generic COPY_NOT_AVAILABLE event is overridden', + 'coust', + 'description' + ), + 'array' + ); + +COMMIT; diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index a4d061bcc..a9f2ec6a2 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -22,6 +22,8 @@ const SET_WORKSTATION_REQUIRED = 'circ.selfcheck.workstation_required'; const SET_ALERT_POPUP = 'circ.selfcheck.alert.popup'; const SET_ALERT_SOUND = 'circ.selfcheck.alert.sound'; const SET_CC_PAYMENT_ALLOWED = 'credit.payments.allow'; +// This setting only comes into play if COPY_NOT_AVAILABLE is in the SET_AUTO_OVERRIDE_EVENTS list +const SET_BLOCK_CHECKOUT_ON_COPY_STATUS = 'circ.selfcheck.block_checkout_on_copy_status'; function SelfCheckManager() { @@ -243,6 +245,7 @@ SelfCheckManager.prototype.loadOrgSettings = function() { SET_ALERT_POPUP, SET_ALERT_SOUND, SET_AUTO_OVERRIDE_EVENTS, + SET_BLOCK_CHECKOUT_ON_COPY_STATUS, SET_PATRON_PASSWORD_REQUIRED, SET_AUTO_RENEW_INTERVAL, SET_WORKSTATION_REQUIRED, @@ -877,7 +880,7 @@ SelfCheckManager.prototype.checkout = function(barcode, override) { console.log("Checkout out item " + barcode + " with method " + method); var result = fieldmapper.standardRequest( - ['open-ils.circ', 'open-ils.circ.checkout.full'], + ['open-ils.circ', method], {params: [ this.authtoken, { patron_id : this.patron.id(), @@ -917,6 +920,7 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) { var sound = ''; // sound file reference var payload = result.payload || {}; var overrideEvents = this.orgSettings[SET_AUTO_OVERRIDE_EVENTS]; + var blockStatuses = this.orgSettings[SET_BLOCK_CHECKOUT_ON_COPY_STATUS]; if(result.textcode == 'NO_SESSION') { @@ -1006,13 +1010,27 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) { var override = true; for(var i = 0; i < result.length; i++) { - var match = overrideEvents.filter( - function(e) { return (e == result[i].textcode); })[0]; + + var match = overrideEvents.filter(function(e) { return (e == result[i].textcode); })[0]; + if(!match) { override = false; break; } + if(result[i].textcode == 'COPY_NOT_AVAILABLE' && blockStatuses && blockStatuses.length) { + + var stat = result[i].payload.status(); // copy status + if(typeof stat == 'object') stat = stat.id(); + + var match2 = blockStatuses.filter(function(e) { return (e == stat); })[0]; + + if(match2) { // copy is in a blocked status + override = false; + break; + } + } + if(result[i].textcode == 'COPY_IN_TRANSIT') { // to override a transit, we have to abort the transit and check it in first if(this.checkin(item, true)) { @@ -1020,7 +1038,6 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) { } else { override = false; } - } } -- 2.11.0