From d128492c2b75aaf6fef5f0383ff3b105f4f98202 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 6 Jun 2019 12:43:51 +0100 Subject: [PATCH] Bug 22421: Ensure old_issue_id is populated in accountlines Update C4::Circulation::MarkIssueReturned to handle moving issue_id to old_issue_id in accountlines. Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall --- C4/Circulation.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 109809d4b99..5d263780829 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2639,6 +2639,11 @@ sub MarkIssueReturned { # Create the old_issues entry my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store; + # Update accountlines + my $accountlines = + Koha::Account::Lines->search( { issue_id => $issue->issue_id } ); + $accountlines->update({ old_issue_id => $issue->issue_id, issue_id => undef }); + # anonymise patron checkout immediately if $privacy set to 2 and AnonymousPatron is set to a valid borrowernumber if ( $privacy && $privacy == 2) { $old_checkout->anonymize; -- 2.43.0