From f9d204bd184f843496f1895dc0600370a81e1d08 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 26 Feb 2021 09:56:07 -0500 Subject: [PATCH] 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 Signed-off-by: Marti Fuerst Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart (cherry picked from commit 44a54eb526eff58b860d699ee3c5fb11b3b25fab) Signed-off-by: Fridolin Somers (cherry picked from commit d4f047c672d25ab5f2ec4dcb716117c7e4b9083f) Signed-off-by: Andrew Fuerste-Henry --- C4/Circulation.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 43475b2703..ad1060bef3 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1463,6 +1463,7 @@ sub AddIssue { $item_object->holdingbranch(C4::Context->userenv->{'branch'}); $item_object->itemlost(0); $item_object->onloan($datedue->ymd()); + $item_object->make_column_dirty('onloan'); # Force write onloan so we don't need to fetch from db $item_object->datelastborrowed( dt_from_string()->ymd() ); $item_object->datelastseen( dt_from_string()->ymd() ); $item_object->store({log_action => 0}); -- 2.39.5