From 48787acc6f725686583bb05f45888acf3e1231d0 Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Thu, 1 Nov 2018 20:21:08 +0000 Subject: [PATCH] Bug 21346: Streamline logic in holds and transfers 1) Replaced comparison with string to make testing branch easier. 2) Replaced useless 0 values with undef. Does not change any behavior, only simplifies code. Signed-off-by: Lisette Signed-off-by: Liz Rea Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens --- circ/returns.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 528907a367..6072e728ba 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -417,12 +417,12 @@ if ( $messages->{'ResFound'}) { my $reserve = $messages->{'ResFound'}; my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); my $holdmsgpreferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name => 'Hold_Filled' } ); - + my $branchCheck = ( $userenv_branch eq $reserve->{branchcode} ); if ( $reserve->{'ResFound'} eq "Reserved" && C4::Context->preference('HoldsAutoFill') ) { my $item = Koha::Items->find( $itemnumber ); my $biblio = $item->biblio; - my $diffBranchSend = ($userenv_branch ne $reserve->{branchcode}) ? $reserve->{branchcode} : undef; + my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef; ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id} ); my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber}); @@ -449,12 +449,12 @@ if ( $messages->{'ResFound'}) { elsif ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) { if ( $reserve->{'ResFound'} eq "Waiting" ) { $template->param( - waiting => ($userenv_branch eq $reserve->{'branchcode'} ? 1 : 0 ), + waiting => $branchCheck ? 1 : undef, ); } elsif ( $reserve->{'ResFound'} eq "Reserved" ) { $template->param( - intransit => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), - transfertodo => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), + intransit => $branchCheck ? undef : 1, + transfertodo => $branchCheck ? undef : 1, reserve_id => $reserve->{reserve_id}, reserved => 1, ); -- 2.39.5