From: Kyle Huckins Date: Wed, 15 May 2019 22:27:01 +0000 (+0000) Subject: lp1616170 Custom Copy Status checkin_ok Field X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=030915726923c7c2e5f6a3b7bb2d67d2cc944d04;p=working%2FEvergreen.git lp1616170 Custom Copy Status checkin_ok Field - Add new config.copy_status fields for previously hardcoded "Checkin Ok" situations, and Event text to the IDL and via SQL - Refactor checkin subroutine check_checkin_copy_status Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/examples/fm_IDL.xml modified: Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm modified: Open-ILS/src/sql/Pg/002.schema.config.sql modified: Open-ILS/src/sql/Pg/950.data.seed-values.sql new file: Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1616170-custom-copy-status-maintainability.sql --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 7270ee3be6..efa592b9d0 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4373,6 +4373,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 73d69efda6..9a9645dbc2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -3897,35 +3897,17 @@ sub checkin_handle_backdate { sub check_checkin_copy_status { my $self = shift; - my $copy = $self->copy; - - my $status = $U->copy_status($copy->status)->id; - - return undef - if( $self->new_copy_alerts || - $status == OILS_COPY_STATUS_AVAILABLE || - $status == OILS_COPY_STATUS_CHECKED_OUT || - $status == OILS_COPY_STATUS_IN_PROCESS || - $status == OILS_COPY_STATUS_ON_HOLDS_SHELF || - $status == OILS_COPY_STATUS_IN_TRANSIT || - $status == OILS_COPY_STATUS_CATALOGING || - $status == OILS_COPY_STATUS_ON_RESV_SHELF || - $status == OILS_COPY_STATUS_CANCELED_TRANSIT || - $status == OILS_COPY_STATUS_RESHELVING ); - - return OpenILS::Event->new('COPY_STATUS_LOST', payload => $copy ) - if( $status == OILS_COPY_STATUS_LOST ); + my $copy = $self->copy; - return OpenILS::Event->new('COPY_STATUS_LOST_AND_PAID', payload => $copy) - if ($status == OILS_COPY_STATUS_LOST_AND_PAID); + my $status = $U->copy_status($copy->status); - return OpenILS::Event->new('COPY_STATUS_LONG_OVERDUE', payload => $copy ) - if( $status == OILS_COPY_STATUS_LONG_OVERDUE ); + return undef + if($self->new_copy_alerts || $status->checkin_ok); - return OpenILS::Event->new('COPY_STATUS_MISSING', payload => $copy ) - if( $status == OILS_COPY_STATUS_MISSING ); + return OpenILS::Event->new($status->copy_status_event, payload => $copy ) + if( $status->copy_status_event ); - return OpenILS::Event->new('COPY_BAD_STATUS', payload => $copy ); + return OpenILS::Event->new('COPY_BAD_STATUS', payload => $copy ); } diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index f50ff9c3ca..68543d09d2 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -442,7 +442,9 @@ CREATE TABLE config.copy_status ( opac_visible BOOL NOT NULL DEFAULT FALSE, copy_active BOOL NOT NULL DEFAULT FALSE, restrict_copy_delete BOOL NOT NULL DEFAULT FALSE, - is_available BOOL NOT NULL DEFAULT FALSE + is_available BOOL NOT NULL DEFAULT FALSE, + checkin_ok BOOL NOT NULL DEFAULT FALSE, + copy_status_event TEXT ); COMMENT ON TABLE config.copy_status IS $$ Copy Statuses 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 c887e9a5bd..697c172b6f 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -523,29 +523,29 @@ INSERT INTO config.rule_age_hold_protect VALUES (2, oils_i18n_gettext(2, '6month', 'crahp', 'name'), '6 months', 2); SELECT SETVAL('config.rule_age_hold_protect_id_seq'::TEXT, 100); -INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,is_available) VALUES (0,oils_i18n_gettext(0, 'Available', 'ccs', 'name'),'t','t','t','t'); -INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,restrict_copy_delete) VALUES (1,oils_i18n_gettext(1, 'Checked out', 'ccs', 'name'),'t','t','t','t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,is_available,checkin_ok) VALUES (0,oils_i18n_gettext(0, 'Available', 'ccs', 'name'),'t','t','t','t','t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,restrict_copy_delete,checkin_ok) VALUES (1,oils_i18n_gettext(1, 'Checked out', 'ccs', 'name'),'t','t','t','t','t'); INSERT INTO config.copy_status (id,name) VALUES (2,oils_i18n_gettext(2, 'Bindery', 'ccs', 'name')); -INSERT INTO config.copy_status (id,name,restrict_copy_delete) VALUES (3,oils_i18n_gettext(3, 'Lost', 'ccs', 'name'),'t'); -INSERT INTO config.copy_status (id,name) VALUES (4,oils_i18n_gettext(4, 'Missing', 'ccs', 'name')); -INSERT INTO config.copy_status (id,name,holdable,opac_visible) VALUES (5,oils_i18n_gettext(5, 'In process', 'ccs', 'name'),'t','t'); -INSERT INTO config.copy_status (id,name,holdable,opac_visible,restrict_copy_delete) VALUES (6,oils_i18n_gettext(6, 'In transit', 'ccs', 'name'),'t','t','t'); -INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,is_available) VALUES (7,oils_i18n_gettext(7, 'Reshelving', 'ccs', 'name'),'t','t','t','t'); -INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,restrict_copy_delete) VALUES (8,oils_i18n_gettext(8, 'On holds shelf', 'ccs', 'name'),'t','t','t','t'); +INSERT INTO config.copy_status (id,name,restrict_copy_delete,copy_status_event) VALUES (3,oils_i18n_gettext(3, 'Lost', 'ccs', 'name'),'t','COPY_STATUS_LOST'); +INSERT INTO config.copy_status (id,name,copy_status_event) VALUES (4,oils_i18n_gettext(4, 'Missing', 'ccs', 'name'),'t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,checkin_ok) VALUES (5,oils_i18n_gettext(5, 'In process', 'ccs', 'name'),'t','t','t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,restrict_copy_delete,checkin_ok) VALUES (6,oils_i18n_gettext(6, 'In transit', 'ccs', 'name'),'t','t','t','t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,is_available,checkin_ok) VALUES (7,oils_i18n_gettext(7, 'Reshelving', 'ccs', 'name'),'t','t','t','t','t'); +INSERT INTO config.copy_status (id,name,holdable,opac_visible,copy_active,restrict_copy_delete,checkin_ok) VALUES (8,oils_i18n_gettext(8, 'On holds shelf', 'ccs', 'name'),'t','t','t','t','t'); INSERT INTO config.copy_status (id,name,holdable,opac_visible) VALUES (9,oils_i18n_gettext(9, 'On order', 'ccs', 'name'),'t','t'); INSERT INTO config.copy_status (id,name,copy_active) VALUES (10,oils_i18n_gettext(10, 'ILL', 'ccs', 'name'),'t'); -INSERT INTO config.copy_status (id,name) VALUES (11,oils_i18n_gettext(11, 'Cataloging', 'ccs', 'name')); +INSERT INTO config.copy_status (id,name,checkin_ok) VALUES (11,oils_i18n_gettext(11, 'Cataloging', 'ccs', 'name'),'t'); INSERT INTO config.copy_status (id,name,opac_visible,copy_active) VALUES (12,oils_i18n_gettext(12, 'Reserves', 'ccs', 'name'),'t','t'); INSERT INTO config.copy_status (id,name) VALUES (13,oils_i18n_gettext(13, 'Discard/Weed', 'ccs', 'name')); INSERT INTO config.copy_status (id,name) VALUES (14,oils_i18n_gettext(14, 'Damaged', 'ccs', 'name')); -INSERT INTO config.copy_status (id,name,copy_active) VALUES (15,oils_i18n_gettext(15, 'On reservation shelf', 'ccs', 'name'),'t'); +INSERT INTO config.copy_status (id,name,copy_active,checkin_ok) VALUES (15,oils_i18n_gettext(15, 'On reservation shelf', 'ccs', 'name'),'t','t'); INSERT INTO config.copy_status - (id, name, holdable, opac_visible, copy_active, restrict_copy_delete) - VALUES (16, oils_i18n_gettext(16, 'Long Overdue', 'ccs', 'name'), 'f', 'f', 'f', 't'); + (id, name, holdable, opac_visible, copy_active, restrict_copy_delete, copy_status_event) + VALUES (16, oils_i18n_gettext(16, 'Long Overdue', 'ccs', 'name'), 'f', 'f', 'f', 't', 'COPY_STATUS_LONG_OVERDUE'); INSERT INTO config.copy_status -(id, name, holdable, opac_visible, copy_active, restrict_copy_delete) -VALUES (17, oils_i18n_gettext(17, 'Lost and Paid', 'ccs', 'name'), 'f', 'f', 'f', 't'); -INSERT INTO config.copy_status(id,name,holdable,opac_visible) VALUES (18,oils_i18n_gettext(18, 'Canceled Transit', 'ccs', 'name'),'t','t'); +(id, name, holdable, opac_visible, copy_active, restrict_copy_delete, copy_status_event) +VALUES (17, oils_i18n_gettext(17, 'Lost and Paid', 'ccs', 'name'), 'f', 'f', 'f', 't', 'COPY_STATUS_LOST_AND_PAID'); +INSERT INTO config.copy_status(id,name,holdable,opac_visible,checkin_ok) VALUES (18,oils_i18n_gettext(18, 'Canceled Transit', 'ccs', 'name'),'t','t','t'); SELECT SETVAL('config.copy_status_id_seq'::TEXT, 100); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1616170-custom-copy-status-maintainability.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1616170-custom-copy-status-maintainability.sql new file mode 100644 index 0000000000..737c346555 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1616170-custom-copy-status-maintainability.sql @@ -0,0 +1,26 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE config.copy_status + ADD COLUMN checkin_ok BOOL NOT NULL DEFAULT FALSE, + ADD COLUMN copy_status_event TEXT; + + -- Update checkin_ok + UPDATE config.copy_status SET checkin_ok = true WHERE id = 0; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 1; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 5; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 6; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 7; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 8; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 11; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 15; + UPDATE config.copy_status SET checkin_ok = true WHERE id = 18; + + -- Update copy_status_event + UPDATE config.copy_status SET copy_status_event = 'COPY_STATUS_LOST' WHERE id = 3; + UPDATE config.copy_status SET copy_status_event = 'COPY_STATUS_MISSING' WHERE id = 4; + UPDATE config.copy_status SET copy_status_event = 'COPY_STATUS_LONG_OVERDUE' WHERE id = 16; + UPDATE config.copy_status SET copy_status_event = 'COPY_STATUS_LOST_AND_PAID' WHERE id = 17; + +COMMIT;