From 57593e81dee781919b08d725f8a3003879a4a698 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 Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index f5b28f512d..59cd8483f5 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2649,6 +2649,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.39.5