human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Don't allow deletion of items that are part of a request

Open cielf opened this issue 1 year ago • 2 comments

Summary

If you delete an item, any requests using that item are unviewable So you shouldn't be able to delete an item if there are any requests.

Why?

Hygiene. This is unlikely to happen in the wild.

Details

Recreation

Sign in as org_admin1, Click on Partner Agencies, then All Partners in the left hand menu Click on Pawnee Parent Service.
Click Edit Partner Information Set Group to None Update Partner Click on Inventory, then Items& Inventory in the left hand menu. Click on New Item Fill in some info, make sure Item is Visible to Partners? is checked Save Logout Sign in as [email protected] Create a request that includes that item Save and confirm Login as [email protected] click on requests -- you will see that request Click on Inventory | Items & Inventory click on "Delete" beside the item that you added
Confirm Click on Requests -- it was still showing the request for me, but that might be caching?
Click on View -- Get a "Still haven't found what you're looking for"

What should happen

  • Don't allow deletion of items that are part of a request
  • there should be no delete button on the item. There should, however, be a deactivate button.

Criteria for completion

  • [ ] behaviour as described above
  • [ ] tests to support the behaviour

cielf avatar Oct 20 '24 15:10 cielf

I would like to work on this issue

jorgecoutinhobr avatar Oct 20 '24 23:10 jorgecoutinhobr

Please do!

cielf avatar Oct 20 '24 23:10 cielf

@cielf Should I allow items that are part of a request to not be deleted unless the request status is "discarded"?

jorgecoutinhobr avatar Oct 23 '24 13:10 jorgecoutinhobr

@jorgecoutinhobr Hmm - good question -- I think we want to disallow deletion of the item even if the request's status is discarded. They will still be able to deactivate the item in any case. FWIW, this is a real edge case -- we already disallow deletion if there has ever been any inventory.

cielf avatar Oct 23 '24 13:10 cielf