Bugzilla – Attachment 117400 Details for
Bug 27808
Item's onloan column remains unset if a checked out item is issued to another patron without being returned first
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[OPTIONAL] Bug 27808: Refresh the item object when AddReturn is called
OPTIONAL-Bug-27808-Refresh-the-item-object-when-Ad.patch (text/plain), 2.02 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-02-26 20:06:47 UTC
(
hide
)
Description:
[OPTIONAL] Bug 27808: Refresh the item object when AddReturn is called
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-02-26 20:06:47 UTC
Size:
2.02 KB
patch
obsolete
>From 96040ac8731f6d1f136bb18418542a6d1be7fb09 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 26 Feb 2021 16:55:59 -0300 >Subject: [PATCH] [OPTIONAL] Bug 27808: Refresh the item object when AddReturn > is called > >This patch changes the original implementation so the item object is >refreshed altogether instead of explicitly pinpointing a specific field >we identified an edge case can leave out from ->store. I propose this >alterate implementation because what this bug highlights is the fact we >don't code thinking calls to things can have side-effects (like this >case, with AddReturn updating the onloan status (and maybe other >things?). > >To test: >1. Make sure circ tests pass with and without this patch > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Circulation.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 838d0259cba..539e1c3fa37 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1476,6 +1476,8 @@ sub AddIssue { > my ( $allowed, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} ); > return unless $allowed; > AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} ); >+ # AddReturn certainly has side-effects, like onloan => undef >+ $item_object->discard_changes; > } > > C4::Reserves::MoveReserve( $item_object->itemnumber, $borrower->{'borrowernumber'}, $cancelreserve ); >@@ -1565,7 +1567,6 @@ 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.30.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27808
:
117380
|
117381
|
117382
|
117384
|
117385
|
117386
|
117387
|
117398
|
117399
|
117400
|
117443
|
117445
|
117446
|
117454
|
117456