Bug 35950: Move AddReturn call into circulation.pl

There should be no change in beahavior. Following the test plan from Bug 35840.

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
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:
Lucas Gass 2024-02-29 20:48:25 +00:00 committed by Katrin Fischer
parent e0554260c7
commit 834bff6317
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 17 additions and 15 deletions

View File

@ -836,21 +836,8 @@ sub CanBookBeIssued {
}
);
my $block_lost_return = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0;
my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower );
( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) =
AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 )
if $item_object->onloan;
ModDateLastSeen( $item_object->itemnumber, $block_lost_return ); # FIXME Move to Koha::Item
return (
{
STATS => 1,
CHECKEDIN => $stats_return,
MESSAGES => $stats_messages,
ITEM => $stats_iteminformation,
BORROWER => $stats_borrower,
},
{}
);
return ( { STATS => 1, }, {} );
}
if ( $patron->gonenoaddress && $patron->gonenoaddress == 1 ) {

View File

@ -34,7 +34,7 @@ use Try::Tiny;
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
use C4::Auth qw( get_session get_template_and_user );
use C4::Koha;
use C4::Circulation qw( barcodedecode CanBookBeIssued AddIssue );
use C4::Circulation qw( barcodedecode CanBookBeIssued AddIssue AddReturn );
use C4::Members;
use C4::Biblio qw( TransformMarcToKoha );
use C4::Search qw( new_record_from_zebra );
@ -355,6 +355,21 @@ if (@$barcodes && $op eq 'cud-checkout') {
$biblio = $item->biblio;
}
if ( $issuingimpossible->{'STATS'} ) {
$template->param( STATS => 1 );
if ( $item->onloan ) {
my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) =
AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 );
$template->param(
CHECKEDIN => $stats_return,
MESSAGES => $stats_messages,
ITEM => $stats_iteminformation,
BORROWER => $stats_borrower,
);
}
}
# Fix for bug 7494: optional checkout-time fallback search for a book
if ( $issuingimpossible->{'UNKNOWN_BARCODE'}