From 47e18fba4a656c0f748a24aed35163a1c8885f48 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 Aug 2022 12:31:43 +0200 Subject: [PATCH] Bug 2894: Fix Routing list holds This is a try to fix a very old bug. Not familiar with the workflow so cannot confirm it will fix everything. The idea is to fix the behaviour of RoutingListAddReserves, and create item-level holds (so only if items have been created). --- serials/routing-preview.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl index aa44f7e28b6..f0c55063561 100755 --- a/serials/routing-preview.pl +++ b/serials/routing-preview.pl @@ -66,12 +66,13 @@ if($op eq 'cud-save_and_preview'){ $items->count ? $items->next->holding_branch->branchcode : $subs->{branchcode}; + $library = Koha::Libraries->find($branch); - if (C4::Context->preference('RoutingListAddReserves')){ + if ( C4::Context->preference('RoutingListAddReserves') && $serialitem ) { - my $notes; - my $title = $subs->{'bibliotitle'}; + my $notes; + my $title = $subs->{'bibliotitle'}; for my $routing ( @routinglist ) { my $sth = $dbh->prepare('SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? LIMIT 1'); $sth->execute($biblionumber,$routing->{borrowernumber}); @@ -81,6 +82,7 @@ if($op eq 'cud-save_and_preview'){ ModReserve({ rank => $routing->{ranking}, biblionumber => $biblionumber, + itemnumber => $serialitem->itemnumber, borrowernumber => $routing->{borrowernumber}, branchcode => $branch }); @@ -90,14 +92,15 @@ if($op eq 'cud-save_and_preview'){ branchcode => $branch, borrowernumber => $routing->{borrowernumber}, biblionumber => $biblionumber, + itemnumber => $serialitem->itemnumber, priority => $routing->{ranking}, notes => $notes, title => $title, } ); + } } } - } print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid&print_routing_list_issue=" . $query->param('issue_escaped')); exit; } elsif ( $op eq 'print' ) { -- 2.34.1