rubyforgood / human-essentials

Human Essentials is an inventory management system for diaper, incontinence, and period-supply banks. It supports them in distributing to partners, tracking inventory, and reporting stats and analytics.
https://humanessentials.app
MIT License
436 stars 450 forks source link

Prevent changing storage location on itemizables if there has been an intervening audit of the items involved #4304

Closed cielf closed 2 weeks ago

cielf commented 2 months ago

Summary

Prevent changing storage location on donation/distribution/purchase if there has been an intervening audit on the items involved.

Why?

It's an extremely edge case, and we're not sure what the effects on inventory should be in this case. It gets really messy if new items are added at the same time, for example!

Details

For each of purchase, donation, and distribution: On edit, on save, if the storage location has been changed, and there has been an intervening audit on any of the items involved (either original or new) for either of the storage locations, give the error message as follows:

For distribution: "Cannot change the storage location because there has been an intervening audit of some items. If you need to change the storage location, please reclaim this distribution and create a new distribution from the new storage location"

For donation: "Cannot change the storage location because there has been an intervening audit of some items. If you need to change the storage location, please delete this donation and create a new donation with the new storage location"

For purchases: "Cannot change the storage location because there has been an intervening audit of some items. If you need to change the storage location, please delete this purchase and create a new purchase with the new storage location"

Criteria for completion

jp524 commented 1 month ago

I'd like to help with this issue.

cielf commented 1 month ago

Please do!

jp524 commented 1 month ago

@cielf I started looking at this and I saw that a warning is displayed on the edit pages for donation/distribution/purchase that have an intervening audit (please refer to #4026 and #4086).

I just wanted to confirm with you if the feature for this issue is to be added on top of the existing warning, or if the existing warning needs to be modified at all.

cielf commented 1 month ago

Yes please, we still need it. Because someone could ignore the warning.

dorner commented 3 weeks ago

Do we need the warning at all if we have the error?

cielf commented 3 weeks ago

The warning is more wide-spread -- covering the items as well -- we will let them change the item levels, so yes.