From c2d94d358cb47d202506762cba5b14a70f6f569c Mon Sep 17 00:00:00 2001 From: Kyle Huckins Date: Sun, 13 Mar 2022 01:54:33 +0000 Subject: [PATCH] lp1915556 Course Material Trace Editing - Add Creator, Editor, Create_Time, and Edit_Time fields to Course_Module Course, Course Materials, Term, and Role tables and IDL - Cursory handling within EG2 to prevent setting and editing the above fields directly in EG2 Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/examples/fm_IDL.xml modified: Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html modified: Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html modified: Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts modified: Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html modified: Open-ILS/src/eg2/src/app/staff/share/course.service.ts modified: Open-ILS/src/sql/Pg/040.schema.asset.sql new file: Open-ILS/src/sql/Pg/upgrade/XXXX.scheme.lp1915556-course-material-trace-editing-history.sql --- Open-ILS/examples/fm_IDL.xml | 26 ++++++++++++ .../course-associate-material.component.html | 6 ++- .../course-reserves/course-list.component.html | 8 ++-- .../local/course-reserves/course-list.component.ts | 4 ++ .../course-reserves/course-page.component.html | 2 +- .../src/eg2/src/app/staff/share/course.service.ts | 4 ++ Open-ILS/src/sql/Pg/040.schema.asset.sql | 36 ++++++++++++++++- ...15556-course-material-trace-editing-history.sql | 47 ++++++++++++++++++++++ 8 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.scheme.lp1915556-course-material-trace-editing-history.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 6d8199f011..671205919b 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3257,12 +3257,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + @@ -3312,6 +3318,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + @@ -3321,6 +3331,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + @@ -3346,11 +3358,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + @@ -3391,7 +3409,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html index aec9838d0b..4581028fa5 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html @@ -239,6 +239,10 @@ + + + + @@ -275,5 +279,5 @@ + hiddenFields="id,item,original_callnumber,original_status,original_location,original_circ_modifier,record,temporary_record,editor,create_time,edit_time"> diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html index 6fb0972429..c3cda510cd 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html @@ -51,13 +51,15 @@
  • Terms - + >
  • Course roles - + >
  • @@ -67,7 +69,7 @@ idlClass="acmc" fieldOrder="course_number,name,owning_lib,section_number" [preloadLinkedValues]="true" - hiddenFields="id,is_archived"> + hiddenFields="id,is_archived,creator,editor,create_time,edit_time"> diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts index 2ba9d400b9..ef3cf36cb1 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts @@ -131,6 +131,8 @@ export class CourseListComponent implements OnInit, AfterViewInit { this.editDialog.mode = 'create'; const course_module_course = this.idl.create('acmc'); course_module_course.owning_lib(this.auth.user().ws_ou()); + course_module_course.creator(this.auth.user().id()); + course_module_course.editor(course_module_course.creator()); this.editDialog.recordId = null; this.editDialog.record = course_module_course; this.editDialog.open({size: this.dialog_size}).subscribe( @@ -165,6 +167,8 @@ export class CourseListComponent implements OnInit, AfterViewInit { this.courseSvc.disassociateMaterials(course).then(res => { course.forEach(courseToArchive => { courseToArchive.is_archived(true); + courseToArchive.editor(this.auth.user().id()); + courseToArchive.edit_time(new Date()); }); this.pcrud.update(course).subscribe( val => { diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html index 4936a97440..ea4f4be168 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html @@ -31,7 +31,7 @@
    { this.pcrud.update(item).subscribe(() => { + item.editor(this.auth.user().id()); + item.edit_time(new Date()); if (updatingVolume) { const cn = item.call_number(); const callNumberLibrary = this.org.canHaveVolumes(courseLib) ? courseLib.id() : cn.owning_lib(); diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index e2692381ca..1b827bd798 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -1100,13 +1100,29 @@ 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 DEFAULT false + is_archived BOOLEAN DEFAULT false, + creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); ); CREATE TABLE asset.course_module_role ( id SERIAL PRIMARY KEY, name TEXT UNIQUE NOT NULL, - is_public BOOLEAN NOT NULL DEFAULT false + is_public BOOLEAN NOT NULL DEFAULT false, + creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); ); CREATE TABLE asset.course_module_course_users ( @@ -1127,6 +1143,14 @@ CREATE TABLE asset.course_module_course_materials ( original_status INT REFERENCES config.copy_status, original_circ_modifier TEXT, --REFERENCES config.circ_modifier original_callnumber INT REFERENCES asset.call_number, + creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); unique (course, item, record) ); @@ -1136,6 +1160,14 @@ CREATE TABLE asset.course_module_term ( owning_lib INT REFERENCES actor.org_unit (id), start_date TIMESTAMP WITH TIME ZONE, end_date TIMESTAMP WITH TIME ZONE, + creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); CONSTRAINT cmt_once_per_owning_lib UNIQUE (owning_lib, name) ); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.scheme.lp1915556-course-material-trace-editing-history.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.scheme.lp1915556-course-material-trace-editing-history.sql new file mode 100644 index 0000000000..c7e5498ff5 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.scheme.lp1915556-course-material-trace-editing-history.sql @@ -0,0 +1,47 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE asset.course_module_course + ADD COLUMN creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + ADD COLUMN edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); + +ALTER TABLE asset.course_module_course_materials + ADD COLUMN creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + ADD COLUMN edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); + + +ALTER TABLE asset.course_module_term + ADD COLUMN creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + ADD COLUMN edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); + + +ALTER TABLE asset.course_module_role + ADD COLUMN creator BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN editor BIGINT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED DEFAULT 1, + ADD COLUMN create_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + ADD COLUMN edit_time TIMESTAMP WITH TIME ZONE DEFAULT NOW(); + +COMMIT; \ No newline at end of file -- 2.11.0