|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 77; |
20 |
use Test::More tests => 73; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Warn; |
22 |
use Test::Warn; |
| 23 |
|
23 |
|
|
Lines 44-49
use Koha::Notice::Templates;
Link Here
|
| 44 |
use Koha::Patrons; |
44 |
use Koha::Patrons; |
| 45 |
use Koha::Patron::Categories; |
45 |
use Koha::Patron::Categories; |
| 46 |
use Koha::CirculationRules; |
46 |
use Koha::CirculationRules; |
|
|
47 |
use Koha::Policy::Patrons::Holds; |
| 47 |
|
48 |
|
| 48 |
BEGIN { |
49 |
BEGIN { |
| 49 |
require_ok('C4::Reserves'); |
50 |
require_ok('C4::Reserves'); |
|
Lines 137-160
$requesters{$branch_1} = Koha::Patron->new({
Link Here
|
| 137 |
branchcode => $branch_1, |
138 |
branchcode => $branch_1, |
| 138 |
categorycode => $category_2, |
139 |
categorycode => $category_2, |
| 139 |
surname => "borrower from $branch_1", |
140 |
surname => "borrower from $branch_1", |
| 140 |
})->store->borrowernumber; |
141 |
})->store; |
| 141 |
for my $i ( 2 .. 5 ) { |
142 |
for my $i ( 2 .. 5 ) { |
| 142 |
$requesters{"CPL$i"} = Koha::Patron->new({ |
143 |
$requesters{"CPL$i"} = Koha::Patron->new({ |
| 143 |
branchcode => $branch_1, |
144 |
branchcode => $branch_1, |
| 144 |
categorycode => $category_2, |
145 |
categorycode => $category_2, |
| 145 |
surname => "borrower $i from $branch_1", |
146 |
surname => "borrower $i from $branch_1", |
| 146 |
})->store->borrowernumber; |
147 |
})->store; |
| 147 |
} |
148 |
} |
| 148 |
$requesters{$branch_2} = Koha::Patron->new({ |
149 |
$requesters{$branch_2} = Koha::Patron->new({ |
| 149 |
branchcode => $branch_2, |
150 |
branchcode => $branch_2, |
| 150 |
categorycode => $category_2, |
151 |
categorycode => $category_2, |
| 151 |
surname => "borrower from $branch_2", |
152 |
surname => "borrower from $branch_2", |
| 152 |
})->store->borrowernumber; |
153 |
})->store; |
| 153 |
$requesters{$branch_3} = Koha::Patron->new({ |
154 |
$requesters{$branch_3} = Koha::Patron->new({ |
| 154 |
branchcode => $branch_3, |
155 |
branchcode => $branch_3, |
| 155 |
categorycode => $category_2, |
156 |
categorycode => $category_2, |
| 156 |
surname => "borrower from $branch_3", |
157 |
surname => "borrower from $branch_3", |
| 157 |
})->store->borrowernumber; |
158 |
})->store; |
| 158 |
|
159 |
|
| 159 |
# Configure rules so that $branch_1 allows only $branch_1 patrons |
160 |
# Configure rules so that $branch_1 allows only $branch_1 patrons |
| 160 |
# to request its items, while $branch_2 will allow its items |
161 |
# to request its items, while $branch_2 will allow its items |
|
Lines 223-229
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
Link Here
|
| 223 |
AddReserve( |
224 |
AddReserve( |
| 224 |
{ |
225 |
{ |
| 225 |
branchcode => $branch_3, |
226 |
branchcode => $branch_3, |
| 226 |
borrowernumber => $requesters{$branch_3}, |
227 |
borrowernumber => $requesters{$branch_3}->borrowernumber, |
| 227 |
biblionumber => $bibnum2, |
228 |
biblionumber => $bibnum2, |
| 228 |
priority => 1, |
229 |
priority => 1, |
| 229 |
} |
230 |
} |
|
Lines 231-237
AddReserve(
Link Here
|
| 231 |
AddReserve( |
232 |
AddReserve( |
| 232 |
{ |
233 |
{ |
| 233 |
branchcode => $branch_2, |
234 |
branchcode => $branch_2, |
| 234 |
borrowernumber => $requesters{$branch_2}, |
235 |
borrowernumber => $requesters{$branch_2}->borrowernumber, |
| 235 |
biblionumber => $bibnum2, |
236 |
biblionumber => $bibnum2, |
| 236 |
priority => 2, |
237 |
priority => 2, |
| 237 |
} |
238 |
} |
|
Lines 239-250
AddReserve(
Link Here
|
| 239 |
AddReserve( |
240 |
AddReserve( |
| 240 |
{ |
241 |
{ |
| 241 |
branchcode => $branch_1, |
242 |
branchcode => $branch_1, |
| 242 |
borrowernumber => $requesters{$branch_1}, |
243 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 243 |
biblionumber => $bibnum2, |
244 |
biblionumber => $bibnum2, |
| 244 |
priority => 3, |
245 |
priority => 3, |
| 245 |
} |
246 |
} |
| 246 |
); |
247 |
); |
| 247 |
ModReserveAffect($itemnum_cpl, $requesters{$branch_3}, 0); |
248 |
ModReserveAffect($itemnum_cpl, $requesters{$branch_3}->borrowernumber, 0); |
| 248 |
|
249 |
|
| 249 |
# Now it should have different priorities. |
250 |
# Now it should have different priorities. |
| 250 |
my $biblio = Koha::Biblios->find( $bibnum2 ); |
251 |
my $biblio = Koha::Biblios->find( $bibnum2 ); |
|
Lines 253-268
is($holds->next->priority, 0, 'Item is correctly waiting');
Link Here
|
| 253 |
is($holds->next->priority, 1, 'Item is correctly priority 1'); |
254 |
is($holds->next->priority, 1, 'Item is correctly priority 1'); |
| 254 |
is($holds->next->priority, 2, 'Item is correctly priority 2'); |
255 |
is($holds->next->priority, 2, 'Item is correctly priority 2'); |
| 255 |
|
256 |
|
| 256 |
my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting->as_list; |
257 |
my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3}->borrowernumber })->waiting->as_list; |
| 257 |
is( @reserves, 1, 'GetWaiting got only the waiting reserve' ); |
258 |
is( @reserves, 1, 'GetWaiting got only the waiting reserve' ); |
| 258 |
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' ); |
259 |
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}->borrowernumber, 'GetWaiting got the reserve for the correct borrower' ); |
| 259 |
|
260 |
|
| 260 |
|
261 |
|
| 261 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
262 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
| 262 |
AddReserve( |
263 |
AddReserve( |
| 263 |
{ |
264 |
{ |
| 264 |
branchcode => $branch_3, |
265 |
branchcode => $branch_3, |
| 265 |
borrowernumber => $requesters{$branch_3}, |
266 |
borrowernumber => $requesters{$branch_3}->borrowernumber, |
| 266 |
biblionumber => $bibnum2, |
267 |
biblionumber => $bibnum2, |
| 267 |
priority => 1, |
268 |
priority => 1, |
| 268 |
} |
269 |
} |
|
Lines 270-276
AddReserve(
Link Here
|
| 270 |
AddReserve( |
271 |
AddReserve( |
| 271 |
{ |
272 |
{ |
| 272 |
branchcode => $branch_2, |
273 |
branchcode => $branch_2, |
| 273 |
borrowernumber => $requesters{$branch_2}, |
274 |
borrowernumber => $requesters{$branch_2}->borrowernumber, |
| 274 |
biblionumber => $bibnum2, |
275 |
biblionumber => $bibnum2, |
| 275 |
priority => 2, |
276 |
priority => 2, |
| 276 |
} |
277 |
} |
|
Lines 279-285
AddReserve(
Link Here
|
| 279 |
AddReserve( |
280 |
AddReserve( |
| 280 |
{ |
281 |
{ |
| 281 |
branchcode => $branch_1, |
282 |
branchcode => $branch_1, |
| 282 |
borrowernumber => $requesters{$branch_1}, |
283 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 283 |
biblionumber => $bibnum2, |
284 |
biblionumber => $bibnum2, |
| 284 |
priority => 3, |
285 |
priority => 3, |
| 285 |
} |
286 |
} |
|
Lines 294-300
my $messages;
Link Here
|
| 294 |
# requests cannot be filled by that item per policy. |
295 |
# requests cannot be filled by that item per policy. |
| 295 |
(undef, $messages, undef, undef) = AddReturn('bug10272_CPL', $branch_2); |
296 |
(undef, $messages, undef, undef) = AddReturn('bug10272_CPL', $branch_2); |
| 296 |
is( $messages->{ResFound}->{borrowernumber}, |
297 |
is( $messages->{ResFound}->{borrowernumber}, |
| 297 |
$requesters{$branch_1}, |
298 |
$requesters{$branch_1}->borrowernumber, |
| 298 |
'restrictive library\'s items only fill requests by own patrons (bug 10272)'); |
299 |
'restrictive library\'s items only fill requests by own patrons (bug 10272)'); |
| 299 |
|
300 |
|
| 300 |
# Return the FPL item at FPL. The hold that should be triggered is |
301 |
# Return the FPL item at FPL. The hold that should be triggered is |
|
Lines 306-312
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', '' );
Link Here
|
| 306 |
|
307 |
|
| 307 |
(undef, $messages, undef, undef) = AddReturn('bug10272_FPL', $branch_2); |
308 |
(undef, $messages, undef, undef) = AddReturn('bug10272_FPL', $branch_2); |
| 308 |
is( $messages->{ResFound}->{borrowernumber}, |
309 |
is( $messages->{ResFound}->{borrowernumber}, |
| 309 |
$requesters{$branch_3}, |
310 |
$requesters{$branch_3}->borrowernumber, |
| 310 |
'for generous library, its items fill first hold request in line (bug 10272)'); |
311 |
'for generous library, its items fill first hold request in line (bug 10272)'); |
| 311 |
|
312 |
|
| 312 |
$biblio = Koha::Biblios->find( $biblionumber ); |
313 |
$biblio = Koha::Biblios->find( $biblionumber ); |
|
Lines 321-327
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
Link Here
|
| 321 |
AddReserve( |
322 |
AddReserve( |
| 322 |
{ |
323 |
{ |
| 323 |
branchcode => $branch_1, |
324 |
branchcode => $branch_1, |
| 324 |
borrowernumber => $requesters{$branch_1}, |
325 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 325 |
biblionumber => $bibnum, |
326 |
biblionumber => $bibnum, |
| 326 |
priority => 1, |
327 |
priority => 1, |
| 327 |
} |
328 |
} |
|
Lines 339-345
$resdate->add_duration(DateTime::Duration->new(days => 4));
Link Here
|
| 339 |
my $reserve_id = AddReserve( |
340 |
my $reserve_id = AddReserve( |
| 340 |
{ |
341 |
{ |
| 341 |
branchcode => $branch_1, |
342 |
branchcode => $branch_1, |
| 342 |
borrowernumber => $requesters{$branch_1}, |
343 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 343 |
biblionumber => $bibnum, |
344 |
biblionumber => $bibnum, |
| 344 |
priority => 1, |
345 |
priority => 1, |
| 345 |
reservation_date => $resdate, |
346 |
reservation_date => $resdate, |
|
Lines 373-379
my $now_holder = $builder->build_object({ class => 'Koha::Patrons', value => {
Link Here
|
| 373 |
my $now_reserve_id = AddReserve( |
374 |
my $now_reserve_id = AddReserve( |
| 374 |
{ |
375 |
{ |
| 375 |
branchcode => $branch_1, |
376 |
branchcode => $branch_1, |
| 376 |
borrowernumber => $requesters{$branch_1}, |
377 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 377 |
biblionumber => $bibnum, |
378 |
biblionumber => $bibnum, |
| 378 |
priority => 2, |
379 |
priority => 2, |
| 379 |
reservation_date => dt_from_string(), |
380 |
reservation_date => dt_from_string(), |
|
Lines 392-403
ModReserve({ reserve_id => $now_reserve_id, rank => 'del', cancellation_reason =
Link Here
|
| 392 |
|
393 |
|
| 393 |
# test marking a hold as captured |
394 |
# test marking a hold as captured |
| 394 |
my $hold_notice_count = count_hold_print_messages(); |
395 |
my $hold_notice_count = count_hold_print_messages(); |
| 395 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
396 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}->borrowernumber, 0); |
| 396 |
my $new_count = count_hold_print_messages(); |
397 |
my $new_count = count_hold_print_messages(); |
| 397 |
is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting'); |
398 |
is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting'); |
| 398 |
|
399 |
|
| 399 |
# test that duplicate notices aren't generated |
400 |
# test that duplicate notices aren't generated |
| 400 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
401 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}->borrowernumber, 0); |
| 401 |
$new_count = count_hold_print_messages(); |
402 |
$new_count = count_hold_print_messages(); |
| 402 |
is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)'); |
403 |
is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)'); |
| 403 |
|
404 |
|
|
Lines 423-429
$resdate->add_duration(DateTime::Duration->new(days => 2));
Link Here
|
| 423 |
AddReserve( |
424 |
AddReserve( |
| 424 |
{ |
425 |
{ |
| 425 |
branchcode => $branch_1, |
426 |
branchcode => $branch_1, |
| 426 |
borrowernumber => $requesters{$branch_1}, |
427 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 427 |
biblionumber => $bibnum, |
428 |
biblionumber => $bibnum, |
| 428 |
priority => 1, |
429 |
priority => 1, |
| 429 |
reservation_date => $resdate, |
430 |
reservation_date => $resdate, |
|
Lines 439-445
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
Link Here
|
| 439 |
AddReserve( |
440 |
AddReserve( |
| 440 |
{ |
441 |
{ |
| 441 |
branchcode => $branch_1, |
442 |
branchcode => $branch_1, |
| 442 |
borrowernumber => $requesters{$branch_1}, |
443 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 443 |
biblionumber => $bibnum, |
444 |
biblionumber => $bibnum, |
| 444 |
priority => 1, |
445 |
priority => 1, |
| 445 |
reservation_date => $resdate, |
446 |
reservation_date => $resdate, |
|
Lines 449-455
AddReserve(
Link Here
|
| 449 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
450 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
| 450 |
is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); |
451 |
is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); |
| 451 |
# 9788c: current_holds returns future wait (confirmed future hold) |
452 |
# 9788c: current_holds returns future wait (confirmed future hold) |
| 452 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1} , 0); #confirm hold |
453 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0); #confirm hold |
| 453 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
454 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
| 454 |
is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
455 |
is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
| 455 |
# End of tests for bug 9788 |
456 |
# End of tests for bug 9788 |
|
Lines 461-467
is($p, 4, 'CalculatePriority should now return priority 4');
Link Here
|
| 461 |
AddReserve( |
462 |
AddReserve( |
| 462 |
{ |
463 |
{ |
| 463 |
branchcode => $branch_1, |
464 |
branchcode => $branch_1, |
| 464 |
borrowernumber => $requesters{'CPL2'}, |
465 |
borrowernumber => $requesters{'CPL2'}->borrowernumber, |
| 465 |
biblionumber => $bibnum2, |
466 |
biblionumber => $bibnum2, |
| 466 |
priority => $p, |
467 |
priority => $p, |
| 467 |
} |
468 |
} |
|
Lines 476-482
is($p, 1, 'CalculatePriority should now return priority 1');
Link Here
|
| 476 |
AddReserve( |
477 |
AddReserve( |
| 477 |
{ |
478 |
{ |
| 478 |
branchcode => $branch_1, |
479 |
branchcode => $branch_1, |
| 479 |
borrowernumber => $requesters{$branch_1}, |
480 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 480 |
biblionumber => $bibnum, |
481 |
biblionumber => $bibnum, |
| 481 |
priority => $p, |
482 |
priority => $p, |
| 482 |
itemnumber => $item->itemnumber, |
483 |
itemnumber => $item->itemnumber, |
|
Lines 484-497
AddReserve(
Link Here
|
| 484 |
); |
485 |
); |
| 485 |
$p = C4::Reserves::CalculatePriority($bibnum); |
486 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 486 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
487 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
| 487 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1} , 0); |
488 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0); |
| 488 |
$p = C4::Reserves::CalculatePriority($bibnum); |
489 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 489 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
490 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
| 490 |
#add another biblio hold, no resdate |
491 |
#add another biblio hold, no resdate |
| 491 |
AddReserve( |
492 |
AddReserve( |
| 492 |
{ |
493 |
{ |
| 493 |
branchcode => $branch_1, |
494 |
branchcode => $branch_1, |
| 494 |
borrowernumber => $requesters{'CPL2'}, |
495 |
borrowernumber => $requesters{'CPL2'}->borrowernumber, |
| 495 |
biblionumber => $bibnum, |
496 |
biblionumber => $bibnum, |
| 496 |
priority => $p, |
497 |
priority => $p, |
| 497 |
} |
498 |
} |
|
Lines 505-511
$resdate->add_duration(DateTime::Duration->new(days => 1));
Link Here
|
| 505 |
AddReserve( |
506 |
AddReserve( |
| 506 |
{ |
507 |
{ |
| 507 |
branchcode => $branch_1, |
508 |
branchcode => $branch_1, |
| 508 |
borrowernumber => $requesters{'CPL2'}, |
509 |
borrowernumber => $requesters{'CPL2'}->borrowernumber, |
| 509 |
biblionumber => $bibnum, |
510 |
biblionumber => $bibnum, |
| 510 |
priority => $p, |
511 |
priority => $p, |
| 511 |
reservation_date => $resdate, |
512 |
reservation_date => $resdate, |
|
Lines 562-615
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
Link Here
|
| 562 |
AddReserve( |
563 |
AddReserve( |
| 563 |
{ |
564 |
{ |
| 564 |
branchcode => $branch_1, |
565 |
branchcode => $branch_1, |
| 565 |
borrowernumber => $requesters{$branch_1}, |
566 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 566 |
biblionumber => $bibnum, |
567 |
biblionumber => $bibnum, |
| 567 |
priority => 1, |
568 |
priority => 1, |
| 568 |
} |
569 |
} |
| 569 |
); |
570 |
); |
| 570 |
my (undef, $canres, undef) = CheckReserves( $item ); |
571 |
my (undef, $canres, undef) = CheckReserves( $item ); |
| 571 |
|
572 |
|
| 572 |
is( CanReserveBeCanceledFromOpac(), undef, |
573 |
my $hold = Koha::Holds->find( $canres->{reserve_id} ); |
| 573 |
'CanReserveBeCanceledFromOpac should return undef if called without any parameter' |
574 |
my $cancancel = Koha::Policy::Patrons::Holds->can_cancel_from_opac( $requesters{$branch_1}, $hold ); |
| 574 |
); |
575 |
ok( $cancancel, 'Can user cancel its own reserve' ); |
| 575 |
is( |
|
|
| 576 |
CanReserveBeCanceledFromOpac( $canres->{resserve_id} ), |
| 577 |
undef, |
| 578 |
'CanReserveBeCanceledFromOpac should return undef if called without the reserve_id' |
| 579 |
); |
| 580 |
is( |
| 581 |
CanReserveBeCanceledFromOpac( undef, $requesters{CPL} ), |
| 582 |
undef, |
| 583 |
'CanReserveBeCanceledFromOpac should return undef if called without borrowernumber' |
| 584 |
); |
| 585 |
|
| 586 |
my $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
| 587 |
is($cancancel, 1, 'Can user cancel its own reserve'); |
| 588 |
|
576 |
|
| 589 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_2}); |
577 |
$cancancel = Koha::Policy::Patrons::Holds->can_cancel_from_opac( $requesters{$branch_2}, $hold ); |
| 590 |
is($cancancel, 0, 'Other user cant cancel reserve'); |
578 |
ok( !$cancancel, 'Other user cant cancel reserve' ); |
| 591 |
|
579 |
|
| 592 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 1); |
580 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 1 ); |
| 593 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
581 |
$cancancel = Koha::Policy::Patrons::Holds->can_cancel_from_opac( $requesters{$branch_1}, $hold->get_from_storage ); |
| 594 |
is($cancancel, 0, 'Reserve in transfer status cant be canceled'); |
582 |
ok( !$cancancel, 'Reserve in transfer status cant be canceled' ); |
| 595 |
|
|
|
| 596 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 597 |
is( CanReserveBeCanceledFromOpac($canres->{resserve_id}, $requesters{$branch_1}), undef, |
| 598 |
'Cannot cancel a deleted hold' ); |
| 599 |
|
583 |
|
| 600 |
AddReserve( |
584 |
AddReserve( |
| 601 |
{ |
585 |
{ |
| 602 |
branchcode => $branch_1, |
586 |
branchcode => $branch_1, |
| 603 |
borrowernumber => $requesters{$branch_1}, |
587 |
borrowernumber => $requesters{$branch_1}->borrowernumber, |
| 604 |
biblionumber => $bibnum, |
588 |
biblionumber => $bibnum, |
| 605 |
priority => 1, |
589 |
priority => 1, |
| 606 |
} |
590 |
} |
| 607 |
); |
591 |
); |
| 608 |
(undef, $canres, undef) = CheckReserves( $item ); |
592 |
(undef, $canres, undef) = CheckReserves( $item ); |
| 609 |
|
593 |
|
| 610 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
594 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); |
| 611 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
595 |
$cancancel = Koha::Policy::Patrons::Holds->can_cancel_from_opac( $requesters{$branch_1}, $hold->get_from_storage ); |
| 612 |
is($cancancel, 0, 'Reserve in waiting status cant be canceled'); |
596 |
ok( !$cancancel, 'Reserve in waiting status cant be canceled' ); |
| 613 |
|
597 |
|
| 614 |
# End of tests for bug 12876 |
598 |
# End of tests for bug 12876 |
| 615 |
|
599 |
|
| 616 |
- |
|
|