View | Details | Raw Unified | Return to bug 11126
Collapse All | Expand All

(-)a/C4/Reserves.pm (-4 / +1 lines)
Lines 976-988 sub CheckReserves { Link Here
976
            if ( $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
976
            if ( $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
977
                return ( "Waiting", $res, \@reserves ); # Found it
977
                return ( "Waiting", $res, \@reserves ); # Found it
978
            } else {
978
            } else {
979
                # Lazy fetch for borrower and item. We only need to know about the patron and item
980
                # each and every time if we are using LocalHoldsPriority. This is a great place to
981
                # leverage the inherent lazy fetching of DBIx::Class.
982
                my $borrowerinfo;
979
                my $borrowerinfo;
983
                my $iteminfo;
980
                my $iteminfo;
984
985
                my $local_hold_match;
981
                my $local_hold_match;
982
986
                if ($LocalHoldsPriority) {
983
                if ($LocalHoldsPriority) {
987
                    $borrowerinfo = C4::Members::GetMember( borrowernumber => $res->{'borrowernumber'} );
984
                    $borrowerinfo = C4::Members::GetMember( borrowernumber => $res->{'borrowernumber'} );
988
                    $iteminfo = C4::Items::GetItem($itemnumber);
985
                    $iteminfo = C4::Items::GetItem($itemnumber);
(-)a/t/db_dependent/Holds/LocalHoldsPriority.t (-4 / +2 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use strict;
3
use Modern::Perl;
4
use warnings;
5
4
6
use t::lib::Mocks;
5
use t::lib::Mocks;
7
use C4::Context;
6
use C4::Context;
Lines 83-89 my ($status, $reserve, $all_reserves); Link Here
83
82
84
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 0 );
83
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 0 );
85
($status, $reserve, $all_reserves) = CheckReserves($itemnumber);
84
($status, $reserve, $all_reserves) = CheckReserves($itemnumber);
86
ok( $reserve->{borrowernumber} eq $borrowernumbers[0], "Recieved expected results with LocalHoldsPriority disabled" );
85
ok( $reserve->{borrowernumber} eq $borrowernumbers[0], "Received expected results with LocalHoldsPriority disabled" );
87
86
88
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
87
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
89
88
90
- 

Return to bug 11126