Bug 27808: Mark the onloan column as dirty in AddIssue
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 26 Feb 2021 14:56:07 +0000 (09:56 -0500)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 1 Mar 2021 14:14:23 +0000 (15:14 +0100)
commit44a54eb526eff58b860d699ee3c5fb11b3b25fab
tree9e5b08185d94654fbf014de907fa1b683a259d90
parent36c49aa2a865a069592c5d7695127252a3007f44
Bug 27808: Mark the onloan column as dirty in AddIssue

If any item is currently checked out to a patron, and the item is then checked out directly to another patron without manually checking the item in first, the items.onloan column will remain NULL.

This will only happen if the new checkout will be due the same day as the previous checked.

This is caused by the item being returned without updating the item object from storage afterward. Even though AddIssue will call AddReturn which sets the value of onloan to NULL in the database, we are not passing in the item object by reference, so it's onloan value remains set to a date. Then we set the onloan value to the same date. Because the value does not change in the object, the column does not get marked dirty.

We could update the object from storage first, but it seems more efficient to mark the column as dirty manually to avoid that otherwise unnecessary fetch.

Test Plan:
1) Apply these patches
2) prove t/db_dependent/Circulation.t

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marti Fuerst <mfuerst@hmcpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Circulation.pm