Lines 7-13
use C4::Items;
Link Here
|
7 |
use C4::Circulation; |
7 |
use C4::Circulation; |
8 |
use Koha::IssuingRule; |
8 |
use Koha::IssuingRule; |
9 |
|
9 |
|
10 |
use Test::More tests => 4; |
10 |
use Test::More tests => 6; |
11 |
|
11 |
|
12 |
use t::lib::TestBuilder; |
12 |
use t::lib::TestBuilder; |
13 |
|
13 |
|
Lines 114-118
AddIssue( $borrower2, $item2->{barcode} );
Link Here
|
114 |
$is = IsAvailableForItemLevelRequest( $item1, $borrower1); |
114 |
$is = IsAvailableForItemLevelRequest( $item1, $borrower1); |
115 |
is( $is, 1, "Item can be held, no items available" ); |
115 |
is( $is, 1, "Item can be held, no items available" ); |
116 |
|
116 |
|
|
|
117 |
my $biblio = $builder->build({ |
118 |
source => 'Biblio', |
119 |
}); |
120 |
|
121 |
my $item3 = $builder->build({ |
122 |
source => 'Item', |
123 |
value => { |
124 |
biblionumber => $biblio->{biblionumber}, |
125 |
itemlost => 0, |
126 |
notforloan => 0, |
127 |
withdrawn => 0, |
128 |
damaged => 0, |
129 |
onloan => 0 |
130 |
} |
131 |
}); |
132 |
|
133 |
my $hold = $builder->build({ |
134 |
source => 'Reserve', |
135 |
value =>{ |
136 |
itemnumber => $item3->{itemnumber}, |
137 |
found => 'T' |
138 |
} |
139 |
}); |
140 |
|
141 |
$dbh->do("DELETE FROM issuingrules"); |
142 |
$rule = Koha::IssuingRule->new( |
143 |
{ |
144 |
categorycode => '*', |
145 |
itemtype => '*', |
146 |
branchcode => '*', |
147 |
maxissueqty => 99, |
148 |
issuelength => 7, |
149 |
lengthunit => 8, |
150 |
reservesallowed => 99, |
151 |
onshelfholds => 0, |
152 |
} |
153 |
); |
154 |
$rule->store(); |
155 |
|
156 |
$is = IsAvailableForItemLevelRequest( $item3, $borrower1); |
157 |
is( $is, 1, "Item can be held, items in transit are not available" ); |
158 |
|
159 |
Koha::Holds->find($hold->{reserve_id})->found('F')->store; |
160 |
|
161 |
$is = IsAvailableForItemLevelRequest( $item3, $borrower1); |
162 |
is( $is, 0, "Item is neither waiting nor in transit." ); |
163 |
|
117 |
# Cleanup |
164 |
# Cleanup |
118 |
$schema->storage->txn_rollback; |
165 |
$schema->storage->txn_rollback; |
119 |
- |
|
|