From 39a195d564e643a876d87869548c6f3f78ca40ed Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Tue, 1 Sep 2020 21:24:08 -0700 Subject: [PATCH] LP1849212: Use a set list of roles Signed-off-by: Jane Sandberg --- Open-ILS/examples/fm_IDL.xml | 19 +++++++++++++-- .../course-associate-users.component.html | 11 ++++----- .../course-associate-users.component.ts | 6 ++--- .../course-reserves/course-list.component.html | 8 ++++++- .../src/eg2/src/app/staff/share/course.service.ts | 3 +-- Open-ILS/src/sql/Pg/040.schema.asset.sql | 9 +++++-- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 5 ++++ .../XXXX.schema.course-materials-module.sql | 28 +++++++++++++++------- 8 files changed, 64 insertions(+), 25 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index e3c2969920..83842045a7 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3081,12 +3081,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - - + + @@ -3189,6 +3189,21 @@ 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-users.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html index f96087deee..47dfce1438 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html @@ -36,10 +36,9 @@
- + + @@ -84,8 +83,8 @@ - - + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts index d9360ccb00..ec178ec998 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts @@ -1,3 +1,4 @@ +import { ComboboxEntry } from '@eg/share/combobox/combobox.component'; import {Component, Input, ViewChild, OnInit} from '@angular/core'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; import {AuthService} from '@eg/core/auth.service'; @@ -39,7 +40,7 @@ export class CourseAssociateUsersComponent extends DialogComponent implements On userEditFailedString: StringComponent; usersDataSource: GridDataSource; userBarcode: String; - userRoleInput: String; + userRoleInput: ComboboxEntry; isPublicRole: Boolean; constructor( @@ -69,8 +70,7 @@ export class CourseAssociateUsersComponent extends DialogComponent implements On const args = { currentCourse: this.currentCourse, barcode: barcode.trim(), - role: this.userRoleInput, - is_public: this.isPublicRole + role: this.userRoleInput.id }; this.userBarcode = null; 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 13f9932563..3fac6006a8 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 @@ -33,7 +33,7 @@ - +
  • @@ -42,6 +42,12 @@
  • +
  • + Course roles + + + +
  • diff --git a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts index c3e480da41..43caf76528 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts @@ -53,7 +53,7 @@ export class CourseService { getUsers(course_ids?: Number[]): Observable { const flesher = { flesh: 1, - flesh_fields: {'acmcu': ['usr']} + flesh_fields: {'acmcu': ['usr', 'usr_role']} }; if (!course_ids) { return this.pcrud.retrieveAll('acmcu', @@ -134,7 +134,6 @@ export class CourseService { associateUsers(patron_id, args) { const new_user = this.idl.create('acmcu'); - if (args.is_public) { new_user.is_public(args.is_public); } if (args.role) { new_user.usr_role(args.role); } new_user.course(args.currentCourse.id()); new_user.usr(patron_id); diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 9d7444faf9..d948f8daa0 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -1118,8 +1118,7 @@ CREATE TABLE asset.course_module_course_users ( id SERIAL PRIMARY KEY, course INT NOT NULL REFERENCES asset.course_module_course (id), usr INT NOT NULL REFERENCES actor.usr (id), - usr_role TEXT, - is_public BOOLEAN NOT NULL DEFAULT false + usr_role INT NOT NULL REFERENCES asset.course_module_role (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); CREATE TABLE asset.course_module_course_materials ( @@ -1144,6 +1143,12 @@ CREATE TABLE asset.course_module_term ( end_date TIMESTAMP WITH TIME ZONE ); +CREATE TABLE asset.course_module_role ( + id SERIAL PRIMARY KEY, + name TEXT UNIQUE NOT NULL, + is_public BOOLEAN NOT NULL DEFAULT false +); + CREATE TABLE asset.course_module_term_course_map ( id BIGSERIAL PRIMARY KEY, term INT NOT NULL REFERENCES asset.course_module_term (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 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 9121785341..58663bdcef 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -20502,4 +20502,9 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) FROM config.bib_source WHERE source='Course materials module'; +INSERT INTO asset.course_module_role (id, name, is_public) VALUES +(1, oils_i18n_gettext(1, 'Instructor', 'acmr', 'name'), true), +(2, oils_i18n_gettext(2, 'Teaching assistant', 'acmr', 'name'), true), +(3, oils_i18n_gettext(2, 'Student', 'acmr', 'name'), false); + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql index a7a2e02b03..c5dfeed65c 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql @@ -15,8 +15,7 @@ CREATE TABLE asset.course_module_course_users ( id SERIAL PRIMARY KEY, course INT NOT NULL REFERENCES asset.course_module_course (id), usr INT NOT NULL REFERENCES actor.usr (id), - usr_role TEXT, - is_public BOOLEAN NOT NULL DEFAULT false + usr_role INT NOT NULL REFERENCES asset.course_module_role (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED ); CREATE TABLE asset.course_module_course_materials ( @@ -25,11 +24,11 @@ CREATE TABLE asset.course_module_course_materials ( item INT REFERENCES asset.copy (id), relationship TEXT, record INT REFERENCES biblio.record_entry (id), - temporary_record BOOLEAN, - original_location INT REFERENCES asset.copy_location, - original_status INT REFERENCES config.copy_status, - original_circ_modifier TEXT, --REFERENCES config.circ_modifier, - original_callnumber INT REFERENCES asset.call_number, + temporary_record BOOLEAN, + original_location INT REFERENCES asset.copy_location, + original_status INT REFERENCES config.copy_status, + original_circ_modifier TEXT, --REFERENCES config.circ_modifier + original_callnumber INT REFERENCES asset.call_number, unique (course, item, record) ); @@ -37,10 +36,21 @@ CREATE TABLE asset.course_module_term ( id SERIAL PRIMARY KEY, name TEXT UNIQUE NOT NULL, owning_lib INT REFERENCES actor.org_unit (id), - start_date TIMESTAMP WITH TIME ZONE, - end_date TIMESTAMP WITH TIME ZONE + start_date TIMESTAMP WITH TIME ZONE, + end_date TIMESTAMP WITH TIME ZONE ); +CREATE TABLE asset.course_module_role ( + id SERIAL PRIMARY KEY, + name TEXT UNIQUE NOT NULL, + is_public BOOLEAN NOT NULL DEFAULT false +); + +INSERT INTO asset.course_module_role (id, name, is_public) VALUES +(1, oils_i18n_gettext(1, 'Instructor', 'acmr', 'name'), true), +(2, oils_i18n_gettext(2, 'Teaching assistant', 'acmr', 'name'), true), +(3, oils_i18n_gettext(2, 'Student', 'acmr', 'name'), false); + CREATE TABLE asset.course_module_term_course_map ( id BIGSERIAL PRIMARY KEY, term INT NOT NULL REFERENCES asset.course_module_term (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, -- 2.11.0