Lines 163-175
$dbh->do("DELETE FROM items WHERE holdingbranch = '$borrower_branchcode'");
Link Here
|
163 |
# Frst branch from StaticHoldsQueueWeight |
163 |
# Frst branch from StaticHoldsQueueWeight |
164 |
test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]); |
164 |
test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]); |
165 |
test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code); |
165 |
test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code); |
166 |
my $queue = C4::HoldsQueue::GetHoldsQueueItems({ branchlmit => $least_cost_branch_code}) || []; |
166 |
my $queue = C4::HoldsQueue::GetHoldsQueueItems({ branchlimit => $least_cost_branch_code}) || []; |
167 |
my $queue_item = $queue->[0]; |
167 |
my $queue_item = $queue->next; |
168 |
ok( $queue_item |
168 |
ok( $queue_item |
169 |
&& $queue_item->{pickbranch} eq $borrower_branchcode |
169 |
&& $queue_item->pickbranch eq $borrower_branchcode |
170 |
&& $queue_item->{holdingbranch} eq $least_cost_branch_code, "GetHoldsQueueItems" ) |
170 |
&& $queue_item->item->holdingbranch eq $least_cost_branch_code, "GetHoldsQueueItems" ) |
171 |
or diag( "Expected item for pick $borrower_branchcode, hold $least_cost_branch_code, got ".Dumper($queue_item) ); |
171 |
or diag( "Expected item for pick $borrower_branchcode, hold $least_cost_branch_code, got ".Dumper($queue_item->unblessed) ); |
172 |
ok( exists($queue_item->{itype}), 'item type included in queued items list (bug 5825)' ); |
172 |
ok( $queue_item->item->effective_itemtype, 'item type included in queued items list (bug 5825)' ); |
173 |
|
173 |
|
174 |
ok( |
174 |
ok( |
175 |
C4::HoldsQueue::least_cost_branch( 'B', [ 'A', 'B', 'C' ] ) eq 'B', |
175 |
C4::HoldsQueue::least_cost_branch( 'B', [ 'A', 'B', 'C' ] ) eq 'B', |
Lines 1944-1968
subtest "GetHoldsQueueItems" => sub {
Link Here
|
1944 |
" ); |
1944 |
" ); |
1945 |
|
1945 |
|
1946 |
my $queue_items = GetHoldsQueueItems(); |
1946 |
my $queue_items = GetHoldsQueueItems(); |
1947 |
is( scalar @$queue_items, $count + 3, 'Three items added to queue' ); |
1947 |
is( $queue_items->count, $count + 3, 'Three items added to queue' ); |
1948 |
|
1948 |
|
1949 |
$queue_items = GetHoldsQueueItems( { itemtypeslimit => $item_1->itype } ); |
1949 |
$queue_items = GetHoldsQueueItems( { itemtypeslimit => $item_1->itype } ); |
1950 |
is( scalar @$queue_items, |
1950 |
is( $queue_items->count, |
1951 |
3, 'Three items of same itemtype found when itemtypeslimit passed' ); |
1951 |
3, 'Three items of same itemtype found when itemtypeslimit passed' ); |
1952 |
|
1952 |
|
1953 |
$queue_items = GetHoldsQueueItems( |
1953 |
$queue_items = GetHoldsQueueItems( |
1954 |
{ itemtypeslimit => $item_1->itype, ccodeslimit => $item_2->ccode } ); |
1954 |
{ itemtypeslimit => $item_1->itype, ccodeslimit => $item_2->ccode } ); |
1955 |
is( scalar @$queue_items, |
1955 |
is( $queue_items->count, |
1956 |
2, 'Two items of same collection found when ccodeslimit passed' ); |
1956 |
2, 'Two items of same collection found when ccodeslimit passed' ); |
1957 |
|
1957 |
|
1958 |
@$queue_items = GetHoldsQueueItems( |
1958 |
$queue_items = GetHoldsQueueItems( |
1959 |
{ |
1959 |
{ |
1960 |
itemtypeslimit => $item_1->itype, |
1960 |
itemtypeslimit => $item_1->itype, |
1961 |
ccodeslimit => $item_2->ccode, |
1961 |
ccodeslimit => $item_2->ccode, |
1962 |
locationslimit => $item_3->location |
1962 |
locationslimit => $item_3->location |
1963 |
} |
1963 |
} |
1964 |
); |
1964 |
); |
1965 |
is( scalar @$queue_items, |
1965 |
is( scalar $queue_items->count, |
1966 |
1, 'One item of shleving location found when locationslimit passed' ); |
1966 |
1, 'One item of shleving location found when locationslimit passed' ); |
1967 |
|
1967 |
|
1968 |
$schema->storage->txn_rollback; |
1968 |
$schema->storage->txn_rollback; |
1969 |
- |
|
|