https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37016
Bug ID: 37016
Summary: SIP2 renew shows old/wrong date due
Change sponsored?: ---
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: SIP2
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
This was reported by a library running 23.11.03.
Sometimes when patrons do renewals via SIP2, the old due date is reported as
the new due date. But everything else looks OK, including the staff view and
"my profile", which shows the right due date.
It looks like this only happens some of the time, or for some patrons, but I
have not been able to figure out what the difference is there. I do think I
have spotted the problem, though.
C4::Circulation::AddIssue() has this code:
1552 my $issue;
...
1571 # find which item we issue
1572 my $item_object = Koha::Items->find({ barcode => $barcode })
1573 or return; # if we don't get an Item, abort.
1574 my $item_unblessed = $item_object->unblessed;
1575
1576 my $branchcode = _GetCircControlBranch( $item_object, $patron );
1577
1578 # get actual issuing if there is one
1579 my $actualissue = $item_object->checkout;
1580
1581 # check if we just renew the issue.
1582 if ( $actualissue and $actualissue->borrowernumber eq
$patron->borrowernumber
1583 and not $switch_onsite_checkout ) {
1584 $datedue = AddRenewal(
1585 {
1586 borrowernumber => $patron->borrowernumber,
1587 itemnumber => $item_object->itemnumber,
1588 branch => $branchcode,
1589 datedue => $datedue,
1590 lastreneweddate =>
1591 $issuedate, # here interpreted as the renewal
date
1592 }
1593 );
1594 $issue = $item_object->checkout;
1595 }
We get the $item_object on line 1572. Then we get the active
issue/loan/checkout from the $item_object on line 1579. Renewal is done on line
1584 (and testing shows $datedue has the right date due there). But then we
update $issue with the active issue/loan/checkout from the same $item_object as
earlier, which has not been updated, and contains stale data, including the
original date due.
I was able to quickfix this by replacing line 1594 with this:
my $updated_item_object = my $item_object = Koha::Items->find({
barcode => $barcode });
$issue = $updated_item_object->checkout;
But I am far from confident that this is a good fix, so opinions are welcome!
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/