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 <lisetteslatah@gmail.com> Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> (cherry picked from commit48787acc6f) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commita1ff52bef4) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
a680472171
commit
6aba59f6a1
|
|
@ -415,15 +415,44 @@ 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' } );
|
||||
if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
|
||||
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 = !$branchCheck ? $reserve->{branchcode} : undef;
|
||||
ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id} );
|
||||
my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber});
|
||||
|
||||
my $patron = Koha::Patrons->find( $nextreservinfo );
|
||||
|
||||
$template->param(
|
||||
hold_auto_filled => 1,
|
||||
print_slip => C4::Context->preference('HoldsAutoFillPrintSlip'),
|
||||
patron => $patron,
|
||||
borrowernumber => $patron->id,
|
||||
biblionumber => $biblio->id,
|
||||
);
|
||||
|
||||
if ( $messages->{'transfert'} ) {
|
||||
$template->param(
|
||||
itemtitle => $biblio->title,
|
||||
itemnumber => $item->itemnumber,
|
||||
itembiblionumber => $biblio->biblionumber,
|
||||
iteminfo => $biblio->author,
|
||||
diffbranch => 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
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,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue