lp1923057 Course Materials disassociate Rework user/khuckins/lp1923057-course-material-archive-date
authorKyle Huckins <khuckins@catalyte.io>
Sun, 13 Mar 2022 04:44:56 +0000 (04:44 +0000)
committerKyle Huckins <khuckins@catalyte.io>
Sun, 13 Mar 2022 04:44:56 +0000 (04:44 +0000)
- Adds a "Currently Associated" boolean and Removal time for course materials
- When disassociating a course material, the time will still show up in the admin grid for course materials, marked as not currently associated.

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/Courses.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Course.pm
Open-ILS/src/sql/Pg/040.schema.asset.sql
Open-ILS/src/sql/Pg/upgrade/xxxx.schema.lp1923057-course-material-removal-time.sql [new file with mode: 0644]

index 6712059..43d5ef8 100644 (file)
@@ -3318,10 +3318,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             <field reporter:label="Original Circ Modifier" name="original_circ_modifier" reporter:datatype="link" />
             <field reporter:label="Original Shelving Location" name="original_location" reporter:datatype="link" />
             <field reporter:label="Original Callnumber" name="original_callnumber" reporter:datatype="link" />
+            <field reporter:label="Associated?" name="is_active" reporter:datatype="bool" />
                        <field reporter:label="Creating User" name="creator" reporter:datatype="link"/>
                        <field reporter:label="Editing User" name="editor" reporter:datatype="link"/>
                        <field reporter:label="Create Time" name="create_time" reporter:datatype="timestamp"/>
                        <field reporter:label="Edit Time" name="edit_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Remove Time" name="removal_time" reporter:datatype="timestamp"/>
         </fields>
         <links>
             <link field="course" reltype="has_a" key="id" map="" class="acmc" />
index 8e08856..76b7830 100644 (file)
           <eg-grid-column path="original_location.name" [hidden]="true" label="Original Shelving Location" i18n-label></eg-grid-column>
           <eg-grid-column path="original_status.name" [hidden]="true" label="Original Item Status" i18n-label></eg-grid-column>
           <eg-grid-column path="relationship" label="Relationship" i18n-label></eg-grid-column>
+          <eg-grid-column path="is_active" label="Currently Associated?" i18n-label datatype="bool"></eg-grid-column>
+          <eg-grid-column path="create_time" label="Create Time" [hidden]="true" i18n-label></eg-grid-column>
+          <eg-grid-column path="removal_time" label="Removal Time" [hidden]="true" i18n-label></eg-grid-column>
         </eg-grid>
       </div>
     </div>
index 6e7c752..6ec25fa 100644 (file)
@@ -244,9 +244,13 @@ sub detach_material {
     }
     if ($acmcm->item) {
         _resetItemFields($e, $authtoken, $acmcm);
-    } 
+    }
+    
+    $acmcm->edit_time();
+    $acmcm->removal_time();
+    $acmcm->is_active('f');
 
-    $e->delete_asset_course_module_course_materials($acmcm) or return $e->die_event;
+    $e->update_asset_course_module_course_materials($acmcm) or return $e->die_event;
     $e->commit;
     return 1;
 }
index 260221f..5caca93 100644 (file)
@@ -36,7 +36,7 @@ sub load_course {
     $ctx->{course_materials} = $U->simplereq(
         'open-ils.courses',
         'open-ils.courses.course_materials.retrieve.fleshed.atomic',
-        {course => $course_id}
+        {course => $course_id, is_active => 't'}
     );
     return Apache2::Const::OK;
 }
index 5fa0c53..79e56c9 100644 (file)
@@ -1143,6 +1143,7 @@ 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,
+    is_active      BOOL NOT NULL DEFAULT true,
        ADD COLUMN creator        BIGINT   NOT NULL
                                REFERENCES actor.usr (id)
                                DEFERRABLE INITIALLY DEFERRED,
@@ -1151,6 +1152,7 @@ CREATE TABLE asset.course_module_course_materials (
                                DEFERRABLE INITIALLY DEFERRED,
        ADD COLUMN create_time    TIMESTAMP WITH TIME ZONE    DEFAULT NOW(),
        ADD COLUMN edit_time      TIMESTAMP WITH TIME ZONE    DEFAULT NOW();
+       ADD COLUMN removal_time      TIMESTAMP WITH TIME ZONE;
     unique (course, item, record)
 );
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.lp1923057-course-material-removal-time.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.lp1923057-course-material-removal-time.sql
new file mode 100644 (file)
index 0000000..e405a01
--- /dev/null
@@ -0,0 +1,8 @@
+BEGIN;\r
+\r
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);\r
+ALTER TABLE asset.course_module_course_materials\r
+    ADD COLUMN is_active      BOOL NOT NULL DEFAULT true,\r
+       ADD COLUMN removal_time      TIMESTAMP WITH TIME ZONE;\r
+\r
+COMMIT;
\ No newline at end of file