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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2019-06-06 12:43:51 +01:00 committed by Katrin Fischer
parent 5e1534f2d8
commit 57593e81de
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 5 additions and 0 deletions

View File

@ -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;