Lines 30-35
use C4::Circulation qw( AddIssue );
Link Here
|
30 |
use Koha::CirculationRules; |
30 |
use Koha::CirculationRules; |
31 |
use Koha::Database; |
31 |
use Koha::Database; |
32 |
use Koha::DateUtils; |
32 |
use Koha::DateUtils; |
|
|
33 |
use Koha::Holds; |
33 |
|
34 |
|
34 |
BEGIN { |
35 |
BEGIN { |
35 |
use_ok('C4::SIP::ILS'); |
36 |
use_ok('C4::SIP::ILS'); |
Lines 177-182
subtest cancel_hold => sub {
Link Here
|
177 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
178 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
178 |
}; |
179 |
}; |
179 |
|
180 |
|
|
|
181 |
subtest cancel_waiting_hold => sub { |
182 |
plan tests => 7; |
183 |
|
184 |
my $library = $builder->build_object ({ class => 'Koha::Libraries' }); |
185 |
my $patron = $builder->build_object( |
186 |
{ |
187 |
class => 'Koha::Patrons', |
188 |
value => { |
189 |
branchcode => $library->branchcode, |
190 |
} |
191 |
} |
192 |
); |
193 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, flags => 1 }); |
194 |
|
195 |
my $item = $builder->build_sample_item({ |
196 |
library => $library->branchcode, |
197 |
}); |
198 |
|
199 |
Koha::CirculationRules->set_rules( |
200 |
{ |
201 |
categorycode => $patron->categorycode, |
202 |
branchcode => $library->branchcode, |
203 |
itemtype => $item->effective_itemtype, |
204 |
rules => { |
205 |
onshelfholds => 1, |
206 |
reservesallowed => 3, |
207 |
holds_per_record => 3, |
208 |
issuelength => 5, |
209 |
lengthunit => 'days', |
210 |
} |
211 |
} |
212 |
); |
213 |
|
214 |
my $reserve_id = AddReserve( |
215 |
{ |
216 |
branchcode => $library->branchcode, |
217 |
borrowernumber => $patron->borrowernumber, |
218 |
biblionumber => $item->biblio->biblionumber, |
219 |
itemnumber => $item->itemnumber, |
220 |
} |
221 |
); |
222 |
is( $item->biblio->holds->count(), 1, "Hold was placed on bib"); |
223 |
is( $item->holds->count(),1,"Hold was placed on specific item"); |
224 |
|
225 |
my $hold = Koha::Holds->find( $reserve_id ); |
226 |
ok( $hold, 'Get hold object' ); |
227 |
$hold->update({ found => 'W' }); |
228 |
$hold->get_from_storage; |
229 |
|
230 |
is( $hold->found, 'W', "Hold was correctly set to waiting." ); |
231 |
|
232 |
my $ils = C4::SIP::ILS->new({ id => $library->branchcode }); |
233 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
234 |
my $transaction = $ils->cancel_hold($patron->cardnumber,undef,$item->barcode,undef); |
235 |
|
236 |
is( $transaction->{screen_msg},"Hold Cancelled.","We get a success message when hold cancelled"); |
237 |
|
238 |
is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining"); |
239 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
240 |
}; |
241 |
|
180 |
subtest checkout => sub { |
242 |
subtest checkout => sub { |
181 |
plan tests => 4; |
243 |
plan tests => 4; |
182 |
|
244 |
|
183 |
- |
|
|