From: Mike Rylander <mrylander@gmail.com>
Date: Mon, 10 Oct 2011 17:32:55 +0000 (-0400)
Subject: Stamped upgrade script for Grace Period Closed-Date Extension features
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=68a82e7eea6df75eae3966c95538047af0e98a57;p=evergreen%2Fmasslnc.git

Stamped upgrade script for Grace Period Closed-Date Extension features

Signed-off-by: Mike Rylander <mrylander@gmail.com>
---

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index e52f406b05..44423b0f68 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 ('0635', :eg_version); -- berick/senator
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0636', :eg_version); -- miker/tsbere
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0636.data.grace_period_extend.sql b/Open-ILS/src/sql/Pg/upgrade/0636.data.grace_period_extend.sql
new file mode 100644
index 0000000000..97757e5a86
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0636.data.grace_period_extend.sql
@@ -0,0 +1,52 @@
+-- Evergreen DB patch 0636.data.grace_period_extend.sql
+--
+-- OU setting turns on grace period auto extension. By default they only do so
+-- when the grace period ends on a closed date, but there are two modifiers to
+-- change that.
+-- 
+-- The first modifier causes grace periods to extend for all closed dates that
+-- they intersect. This is "grace periods are only consumed by open days."
+-- 
+-- The second modifier causes a grace period that ends just before a closed
+-- day, with or without extension having happened, to include the closed day
+-- (and any following it) as well. This is mainly so that a backdate into the
+-- closed period following the grace period will assume the "best case" of the
+-- item having been returned after hours on the last day of the closed date.
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0636', :eg_version);
+
+INSERT INTO config.org_unit_setting_type(name, grp, label, description, datatype) VALUES
+
+( 'circ.grace.extend', 'circ',
+    oils_i18n_gettext('circ.grace.extend',
+        'Auto-Extend Grace Periods',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.grace.extend',
+        'When enabled grace periods will auto-extend. By default this will be only when they are a full day or more and end on a closed date, though other options can alter this.',
+        'coust', 'description'),
+    'bool', null)
+
+,( 'circ.grace.extend.all', 'circ',
+    oils_i18n_gettext('circ.grace.extend.all',
+        'Auto-Extending Grace Periods extend for all closed dates',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.grace.extend.all',
+        'If enabled and Grace Periods auto-extending is turned on grace periods will extend past all closed dates they intersect, within hard-coded limits. This basically becomes "grace periods can only be consumed by closed dates".',
+        'coust', 'description'),
+    'bool', null)
+
+,( 'circ.grace.extend.into_closed', 'circ',
+    oils_i18n_gettext('circ.grace.extend.into_closed',
+        'Auto-Extending Grace Periods include trailing closed dates',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.grace.extend.into_closed',
+         'If enabled and Grace Periods auto-extending is turned on grace periods will include closed dates that directly follow the last day of the grace period, to allow a backdate into the closed dates to assume "returned after hours on the last day of the grace period, and thus still within it" automatically.',
+        'coust', 'description'),
+    'bool', null);
+
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.grace_period_extend.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.grace_period_extend.sql
deleted file mode 100644
index 84ed345873..0000000000
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.grace_period_extend.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-INSERT INTO config.org_unit_setting_type(name, grp, label, description, datatype) VALUES
-
-( 'circ.grace.extend', 'circ',
-    oils_i18n_gettext('circ.grace.extend',
-        'Auto-Extend Grace Periods',
-        'coust', 'label'),
-    oils_i18n_gettext('circ.grace.extend',
-        'When enabled grace periods will auto-extend. By default this will be only when they are a full day or more and end on a closed date, though other options can alter this.',
-        'coust', 'description'),
-    'bool', null)
-
-,( 'circ.grace.extend.all', 'circ',
-    oils_i18n_gettext('circ.grace.extend.all',
-        'Auto-Extending Grace Periods extend for all closed dates',
-        'coust', 'label'),
-    oils_i18n_gettext('circ.grace.extend.all',
-        'If enabled and Grace Periods auto-extending is turned on grace periods will extend past all closed dates they intersect, within hard-coded limits. This basically becomes "grace periods can only be consumed by closed dates".',
-        'coust', 'description'),
-    'bool', null)
-
-,( 'circ.grace.extend.into_closed', 'circ',
-    oils_i18n_gettext('circ.grace.extend.into_closed',
-        'Auto-Extending Grace Periods include trailing closed dates',
-        'coust', 'label'),
-    oils_i18n_gettext('circ.grace.extend.into_closed',
-         'If enabled and Grace Periods auto-extending is turned on grace periods will include closed dates that directly follow the last day of the grace period, to allow a backdate into the closed dates to assume "returned after hours on the last day of the grace period, and thus still within it" automatically.',
-        'coust', 'description'),
-    'bool', null);