LP1849212: Correct upgrade script
authorJason Boyer <JBoyer@equinoxinitiative.org>
Fri, 11 Sep 2020 16:43:20 +0000 (12:43 -0400)
committerMichele Morgan <mmorgan@noblenet.org>
Mon, 14 Sep 2020 19:01:29 +0000 (15:01 -0400)
Re-align permission ids and correct syntax errors in the course reserves upgrade script.
I'm not convinced the boolean_facet metabib class should exist simply to add "course reserves, Y/N?"
and in any case can not function as is because adding metabib field classes requires additional
field_entry tables which are missing from the seed data and upgrade script.

Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql

index 421de33..ef3ba98 100644 (file)
@@ -1952,7 +1952,7 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
     'View booking resources', 'ppl', 'description')),
  ( 623, 'UPDATE_ORG_UNIT_SETTING.opac.matomo', oils_i18n_gettext(623,
     'Allows a user to configure Matomo Analytics org unit settings', 'ppl', 'description')),
- ( 624, 'MANAGE_RESERVES', oils_i18n_gettext(623,
+ ( 624, 'MANAGE_RESERVES', oils_i18n_gettext(624,
     'Allows user to manage Courses, Course Materials, and associate Users with Courses.', 'ppl', 'description'))
 ;
 
index ab64dec..4e1d649 100644 (file)
@@ -8,7 +8,7 @@ CREATE TABLE asset.course_module_course (
     course_number   TEXT NOT NULL,
     section_number  TEXT,
     owning_lib      INT REFERENCES actor.org_unit (id),
-    is_archived        BOOLEAN NOT NULL DEFAULT false;
+    is_archived        BOOLEAN NOT NULL DEFAULT false
 );
 
 CREATE TABLE asset.course_module_role (
@@ -86,7 +86,7 @@ VALUES (
     ),
     oils_i18n_gettext(
         'circ.course_materials_opt_in',
-        'If enabled, the Org Unit will utilize Course Material functionality.'
+        'If enabled, the Org Unit will utilize Course Material functionality.',
         'coust',
         'description'
     ), null
@@ -101,7 +101,7 @@ VALUES (
     ),
     oils_i18n_gettext(
         'circ.course_materials_browse_by_instructor',
-        'If enabled, the Org Unit will allow OPAC users to browse Courses by instructor name.'
+        'If enabled, the Org Unit will allow OPAC users to browse Courses by instructor name.',
         'coust',
         'description'
     ), null
@@ -194,6 +194,14 @@ BEGIN
     RETURN NEW;
 END;
 $func$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION biblio.course_reserves_facet () RETURNS TRIGGER AS $func$
+BEGIN
+    PERFORM asset.update_course_reserves_facet(NEW.id, NEW.id);
+    RETURN NEW;
+END;
+$func$ LANGUAGE plpgsql;
+
 CREATE TRIGGER course_reserves_facet AFTER INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE biblio.course_reserves_facet ();