Bug 22421: (follow-up) Use checkout accessor to get correct issue_id

In some cases, we may want to update an AccountLine that is linked to a
checkout without knowing whether it is a current or old checkout. In
these cases, use the AccountLines ->checkout accessor to ensure we get
the issue_id correctly, regardless of whether it is a current issue or
and old_issue.

This also applies when generating a new AccountLine based on an existing
AccountLine (for example, adding a credit to refund a previously charged
fine)

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:
Emily Lamancusa 2024-10-24 11:37:56 -04:00 committed by Katrin Fischer
parent e35ab15741
commit c55f3e69a3
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 3 additions and 3 deletions

View File

@ -563,7 +563,7 @@ sub UpdateFine {
# - accumulate fines for other items
# so we can update $itemnum fine taking in account fine caps
while (my $overdue = $overdues->next) {
if ( defined $overdue->issue_id && $overdue->issue_id == $issue_id && $overdue->status eq 'UNRETURNED' ) {
if ( defined $overdue->checkout && $overdue->checkout->issue_id == $issue_id && $overdue->status eq 'UNRETURNED' ) {
if ($accountline) {
Koha::Logger->get->debug("Not a unique accountlines record for issue_id $issue_id"); # FIXME Do we really need to log that?
#FIXME Should we still count this one in total_amount ??

View File

@ -1591,7 +1591,7 @@ sub _set_found_trigger {
interface => C4::Context->interface,
library_id => $branchcode,
item_id => $self->itemnumber,
issue_id => $lost_charge->issue_id
issue_id => $lost_charge->checkout ? $lost_charge->checkout->issue_id : undef,
}
);
@ -1747,7 +1747,7 @@ sub _set_found_trigger {
interface => C4::Context->interface,
library_id => $branchcode,
item_id => $self->itemnumber,
issue_id => $processing_charge->issue_id
issue_id => $processing_charge->checkout ? $processing_charge->checkout->issue_id : undef,
}
);