From: Kyle Huckins Date: Wed, 20 Nov 2019 22:30:06 +0000 (+0000) Subject: lp1849212: Archive Courses X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e50c487b8d07c484a43e13429db05fdf404001af;p=evergreen%2Ftadl.git lp1849212: Archive Courses - Implement functionality to archive a course via the admin course reserves list UI. - Disassociate all items from a course and reinstate their original fields if temporary fields were applied, upon course archival. Signed-off-by: Kyle Huckins Signed-off-by: Jane Sandberg Changes to be committed: modified: Open-ILS/examples/fm_IDL.xml modified: Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html modified: Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts modified: Open-ILS/src/sql/Pg/040.schema.asset.sql modified: Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 4e678b4793..3bd715d0e8 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3121,6 +3121,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html index eb01af8112..d31f44040e 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.html @@ -4,7 +4,9 @@ - + + + @@ -22,10 +24,13 @@ + + + [preloadLinkedValues]="true" + hiddenFields="is_archived,id"> diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts index ea5dc2fc3f..ab9cd3b36e 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/course-reserves/course-list.component.ts @@ -29,6 +29,8 @@ export class CourseListComponent implements OnInit { @ViewChild('updateFailedString', { static: false }) updateFailedString: StringComponent; @ViewChild('deleteFailedString', { static: true }) deleteFailedString: StringComponent; @ViewChild('deleteSuccessString', { static: true }) deleteSuccessString: StringComponent; + @ViewChild('archiveFailedString', { static: true }) archiveFailedString: StringComponent; + @ViewChild('archiveSuccessString', { static: true }) archiveSuccessString: StringComponent; @ViewChild('courseMaterialDialog', {static: true}) private courseMaterialDialog: CourseAssociateMaterialComponent; @Input() sort_field: string; @@ -123,9 +125,29 @@ export class CourseListComponent implements OnInit { editOneThing(fields.shift()); } + archiveSelected(course: IdlObject[]) { + this.courseSvc.disassociateMaterials(course).then(res => { + course.forEach(course => { + console.log(course); + course.is_archived(true); + }); + this.pcrud.update(course).subscribe( + val => { + console.debug('archived: ' + val); + this.archiveSuccessString.current() + .then(str => this.toast.success(str)); + }, err => { + this.archiveFailedString.current() + .then(str => this.toast.danger(str)); + }, () => { + this.grid.reload(); + } + ); + }); + } + deleteSelected(idl_object: IdlObject[]) { this.courseSvc.disassociateMaterials(idl_object).then(res => { - console.log(res); idl_object.forEach(idl_object => { idl_object.isdeleted(true) }); diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 2091a693fc..262a689926 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -1110,7 +1110,8 @@ CREATE TABLE asset.course_module_course ( name TEXT NOT NULL, course_number TEXT NOT NULL, section_number TEXT, - owning_lib INT REFERENCES actor.org_unit (id) + owning_lib INT REFERENCES actor.org_unit (id), + is_archived BOOLEAN DEFAULT false ); CREATE TABLE asset.course_module_course_users ( 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 8f813f2be4..eb4807e172 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 @@ -7,7 +7,8 @@ CREATE TABLE asset.course_module_course ( name TEXT NOT NULL, course_number TEXT NOT NULL, section_number TEXT, - owning_lib INT REFERENCES actor.org_unit (id) + owning_lib INT REFERENCES actor.org_unit (id), + is_archived BOOLEAN NOT NULL DEFAULT false; ); CREATE TABLE asset.course_module_course_users (