From b7c0e28bb635b2f653fd5876d714c663e26fa897 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Fri, 15 May 2026 14:38:16 +0300 Subject: [PATCH] Bug 36762: Fix setting transfer for hold via branchtransfers.pl When one tries to transfer an item that could fill a pending hold to a library that is not the holds pickup library, Koha gives only a option to transfer item to pickup library. When this option is chosen, Koha tells that item is being transfered to selected library not to pickup library but fails to create the transfer. This patch fixes this by setting op variable as "cud-transfer" and tobranchcd as holds pickup library so that transfer is actually made and target library is displaued correctly. To test: 1. Log into Library A. 2. Find or create a biblio with 1 holdable item at Library A. 3. Place a hold for pickup at Library B. 4. Navigate to Circulation > Transfers. 5. Attempt to send your item to Library C. 6. Koha gives you three options. Pick the first one: "Transfer to Library B." 7. Koha tells you it has transferred the item to Library C. 8. Go to detail.pl for your title, confirm the holdings table says "there is an item level hold" on your item. 9. Click to the Holds tab for your title, confirm the hold claims to be in transit. 10. Query the branchtransfers table SELECT * FROM branchtransfers WHERE itemnumber = [your item] => Note that no new transfer was made. 11. Query reserves SELECT * FROM reserves WHERE biblionumber = [your biblio] => Confirm your hold has found=T, itemnumber=[your item], and item_level_hold=0 12. Revert trasfer from biblios holds page. 13. Apply this patch. 14. Attempt the transfer again. => Koha should now tell that transfer was made to Libary B. 15. Check branchtransfers table again. => New transfer should have been made to Library B. Sponsored-by: Koha-Suomi Oy Signed-off-by: David Nind Signed-off-by: Andrew Fuerste Henry Signed-off-by: Lucas Gass --- circ/branchtransfers.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 9799b3c64a..a0c02f7da1 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -21,11 +21,11 @@ # along with Koha; if not, see . use Modern::Perl; -use CGI qw ( -utf8 ); +use CGI qw ( -utf8 ); use C4::Circulation qw( transferbook barcodedecode ); -use C4::Output qw( output_html_with_http_headers ); -use C4::Reserves qw( ModReserve ModReserveAffect ); -use C4::Auth qw( get_session get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); +use C4::Reserves qw( ModReserve ModReserveAffect ); +use C4::Auth qw( get_session get_template_and_user ); use C4::Members; use Koha::BiblioFrameworks; use Koha::AuthorisedValues; @@ -102,10 +102,13 @@ if ( $op eq "cud-KillWaiting" ) { my $item = $query->param('itemnumber'); my $reserve_id = $query->param('reserve_id'); ModReserveAffect( $item, $borrowernumber, 1, $reserve_id ); + my $hold = Koha::Holds->find( { reserve_id => $reserve_id } ); $ignoreRs = 1; $settransit = 1; $reqmessage = 1; $trigger = 'Reserve'; + $op = 'cud-transfer'; + $tobranchcd = $hold->branchcode; } elsif ( $op eq 'cud-KillReserved' ) { my $biblionumber = $query->param('biblionumber'); my $reserve_id = $query->param('reserve_id');