Pharmaceuticals double edit causes "the data has been updated by someone else"

Description

In Pharmacy → Pharmaceuticals, if the Edit function is called twice on the same line, the second time does not allow the data to be changed again giving the signal that it is still reserved by others. You must exit or re-perform a selection to eliminate the anomaly.

Environment

None

Attachments

1

Activity

David B Malkovsky July 28, 2022 at 7:45 PM

Here is the HotFix PR:

David B Malkovsky July 28, 2022 at 7:12 PM

I started making that change at one time and it touched so many classes. I will circle back around to it after I get done with the date and time chooser changes.

Alessandro Domanico July 27, 2022 at 9:21 PM

Yes, this is the problem in having a boolean as returning value from an insert/update rather than the new entity from a .save() method. If time is ripe to make this change maybe would be better (I remember we already discussed some time ago) otherwise the PR is ok.

In any case, you should also fetch the new “hotfix” branch (created from tag v1.11.3) and start a PR against it. Thanks!

David B Malkovsky July 23, 2022 at 6:03 PM

There is a similar issue if you edit an object and then try to delete it; you get the same error message.

The problem is that the code is using the original medical record and after the edit the Lock variable is increased and thus trying to save a second edit (or delete) the record doesn’t match what is currently in the database. The “fix” is to refetch the most recent record before editing and apply the second set of changes to that “new” record.

Done

Details

Assignee

Reporter

Labels

Original estimate

Time tracking

25m logged3h 35m remaining

Components

Fix versions

Due date

Priority

Created July 22, 2022 at 10:38 AM
Updated January 30, 2023 at 11:55 PM
Resolved July 30, 2022 at 10:07 PM