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

(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 434-440 sub MapItemsToHoldRequests { Link Here
434
                }
434
                }
435
            }
435
            }
436
            $holdingbranch = $pickup_branch;
436
            $holdingbranch = $pickup_branch;
437
            $itemnumber ||= $holding_branch_items->[0]->{itemnumber};
438
        }
437
        }
439
        elsif ($transport_cost_matrix) {
438
        elsif ($transport_cost_matrix) {
440
            $pull_branches = [keys %items_by_branch];
439
            $pull_branches = [keys %items_by_branch];
Lines 469-474 sub MapItemsToHoldRequests { Link Here
469
                $holdingbranch ||= $branch;
468
                $holdingbranch ||= $branch;
470
                foreach my $item (@$holding_branch_items) {
469
                foreach my $item (@$holding_branch_items) {
471
                    next if $pickup_branch ne $item->{homebranch};
470
                    next if $pickup_branch ne $item->{homebranch};
471
                    next if ( $item->{holdallowed} == 1 && $item->{homebranch} ne $request->{borrowerbranch} );
472
472
473
                    $itemnumber = $item->{itemnumber};
473
                    $itemnumber = $item->{itemnumber};
474
                    $holdingbranch = $branch;
474
                    $holdingbranch = $branch;
Lines 478-484 sub MapItemsToHoldRequests { Link Here
478
478
479
            unless ( $itemnumber ) {
479
            unless ( $itemnumber ) {
480
                foreach my $current_item ( @{ $items_by_branch{$holdingbranch} } ) {
480
                foreach my $current_item ( @{ $items_by_branch{$holdingbranch} } ) {
481
                    if ( $holdingbranch && ( $current_item->{holdallowed} == 2 || $pickup_branch eq $current_item->{homebranch} ) ) {
481
                    if ( $holdingbranch && ( $current_item->{holdallowed} == 2 || $request->{borrowerbranch} eq $current_item->{homebranch} ) ) {
482
                        $itemnumber = $current_item->{itemnumber};
482
                        $itemnumber = $current_item->{itemnumber};
483
                        last; # quit this loop as soon as we have a suitable item
483
                        last; # quit this loop as soon as we have a suitable item
484
                    }
484
                    }
(-)a/t/db_dependent/HoldsQueue.t (-3 / +3 lines)
Lines 287-294 $dbh->do("DELETE FROM default_circ_rules"); Link Here
287
$dbh->do("INSERT INTO default_circ_rules ( holdallowed ) VALUES ( 1 )");
287
$dbh->do("INSERT INTO default_circ_rules ( holdallowed ) VALUES ( 1 )");
288
C4::HoldsQueue::CreateQueue();
288
C4::HoldsQueue::CreateQueue();
289
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
289
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
290
ok( @$holds_queue == 1, "Holds queue filling correct number for default holds policy 'from home library'" );
290
ok( @$holds_queue == 2, "Holds queue filling correct number for default holds policy 'from home library'" );
291
ok( $holds_queue->[0]->{cardnumber} eq 'CARDNUMBER1', "Holds queue filling correct hold for default holds policy 'from home library'");
291
ok( $holds_queue->[0]->{cardnumber} eq 'CARDNUMBER1', "Holds queue filling 1st correct hold for default holds policy 'from home library'");
292
ok( $holds_queue->[1]->{cardnumber} eq 'CARDNUMBER2', "Holds queue filling 2nd correct hold for default holds policy 'from home library'");
292
293
293
$dbh->do("DELETE FROM default_circ_rules");
294
$dbh->do("DELETE FROM default_circ_rules");
294
$dbh->do("INSERT INTO default_circ_rules ( holdallowed ) VALUES ( 2 )");
295
$dbh->do("INSERT INTO default_circ_rules ( holdallowed ) VALUES ( 2 )");
295
- 

Return to bug 11258