Course archiving and deleting functions should use open-ils.courses.detach_material

Bug #1940105 reported by Jane Sandberg
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned
3.8
Fix Released
Undecided
Unassigned

Bug Description

Thanks to Galen for pointing these out.

Currently, there are two ways of removing a particular material from a course:
  * the open-ils.courses.detach_material OpenSRF call, used for removing individual materials
  * the resetItemFields function in the Angular course service, used when archiving or deleting an entire course

To keep these from growing further and further out of sync, we should have the course archive and delete functions use open-ils.courses.detach_material, and remove the resetItemFields function.

One benefit of doing so is that archiving and deleting courses could benefit from bug 1939730 as soon as it is merged.

Revision history for this message
Beth Willis (willis-a) wrote :

If a course that is selected for deletion still has items associated with it, I think it would be preferable to provide an alert to the user and to require confirmation of this action. Otherwise, it is too easy to delete a course and reset the items inadvertently. I would expect to be able to archive a course with items associated with it but not to be able to delete it.

Kyle Huckins (khuckins)
Changed in evergreen:
assignee: nobody → Kyle Huckins (khuckins)
Revision history for this message
Kyle Huckins (khuckins) wrote :

I've pushed a branch fixing this here: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/khuckins/lp1940105-archive-course-should-detach_material

The archive and delete functions both disassociate materials via course.service's disassociateMaterials function, which called resetItemFields. Insteaed, disassociateMaterials now utilizes the detach_material OpenSRF call, so the fix will apply to both scenarios

Changed in evergreen:
assignee: Kyle Huckins (khuckins) → nobody
tags: added: pullrequest
Michele Morgan (mmorgan)
Changed in evergreen:
milestone: none → 3.8.1
Revision history for this message
Beth Willis (willis-a) wrote :

EG 3-8-0

This patch does what is asked, but the function that's being removed apparently works better than the one that's being kept:

open-ils.courses.detach_material - reverts call number only

resetItemFields - reverts call number, circ modifier and shelving location

Any item attributes that are edited when an item iss associated with a course must be reverted when the item is removed from the course. See bug LP# 1905070, which has been marked as a duplicate of this bug.

Changed in evergreen:
milestone: 3.8.1 → none
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbergja)
Revision history for this message
Jane Sandberg (sandbergja) wrote :

I have a strong suspicion that the issue Beth references is with the line `$e->update_asset_copy($acmcm);`, which really seems like it should be `$e->update_asset_copy($acp);`.

I'll plan to write a live test to exercise my theory, and if it proves correct, add a new commit with Kyle's branch and the detach_materials fix.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Removed pullrequest per comments 3 & 4

tags: added: needswork
removed: pullrequest
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Here is a branch that signs off on Kyle's work, adds a live test, and addresses the copy-pasta that caused items not to update when using the Perl version of this method: user/sandbergja/lp1940105-with-followup

tags: added: pullrequest signedoff
removed: needswork
tags: removed: signedoff
Changed in evergreen:
milestone: none → 3.9.1
Changed in evergreen:
assignee: Jane Sandberg (sandbergja) → nobody
Revision history for this message
Beth Willis (willis-a) wrote :

MOBIUS Test Server

Items may be removed from a course using the "Remove Selected" option from the menu or by archiving the course itself. However, when items are removed, their attributes are not reverting to the original values.

Here's what I tested:

--I signed in to a BR1 workstation

--I added two barcodes (CONC40000626, CONC40000625) to the course "Aardvarks"
--For each item, I edited the call number
--I assigned the circ modifier Reserve1 to CONC40000626;
--I assigned the circ modifier Reserve2 to CONC40000625. (Note: I was not able to edit the shelving location. It looks like the fix for LP#1980887 has not been applied to this server yet.)

--I removed CONC40000625 from the course by selecting it from the course materials grid and choosing "Remove Selected" from the menu.
--This action caused the call number to revert to its original value.
--The circ modifier did not revert and remained Reserve2.

--I archived the course
--This action removed CONC40000626 from the course
--The action caused the call number to revert to its original value
--The circ modifier did not revert and remained Reserve1.

So, the "Remove selected" and "Archive course" actions seem to work the same way, but neither reverts the item attributes correctly.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Removing pullrequest as per comment 7

tags: added: needswork
removed: pullrequest
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Rebased this to facilitate further testing (and as part of rebasing bug 1913604)

Revision history for this message
Michele Morgan (mmorgan) wrote :

Marking this Fix Committed as it was resolved in the patch for bug 1913604.

Changed in evergreen:
status: New → Fix Committed
no longer affects: evergreen/3.7
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.