Bug 35721: ModItemTransfer -> Koha::Item->request_transfer - returns.pl

This patch replaces the call to ModItemTransfer in circ/returns.pl with
a call to Koha::Item->request_transfer and
Koha::Item::Transfer->transit.

Test plan
1) Set 'AutomaticItemReturn' to "Don't"
2) Check an item in at a location other than it's 'home' or 'holding'
   branch
3) Note you should be asked a about returning the item to another branch
4) Opting to not proceed should NOT result in a row in the
   branchtransfers table
5) Option to proceed (either with a print slip or just 'OK') should
   result in a branchtransfer from the current checkin branch to the
home or holding branch depending on the circulation rules.
5a) The item should be marked as immediately in transit in, i.e. the
   'datesent' set to today.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-01-08 12:55:01 +00:00 committed by Katrin Fischer
parent f8e2048913
commit 0e91b107d3
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,6 @@ use DateTime;
use C4::Auth qw( get_template_and_user get_session haspermission );
use C4::Circulation qw( barcodedecode GetBranchItemRule AddReturn updateWrongTransfer LostItem );
use C4::Context;
use C4::Items qw( ModItemTransfer );
use C4::Members::Messaging;
use C4::Members;
use C4::Output qw( output_html_with_http_headers );
@ -250,12 +249,15 @@ if ($return_date_override) {
}
}
# If 'needstransfer' was set and the librarian has chosen to initiate the transfer
if ( $op eq 'cud-dotransfer'){
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
my $transferitem = $query->param('transferitem');
my $tobranch = $query->param('tobranch');
my $item = Koha::Items->find( $transferitem );
my $tobranchcode = $query->param('tobranch');
my $tobranch = Koha::Libraries->find($tobranchcode);
my $trigger = $query->param('trigger');
ModItemTransfer($transferitem, $userenv_branch, $tobranch, $trigger);
my $transfer = $item->request_transfer({ to => $tobranch, reason => $trigger });
$transfer->transit;
}
if ($transit && $op eq 'cud-transfer') {