|
Lines 8-14
Link Here
|
| 8 |
|
8 |
|
| 9 |
use Modern::Perl; |
9 |
use Modern::Perl; |
| 10 |
|
10 |
|
| 11 |
use Test::More tests => 57; |
11 |
use Test::More tests => 58; |
| 12 |
use Data::Dumper; |
12 |
use Data::Dumper; |
| 13 |
|
13 |
|
| 14 |
use C4::Calendar qw( new insert_single_holiday ); |
14 |
use C4::Calendar qw( new insert_single_holiday ); |
|
Lines 163-169
$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($least_cost_branch_code) || []; |
166 |
my $queue = C4::HoldsQueue::GetHoldsQueueItems({ branchlmit => $least_cost_branch_code}) || []; |
| 167 |
my $queue_item = $queue->[0]; |
167 |
my $queue_item = $queue->[0]; |
| 168 |
ok( $queue_item |
168 |
ok( $queue_item |
| 169 |
&& $queue_item->{pickbranch} eq $borrower_branchcode |
169 |
&& $queue_item->{pickbranch} eq $borrower_branchcode |
|
Lines 1737-1739
subtest 'Remove holds on check-in match' => sub {
Link Here
|
| 1737 |
|
1737 |
|
| 1738 |
$schema->storage->txn_rollback; |
1738 |
$schema->storage->txn_rollback; |
| 1739 |
}; |
1739 |
}; |
| 1740 |
- |
1740 |
|
|
|
1741 |
subtest "GetHoldsQueueItems" => sub { |
| 1742 |
plan tests => 4; |
| 1743 |
|
| 1744 |
$schema->storage->txn_begin; |
| 1745 |
|
| 1746 |
my $ccode = $builder->build_object({ |
| 1747 |
class => 'Koha::AuthorisedValues', |
| 1748 |
value => { |
| 1749 |
category => 'CCODE' |
| 1750 |
} |
| 1751 |
}); |
| 1752 |
my $location = $builder->build_object({ |
| 1753 |
class => 'Koha::AuthorisedValues', |
| 1754 |
value => { |
| 1755 |
category => 'LOC' |
| 1756 |
} |
| 1757 |
}); |
| 1758 |
my $item_1 = $builder->build_sample_item(); |
| 1759 |
my $item_2 = $builder->build_sample_item({ |
| 1760 |
itype => $item_1->itype, |
| 1761 |
ccode => $ccode->authorised_value |
| 1762 |
}); |
| 1763 |
my $item_3 = $builder->build_sample_item({ |
| 1764 |
itype => $item_1->itype, |
| 1765 |
ccode => $item_2->ccode, |
| 1766 |
location => $location->authorised_value |
| 1767 |
}); |
| 1768 |
|
| 1769 |
my $itemnumber_1 = $item_1->itemnumber; |
| 1770 |
my $itemnumber_2 = $item_2->itemnumber; |
| 1771 |
my $itemnumber_3 = $item_3->itemnumber; |
| 1772 |
|
| 1773 |
my $biblionumber_1 = $item_1->biblionumber; |
| 1774 |
my $biblionumber_2 = $item_2->biblionumber; |
| 1775 |
my $biblionumber_3 = $item_3->biblionumber; |
| 1776 |
|
| 1777 |
my $sth = $dbh->prepare(q{ SELECT COUNT(*) FROM tmp_holdsqueue }); |
| 1778 |
$sth->execute(); |
| 1779 |
my ($count) = $sth->fetchrow_array; |
| 1780 |
|
| 1781 |
$dbh->do(" |
| 1782 |
INSERT INTO tmp_holdsqueue (itemnumber,biblionumber,surname,firstname,phone,borrowernumber,title,notes) VALUES |
| 1783 |
($itemnumber_1,$biblionumber_1,'','','',22,'',''), |
| 1784 |
($itemnumber_2,$biblionumber_2,'','','',32,'',''), |
| 1785 |
($itemnumber_3,$biblionumber_3,'','','',42,'','') |
| 1786 |
"); |
| 1787 |
|
| 1788 |
my $queue_items = GetHoldsQueueItems(); |
| 1789 |
is( scalar @$queue_items, $count+3,'Three items added to queue'); |
| 1790 |
|
| 1791 |
$queue_items = GetHoldsQueueItems({itemtypeslimit => $item_1->itype}); |
| 1792 |
is( scalar @$queue_items, 3,'Three items of same itemtype found when itemtypeslimit passed'); |
| 1793 |
|
| 1794 |
$queue_items = GetHoldsQueueItems({itemtypeslimit => $item_1->itype, ccodeslimit => $item_2->ccode}); |
| 1795 |
is( scalar @$queue_items, 2,'Two items of same collection found when ccodeslimit passed'); |
| 1796 |
|
| 1797 |
@$queue_items = GetHoldsQueueItems({ |
| 1798 |
itemtypeslimit => $item_1->itype, |
| 1799 |
ccodeslimit => $item_2->ccode, |
| 1800 |
locationslimit => $item_3->location |
| 1801 |
}); |
| 1802 |
is( scalar @$queue_items, 1,'One item of shleving location found when locationslimit passed'); |
| 1803 |
|
| 1804 |
|
| 1805 |
$schema->storage->txn_rollback; |
| 1806 |
}; |