From 42391f56d8d12535368d60a9bb486597b24b2084 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 24 Jun 2011 11:10:40 -0400 Subject: [PATCH] cat.volume.delete_on_empty org setting. break up and wrap the upgrade script Signed-off-by: Jason Etheridge --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- ...data.org-setting-cat.volume.delete_on_empty.sql | 19 +++++++++ .../Pg/upgrade/XXXX.data.delete_empty_volume.sql | 48 ---------------------- 3 files changed, 20 insertions(+), 49 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0564.data.org-setting-cat.volume.delete_on_empty.sql delete mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.delete_empty_volume.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 5ce512c002..aebecc39a6 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0563', :eg_version); -- berick via miker +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0564', :eg_version); -- berick via phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0564.data.org-setting-cat.volume.delete_on_empty.sql b/Open-ILS/src/sql/Pg/upgrade/0564.data.org-setting-cat.volume.delete_on_empty.sql new file mode 100644 index 0000000000..d5c5213980 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0564.data.org-setting-cat.volume.delete_on_empty.sql @@ -0,0 +1,19 @@ +-- Evergreen DB patch 0564.data.delete_empty_volume.sql +-- +-- New org setting cat.volume.delete_on_empty +-- +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0564', :eg_version); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) + VALUES ( + 'cat.volume.delete_on_empty', + oils_i18n_gettext('cat.volume.delete_on_empty', 'Cat: Delete volume with last copy', 'coust', 'label'), + oils_i18n_gettext('cat.volume.delete_on_empty', 'Automatically delete a volume when the last linked copy is deleted', 'coust', 'description'), + 'bool' + ); + + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.delete_empty_volume.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.delete_empty_volume.sql deleted file mode 100644 index 6c0b6f8df4..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.delete_empty_volume.sql +++ /dev/null @@ -1,48 +0,0 @@ --- Evergreen DB patch XXXX.data.delete_empty_volume.sql --- --- New org setting cat.volume.delete_on_empty --- -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 ( - 'cat.volume.delete_on_empty', - oils_i18n_gettext('cat.volume.delete_on_empty', 'Cat: Delete volume with last copy', 'coust', 'label'), - oils_i18n_gettext('cat.volume.delete_on_empty', 'Automatically delete a volume when the last linked copy is deleted', 'coust', 'description'), - 'bool' - ); - -INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template) - VALUES (38, FALSE, 1, - 'Hold Cancelled (No Target) Email Notification', - 'hold_request.cancel.expire_no_target', - 'HoldIsCancelled', 'SendEmail', '30 minutes', 'cancel_time', 'usr', -$$ -[%- USE date -%] -[%- user = target.0.usr -%] -To: [%- params.recipient_email || user.email %] -From: [%- params.sender_email || default_sender %] -Subject: Hold Request Cancelled - -Dear [% user.family_name %], [% user.first_given_name %] -The following holds were cancelled because no items were found to fullfil the hold. - -[% FOR hold IN target %] - Title: [% hold.bib_rec.bib_record.simple_record.title %] - Author: [% hold.bib_rec.bib_record.simple_record.author %] - Library: [% hold.pickup_lib.name %] - Request Date: [% date.format(helpers.format_date(hold.rrequest_time), '%Y-%m-%d') %] -[% END %] - -$$); - -INSERT INTO action_trigger.environment (event_def, path) VALUES - (38, 'usr'), - (38, 'pickup_lib'), - (38, 'bib_rec.bib_record.simple_record'); - - -COMMIT; -- 2.11.0