Bug 19487: Refetch the object to get up-to-date values
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 20 Oct 2017 18:56:20 +0000 (15:56 -0300)
committerKatrin Fischer <katrin.fischer.83@web.de>
Mon, 20 Nov 2017 21:27:16 +0000 (22:27 +0100)
This has been raised by failures on t/db_dependent/Circulation/issue.t
(thanks tests!)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 850243ee2ec66a4b569d29ed84423f09c0001690)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9d3b39e94de837cfc08259ae5778fb0372b662ff)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

C4/Circulation.pm

index 1f6ae4d..8b9ac6d 100644 (file)
@@ -2172,6 +2172,9 @@ sub MarkIssueReturned {
         # Update the returndate
         $dbh->do( $query, undef, @bind );
 
+        # We just updated the returndate, so we need to refetch $issue
+        $issue->discard_changes;
+
         # Create the old_issues entry
         my $old_checkout = Koha::OldIssue->new($issue->unblessed)->store;