Bug 24413: Apply AutoRemoveOverduesRestrictions for lost items
It's quite hard to know where this need to be fixed.
it can be either MarkIssueReturned or LostItem, depending on the
different cases we want to handle.
This patch picked MarkIssueReturned, but maybe the similar code in
AddReturn needs to be removed then.
== Test plan ==
1. Set MarkLostItemsAsReturned to 'from items tab of the catalog module'
2. Set AutoRemoveOverduesRestrictions to 'Do'
3. Set up an overdues restriction in the notice triggers
4. Check out an item and let the overdues process restrict the account
5. Navigate to the moredetail.pl page (items tab) for the overdue item
6. Mark the item lost
7. Return to the account in question - notice the item has been returned, but the restriction remains
8. Clean state: remove restriction + remove item lost status
9. Apply patch
10. Redo the test but this time in addition to the item being returned,
the restriction will be lifted.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 70ae2eaf9c)
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
(cherry picked from commit 28664aea0a)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
parent
df8e0a1205
commit
e2e43182ca
|
|
@ -2176,6 +2176,8 @@ sub MarkIssueReturned {
|
|||
# FIXME Improve the return value and handle it from callers
|
||||
$schema->txn_do(sub {
|
||||
|
||||
my $patron = Koha::Patrons->find( $borrowernumber );
|
||||
|
||||
# Update the returndate value
|
||||
if ( $returndate ) {
|
||||
$issue->returndate( $returndate )->store->discard_changes; # update and refetch
|
||||
|
|
@ -2199,9 +2201,18 @@ sub MarkIssueReturned {
|
|||
|
||||
if ( C4::Context->preference('StoreLastBorrower') ) {
|
||||
my $item = Koha::Items->find( $itemnumber );
|
||||
my $patron = Koha::Patrons->find( $borrowernumber );
|
||||
$item->last_returned_by( $patron );
|
||||
}
|
||||
|
||||
# Remove any OVERDUES related debarment if the borrower has no overdues
|
||||
if ( C4::Context->preference('AutoRemoveOverduesRestrictions')
|
||||
&& $patron->debarred
|
||||
&& !$patron->has_overdues
|
||||
&& @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
|
||||
) {
|
||||
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return $issue_id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue