Lines 224-271
ok( $new_count == $original_count + 1, 'ProcessOfflinePayment makes payment cor
Link Here
|
224 |
C4::Context->dbh->do("DELETE FROM accountlines WHERE borrowernumber IN ( SELECT borrowernumber FROM borrowers WHERE cardnumber = '99999999999' )"); |
224 |
C4::Context->dbh->do("DELETE FROM accountlines WHERE borrowernumber IN ( SELECT borrowernumber FROM borrowers WHERE cardnumber = '99999999999' )"); |
225 |
C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); |
225 |
C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); |
226 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
226 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
|
|
227 |
my ( $reused_itemnumber_1, $reused_itemnumber_2 ); |
227 |
{ |
228 |
{ |
228 |
# CanBookBeRenewed tests |
229 |
# CanBookBeRenewed tests |
229 |
C4::Context->set_preference('ItemsDeniedRenewal',''); |
230 |
C4::Context->set_preference('ItemsDeniedRenewal',''); |
230 |
# Generate test biblio |
231 |
# Generate test biblio |
231 |
my $biblio = $builder->build_sample_biblio(); |
232 |
my $biblio = $builder->build_sample_biblio(); |
232 |
|
233 |
|
233 |
my $barcode = 'R00000342'; |
|
|
234 |
my $branch = $library2->{branchcode}; |
234 |
my $branch = $library2->{branchcode}; |
235 |
|
235 |
|
236 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( |
236 |
my $item_1 = $builder->build_sample_item( |
237 |
{ |
237 |
{ |
238 |
homebranch => $branch, |
238 |
biblionumber => $biblio->biblionumber, |
239 |
holdingbranch => $branch, |
239 |
library => $branch, |
240 |
barcode => $barcode, |
|
|
241 |
replacementprice => 12.00, |
240 |
replacementprice => 12.00, |
242 |
itype => $itemtype |
241 |
itype => $itemtype, |
243 |
}, |
242 |
} |
244 |
$biblio->biblionumber |
|
|
245 |
); |
243 |
); |
|
|
244 |
$reused_itemnumber_1 = $item_1->itemnumber; |
246 |
|
245 |
|
247 |
my $barcode2 = 'R00000343'; |
246 |
my $item_2 = $builder->build_sample_item( |
248 |
my ( $item_bibnum2, $item_bibitemnum2, $itemnumber2 ) = AddItem( |
|
|
249 |
{ |
247 |
{ |
250 |
homebranch => $branch, |
248 |
biblionumber => $biblio->biblionumber, |
251 |
holdingbranch => $branch, |
249 |
library => $branch, |
252 |
barcode => $barcode2, |
|
|
253 |
replacementprice => 23.00, |
250 |
replacementprice => 23.00, |
254 |
itype => $itemtype |
251 |
itype => $itemtype, |
255 |
}, |
252 |
} |
256 |
$biblio->biblionumber |
|
|
257 |
); |
253 |
); |
|
|
254 |
$reused_itemnumber_2 = $item_2->itemnumber; |
258 |
|
255 |
|
259 |
my $barcode3 = 'R00000346'; |
256 |
my $item_3 = $builder->build_sample_item( |
260 |
my ( $item_bibnum3, $item_bibitemnum3, $itemnumber3 ) = AddItem( |
|
|
261 |
{ |
257 |
{ |
262 |
homebranch => $branch, |
258 |
biblionumber => $biblio->biblionumber, |
263 |
holdingbranch => $branch, |
259 |
library => $branch, |
264 |
barcode => $barcode3, |
|
|
265 |
replacementprice => 23.00, |
260 |
replacementprice => 23.00, |
266 |
itype => $itemtype |
261 |
itype => $itemtype, |
267 |
}, |
262 |
} |
268 |
$biblio->biblionumber |
|
|
269 |
); |
263 |
); |
270 |
|
264 |
|
271 |
# Create borrowers |
265 |
# Create borrowers |
Lines 324-342
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
324 |
my $checkitem = undef; |
318 |
my $checkitem = undef; |
325 |
my $found = undef; |
319 |
my $found = undef; |
326 |
|
320 |
|
327 |
my $issue = AddIssue( $renewing_borrower, $barcode); |
321 |
my $issue = AddIssue( $renewing_borrower, $item_1->barcode); |
328 |
my $datedue = dt_from_string( $issue->date_due() ); |
322 |
my $datedue = dt_from_string( $issue->date_due() ); |
329 |
is (defined $issue->date_due(), 1, "Item 1 checked out, due date: " . $issue->date_due() ); |
323 |
is (defined $issue->date_due(), 1, "Item 1 checked out, due date: " . $issue->date_due() ); |
330 |
|
324 |
|
331 |
my $issue2 = AddIssue( $renewing_borrower, $barcode2); |
325 |
my $issue2 = AddIssue( $renewing_borrower, $item_2->barcode); |
332 |
$datedue = dt_from_string( $issue->date_due() ); |
326 |
$datedue = dt_from_string( $issue->date_due() ); |
333 |
is (defined $issue2, 1, "Item 2 checked out, due date: " . $issue2->date_due()); |
327 |
is (defined $issue2, 1, "Item 2 checked out, due date: " . $issue2->date_due()); |
334 |
|
328 |
|
335 |
|
329 |
|
336 |
my $borrowing_borrowernumber = Koha::Checkouts->find( { itemnumber => $itemnumber } )->borrowernumber; |
330 |
my $borrowing_borrowernumber = Koha::Checkouts->find( { itemnumber => $item_1->itemnumber } )->borrowernumber; |
337 |
is ($borrowing_borrowernumber, $renewing_borrowernumber, "Item checked out to $renewing_borrower->{firstname} $renewing_borrower->{surname}"); |
331 |
is ($borrowing_borrowernumber, $renewing_borrowernumber, "Item checked out to $renewing_borrower->{firstname} $renewing_borrower->{surname}"); |
338 |
|
332 |
|
339 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1); |
333 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber, 1); |
340 |
is( $renewokay, 1, 'Can renew, no holds for this title or item'); |
334 |
is( $renewokay, 1, 'Can renew, no holds for this title or item'); |
341 |
|
335 |
|
342 |
|
336 |
|
Lines 350-358
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
350 |
# Testing of feature to allow the renewal of reserved items if other items on the record can fill all needed holds |
344 |
# Testing of feature to allow the renewal of reserved items if other items on the record can fill all needed holds |
351 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
345 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
352 |
t::lib::Mocks::mock_preference('AllowRenewalIfOtherItemsAvailable', 1 ); |
346 |
t::lib::Mocks::mock_preference('AllowRenewalIfOtherItemsAvailable', 1 ); |
353 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
347 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
354 |
is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
348 |
is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
355 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2); |
349 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_2->itemnumber); |
356 |
is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
350 |
is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
357 |
|
351 |
|
358 |
# Now let's add an item level hold, we should no longer be able to renew the item |
352 |
# Now let's add an item level hold, we should no longer be able to renew the item |
Lines 360-371
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
360 |
{ |
354 |
{ |
361 |
borrowernumber => $hold_waiting_borrowernumber, |
355 |
borrowernumber => $hold_waiting_borrowernumber, |
362 |
biblionumber => $biblio->biblionumber, |
356 |
biblionumber => $biblio->biblionumber, |
363 |
itemnumber => $itemnumber, |
357 |
itemnumber => $item_1->itemnumber, |
364 |
branchcode => $branch, |
358 |
branchcode => $branch, |
365 |
priority => 3, |
359 |
priority => 3, |
366 |
} |
360 |
} |
367 |
); |
361 |
); |
368 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
362 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
369 |
is( $renewokay, 0, 'Bug 13919 - Renewal possible with item level hold on item'); |
363 |
is( $renewokay, 0, 'Bug 13919 - Renewal possible with item level hold on item'); |
370 |
$hold->delete(); |
364 |
$hold->delete(); |
371 |
|
365 |
|
Lines 375-403
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
375 |
{ |
369 |
{ |
376 |
borrowernumber => $hold_waiting_borrowernumber, |
370 |
borrowernumber => $hold_waiting_borrowernumber, |
377 |
biblionumber => $biblio->biblionumber, |
371 |
biblionumber => $biblio->biblionumber, |
378 |
itemnumber => $itemnumber3, |
372 |
itemnumber => $item_3->itemnumber, |
379 |
branchcode => $branch, |
373 |
branchcode => $branch, |
380 |
priority => 0, |
374 |
priority => 0, |
381 |
found => 'W' |
375 |
found => 'W' |
382 |
} |
376 |
} |
383 |
); |
377 |
); |
384 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
378 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
385 |
is( $renewokay, 0, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
379 |
is( $renewokay, 0, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
386 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2); |
380 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_2->itemnumber); |
387 |
is( $renewokay, 0, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
381 |
is( $renewokay, 0, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); |
388 |
t::lib::Mocks::mock_preference('AllowRenewalIfOtherItemsAvailable', 0 ); |
382 |
t::lib::Mocks::mock_preference('AllowRenewalIfOtherItemsAvailable', 0 ); |
389 |
|
383 |
|
390 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
384 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
391 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, reserved'); |
385 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, reserved'); |
392 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, reserved (returned error is on_reserve)'); |
386 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, reserved (returned error is on_reserve)'); |
393 |
|
387 |
|
394 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2); |
388 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_2->itemnumber); |
395 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, reserved'); |
389 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, reserved'); |
396 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, reserved (returned error is on_reserve)'); |
390 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, reserved (returned error is on_reserve)'); |
397 |
|
391 |
|
398 |
my $reserveid = Koha::Holds->search({ biblionumber => $biblio->biblionumber, borrowernumber => $reserving_borrowernumber })->next->reserve_id; |
392 |
my $reserveid = Koha::Holds->search({ biblionumber => $biblio->biblionumber, borrowernumber => $reserving_borrowernumber })->next->reserve_id; |
399 |
my $reserving_borrower = Koha::Patrons->find( $reserving_borrowernumber )->unblessed; |
393 |
my $reserving_borrower = Koha::Patrons->find( $reserving_borrowernumber )->unblessed; |
400 |
AddIssue($reserving_borrower, $barcode3); |
394 |
AddIssue($reserving_borrower, $item_3->barcode); |
401 |
my $reserve = $dbh->selectrow_hashref( |
395 |
my $reserve = $dbh->selectrow_hashref( |
402 |
'SELECT * FROM old_reserves WHERE reserve_id = ?', |
396 |
'SELECT * FROM old_reserves WHERE reserve_id = ?', |
403 |
{ Slice => {} }, |
397 |
{ Slice => {} }, |
Lines 409-478
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
409 |
AddReserve( |
403 |
AddReserve( |
410 |
$branch, $reserving_borrowernumber, $biblio->biblionumber, |
404 |
$branch, $reserving_borrowernumber, $biblio->biblionumber, |
411 |
$bibitems, $priority, $resdate, $expdate, $notes, |
405 |
$bibitems, $priority, $resdate, $expdate, $notes, |
412 |
'a title', $itemnumber, $found |
406 |
'a title', $item_1->itemnumber, $found |
413 |
); |
407 |
); |
414 |
|
408 |
|
415 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1); |
409 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber, 1); |
416 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, item reserved'); |
410 |
is( $renewokay, 0, '(Bug 10663) Cannot renew, item reserved'); |
417 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, item reserved (returned error is on_reserve)'); |
411 |
is( $error, 'on_reserve', '(Bug 10663) Cannot renew, item reserved (returned error is on_reserve)'); |
418 |
|
412 |
|
419 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2, 1); |
413 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_2->itemnumber, 1); |
420 |
is( $renewokay, 1, 'Can renew item 2, item-level hold is on item 1'); |
414 |
is( $renewokay, 1, 'Can renew item 2, item-level hold is on item 1'); |
421 |
|
415 |
|
422 |
# Items can't fill hold for reasons |
416 |
# Items can't fill hold for reasons |
423 |
ModItem({ notforloan => 1 }, $biblio->biblionumber, $itemnumber); |
417 |
ModItem({ notforloan => 1 }, $biblio->biblionumber, $item_1->itemnumber); |
424 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1); |
418 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber, 1); |
425 |
is( $renewokay, 1, 'Can renew, item is marked not for loan, hold does not block'); |
419 |
is( $renewokay, 1, 'Can renew, item is marked not for loan, hold does not block'); |
426 |
ModItem({ notforloan => 0, itype => $itemtype }, $biblio->biblionumber, $itemnumber); |
420 |
ModItem({ notforloan => 0, itype => $itemtype }, $biblio->biblionumber, $item_1->itemnumber); |
427 |
|
421 |
|
428 |
# FIXME: Add more for itemtype not for loan etc. |
422 |
# FIXME: Add more for itemtype not for loan etc. |
429 |
|
423 |
|
430 |
# Restricted users cannot renew when RestrictionBlockRenewing is enabled |
424 |
# Restricted users cannot renew when RestrictionBlockRenewing is enabled |
431 |
my $barcode5 = 'R00000347'; |
425 |
my $item_5 = $builder->build_sample_item( |
432 |
my ( $item_bibnum5, $item_bibitemnum5, $itemnumber5 ) = AddItem( |
|
|
433 |
{ |
426 |
{ |
434 |
homebranch => $branch, |
427 |
biblionumber => $biblio->biblionumber, |
435 |
holdingbranch => $branch, |
428 |
library => $branch, |
436 |
barcode => $barcode5, |
|
|
437 |
replacementprice => 23.00, |
429 |
replacementprice => 23.00, |
438 |
itype => $itemtype |
430 |
itype => $itemtype, |
439 |
}, |
431 |
} |
440 |
$biblio->biblionumber |
|
|
441 |
); |
432 |
); |
442 |
my $datedue5 = AddIssue($restricted_borrower, $barcode5); |
433 |
my $datedue5 = AddIssue($restricted_borrower, $item_5->barcode); |
443 |
is (defined $datedue5, 1, "Item with date due checked out, due date: $datedue5"); |
434 |
is (defined $datedue5, 1, "Item with date due checked out, due date: $datedue5"); |
444 |
|
435 |
|
445 |
t::lib::Mocks::mock_preference('RestrictionBlockRenewing','1'); |
436 |
t::lib::Mocks::mock_preference('RestrictionBlockRenewing','1'); |
446 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2); |
437 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_2->itemnumber); |
447 |
is( $renewokay, 1, '(Bug 8236), Can renew, user is not restricted'); |
438 |
is( $renewokay, 1, '(Bug 8236), Can renew, user is not restricted'); |
448 |
( $renewokay, $error ) = CanBookBeRenewed($restricted_borrowernumber, $itemnumber5); |
439 |
( $renewokay, $error ) = CanBookBeRenewed($restricted_borrowernumber, $item_5->itemnumber); |
449 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, user is restricted'); |
440 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, user is restricted'); |
450 |
|
441 |
|
451 |
# Users cannot renew an overdue item |
442 |
# Users cannot renew an overdue item |
452 |
my $barcode6 = 'R00000348'; |
443 |
my $item_6 = $builder->build_sample_item( |
453 |
my ( $item_bibnum6, $item_bibitemnum6, $itemnumber6 ) = AddItem( |
|
|
454 |
{ |
444 |
{ |
455 |
homebranch => $branch, |
445 |
biblionumber => $biblio->biblionumber, |
456 |
holdingbranch => $branch, |
446 |
library => $branch, |
457 |
barcode => $barcode6, |
|
|
458 |
replacementprice => 23.00, |
447 |
replacementprice => 23.00, |
459 |
itype => $itemtype |
448 |
itype => $itemtype, |
460 |
}, |
449 |
} |
461 |
$biblio->biblionumber |
|
|
462 |
); |
450 |
); |
463 |
|
451 |
|
464 |
my $barcode7 = 'R00000349'; |
452 |
my $item_7 = $builder->build_sample_item( |
465 |
my ( $item_bibnum7, $item_bibitemnum7, $itemnumber7 ) = AddItem( |
|
|
466 |
{ |
453 |
{ |
467 |
homebranch => $branch, |
454 |
biblionumber => $biblio->biblionumber, |
468 |
holdingbranch => $branch, |
455 |
library => $branch, |
469 |
barcode => $barcode7, |
|
|
470 |
replacementprice => 23.00, |
456 |
replacementprice => 23.00, |
471 |
itype => $itemtype |
457 |
itype => $itemtype, |
472 |
}, |
458 |
} |
473 |
$biblio->biblionumber |
|
|
474 |
); |
459 |
); |
475 |
my $datedue6 = AddIssue( $renewing_borrower, $barcode6); |
460 |
|
|
|
461 |
my $datedue6 = AddIssue( $renewing_borrower, $item_6->barcode); |
476 |
is (defined $datedue6, 1, "Item 2 checked out, due date: ".$datedue6->date_due); |
462 |
is (defined $datedue6, 1, "Item 2 checked out, due date: ".$datedue6->date_due); |
477 |
|
463 |
|
478 |
my $now = dt_from_string(); |
464 |
my $now = dt_from_string(); |
Lines 480-493
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
480 |
my $five_weeks_ago = $now - $five_weeks; |
466 |
my $five_weeks_ago = $now - $five_weeks; |
481 |
t::lib::Mocks::mock_preference('finesMode', 'production'); |
467 |
t::lib::Mocks::mock_preference('finesMode', 'production'); |
482 |
|
468 |
|
483 |
my $passeddatedue1 = AddIssue($renewing_borrower, $barcode7, $five_weeks_ago); |
469 |
my $passeddatedue1 = AddIssue($renewing_borrower, $item_7->barcode, $five_weeks_ago); |
484 |
is (defined $passeddatedue1, 1, "Item with passed date due checked out, due date: " . $passeddatedue1->date_due); |
470 |
is (defined $passeddatedue1, 1, "Item with passed date due checked out, due date: " . $passeddatedue1->date_due); |
485 |
|
471 |
|
486 |
my ( $fine ) = CalcFine( GetItem(undef, $barcode7), $renewing_borrower->{categorycode}, $branch, $five_weeks_ago, $now ); |
472 |
my ( $fine ) = CalcFine( GetItem(undef, $item_7->barcode), $renewing_borrower->{categorycode}, $branch, $five_weeks_ago, $now ); |
487 |
C4::Overdues::UpdateFine( |
473 |
C4::Overdues::UpdateFine( |
488 |
{ |
474 |
{ |
489 |
issue_id => $passeddatedue1->id(), |
475 |
issue_id => $passeddatedue1->id(), |
490 |
itemnumber => $itemnumber7, |
476 |
itemnumber => $item_7->itemnumber, |
491 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
477 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
492 |
amount => $fine, |
478 |
amount => $fine, |
493 |
type => 'FU', |
479 |
type => 'FU', |
Lines 498-515
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
498 |
t::lib::Mocks::mock_preference('RenewalLog', 0); |
484 |
t::lib::Mocks::mock_preference('RenewalLog', 0); |
499 |
my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); |
485 |
my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); |
500 |
my $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
486 |
my $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
501 |
AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch ); |
487 |
AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch ); |
502 |
my $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
488 |
my $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
503 |
is ($new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog'); |
489 |
is ($new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog'); |
504 |
|
490 |
|
505 |
t::lib::Mocks::mock_preference('RenewalLog', 1); |
491 |
t::lib::Mocks::mock_preference('RenewalLog', 1); |
506 |
$date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); |
492 |
$date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); |
507 |
$old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
493 |
$old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
508 |
AddRenewal( $renewing_borrower->{borrowernumber}, $itemnumber7, $branch ); |
494 |
AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch ); |
509 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
495 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
510 |
is ($new_log_size, $old_log_size + 1, 'renew log successfully added'); |
496 |
is ($new_log_size, $old_log_size + 1, 'renew log successfully added'); |
511 |
|
497 |
|
512 |
my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } ); |
498 |
my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } ); |
513 |
is( $fines->count, 2 ); |
499 |
is( $fines->count, 2 ); |
514 |
is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' ); |
500 |
is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' ); |
515 |
is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' ); |
501 |
is( $fines->next->accounttype, 'F', 'Fine on renewed item is closed out properly' ); |
Lines 518-536
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
518 |
|
504 |
|
519 |
my $old_issue_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); |
505 |
my $old_issue_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); |
520 |
my $old_renew_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
506 |
my $old_renew_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
521 |
AddIssue( $renewing_borrower,$barcode7,Koha::DateUtils::output_pref({str=>$datedue6->date_due, dateformat =>'iso'}),0,$date, 0, undef ); |
507 |
AddIssue( $renewing_borrower,$item_7->barcode,Koha::DateUtils::output_pref({str=>$datedue6->date_due, dateformat =>'iso'}),0,$date, 0, undef ); |
522 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
508 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); |
523 |
is ($new_log_size, $old_renew_log_size + 1, 'renew log successfully added when renewed via issuing'); |
509 |
is ($new_log_size, $old_renew_log_size + 1, 'renew log successfully added when renewed via issuing'); |
524 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); |
510 |
$new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); |
525 |
is ($new_log_size, $old_issue_log_size, 'renew not logged as issue when renewed via issuing'); |
511 |
is ($new_log_size, $old_issue_log_size, 'renew not logged as issue when renewed via issuing'); |
526 |
|
512 |
|
527 |
$fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $itemnumber7 } ); |
513 |
$fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } ); |
528 |
$fines->delete(); |
514 |
$fines->delete(); |
529 |
|
515 |
|
530 |
t::lib::Mocks::mock_preference('OverduesBlockRenewing','blockitem'); |
516 |
t::lib::Mocks::mock_preference('OverduesBlockRenewing','blockitem'); |
531 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber6); |
517 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_6->itemnumber); |
532 |
is( $renewokay, 1, '(Bug 8236), Can renew, this item is not overdue'); |
518 |
is( $renewokay, 1, '(Bug 8236), Can renew, this item is not overdue'); |
533 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber7); |
519 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_7->itemnumber); |
534 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, this item is overdue'); |
520 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, this item is overdue'); |
535 |
|
521 |
|
536 |
|
522 |
|
Lines 540-560
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
540 |
# Bug 14101 |
526 |
# Bug 14101 |
541 |
# Test automatic renewal before value for "norenewalbefore" in policy is set |
527 |
# Test automatic renewal before value for "norenewalbefore" in policy is set |
542 |
# In this case automatic renewal is not permitted prior to due date |
528 |
# In this case automatic renewal is not permitted prior to due date |
543 |
my $barcode4 = '11235813'; |
529 |
my $item_4 = $builder->build_sample_item( |
544 |
my ( $item_bibnum4, $item_bibitemnum4, $itemnumber4 ) = AddItem( |
|
|
545 |
{ |
530 |
{ |
546 |
homebranch => $branch, |
531 |
biblionumber => $biblio->biblionumber, |
547 |
holdingbranch => $branch, |
532 |
library => $branch, |
548 |
barcode => $barcode4, |
|
|
549 |
replacementprice => 16.00, |
533 |
replacementprice => 16.00, |
550 |
itype => $itemtype |
534 |
itype => $itemtype, |
551 |
}, |
535 |
} |
552 |
$biblio->biblionumber |
|
|
553 |
); |
536 |
); |
554 |
|
537 |
|
555 |
$issue = AddIssue( $renewing_borrower, $barcode4, undef, undef, undef, undef, { auto_renew => 1 } ); |
538 |
$issue = AddIssue( $renewing_borrower, $item_4->barcode, undef, undef, undef, undef, { auto_renew => 1 } ); |
556 |
( $renewokay, $error ) = |
539 |
( $renewokay, $error ) = |
557 |
CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); |
540 |
CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); |
558 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
541 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
559 |
is( $error, 'auto_too_soon', |
542 |
is( $error, 'auto_too_soon', |
560 |
'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = undef (returned code is auto_too_soon)' ); |
543 |
'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = undef (returned code is auto_too_soon)' ); |
Lines 563-569
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
563 |
# Test premature manual renewal |
546 |
# Test premature manual renewal |
564 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 7'); |
547 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 7'); |
565 |
|
548 |
|
566 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
549 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
567 |
is( $renewokay, 0, 'Bug 7413: Cannot renew, renewal is premature'); |
550 |
is( $renewokay, 0, 'Bug 7413: Cannot renew, renewal is premature'); |
568 |
is( $error, 'too_soon', 'Bug 7413: Cannot renew, renewal is premature (returned code is too_soon)'); |
551 |
is( $error, 'too_soon', 'Bug 7413: Cannot renew, renewal is premature (returned code is too_soon)'); |
569 |
|
552 |
|
Lines 571-577
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
571 |
# Test 'exact time' setting for syspref NoRenewalBeforePrecision |
554 |
# Test 'exact time' setting for syspref NoRenewalBeforePrecision |
572 |
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'exact_time' ); |
555 |
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'exact_time' ); |
573 |
is( |
556 |
is( |
574 |
GetSoonestRenewDate( $renewing_borrowernumber, $itemnumber ), |
557 |
GetSoonestRenewDate( $renewing_borrowernumber, $item_1->itemnumber ), |
575 |
$datedue->clone->add( days => -7 ), |
558 |
$datedue->clone->add( days => -7 ), |
576 |
'Bug 14395: Renewals permitted 7 days before due date, as expected' |
559 |
'Bug 14395: Renewals permitted 7 days before due date, as expected' |
577 |
); |
560 |
); |
Lines 580-586
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
580 |
# Test 'date' setting for syspref NoRenewalBeforePrecision |
563 |
# Test 'date' setting for syspref NoRenewalBeforePrecision |
581 |
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'date' ); |
564 |
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'date' ); |
582 |
is( |
565 |
is( |
583 |
GetSoonestRenewDate( $renewing_borrowernumber, $itemnumber ), |
566 |
GetSoonestRenewDate( $renewing_borrowernumber, $item_1->itemnumber ), |
584 |
$datedue->clone->add( days => -7 )->truncate( to => 'day' ), |
567 |
$datedue->clone->add( days => -7 )->truncate( to => 'day' ), |
585 |
'Bug 14395: Renewals permitted 7 days before due date, as expected' |
568 |
'Bug 14395: Renewals permitted 7 days before due date, as expected' |
586 |
); |
569 |
); |
Lines 588-594
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
588 |
# Bug 14101 |
571 |
# Bug 14101 |
589 |
# Test premature automatic renewal |
572 |
# Test premature automatic renewal |
590 |
( $renewokay, $error ) = |
573 |
( $renewokay, $error ) = |
591 |
CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); |
574 |
CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); |
592 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
575 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
593 |
is( $error, 'auto_too_soon', |
576 |
is( $error, 'auto_too_soon', |
594 |
'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' |
577 |
'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' |
Lines 598-604
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
598 |
# and test automatic renewal again |
581 |
# and test automatic renewal again |
599 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 0'); |
582 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 0'); |
600 |
( $renewokay, $error ) = |
583 |
( $renewokay, $error ) = |
601 |
CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); |
584 |
CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); |
602 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
585 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic and premature' ); |
603 |
is( $error, 'auto_too_soon', |
586 |
is( $error, 'auto_too_soon', |
604 |
'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)' |
587 |
'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)' |
Lines 608-614
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
608 |
# and test automatic renewal again |
591 |
# and test automatic renewal again |
609 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 99'); |
592 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = 99'); |
610 |
( $renewokay, $error ) = |
593 |
( $renewokay, $error ) = |
611 |
CanBookBeRenewed( $renewing_borrowernumber, $itemnumber4 ); |
594 |
CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); |
612 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic' ); |
595 |
is( $renewokay, 0, 'Bug 14101: Cannot renew, renewal is automatic' ); |
613 |
is( $error, 'auto_renew', |
596 |
is( $error, 'auto_renew', |
614 |
'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)' |
597 |
'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)' |
Lines 818-824
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
818 |
# set policy to forbid renewals |
801 |
# set policy to forbid renewals |
819 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = NULL, renewalsallowed = 0'); |
802 |
$dbh->do('UPDATE issuingrules SET norenewalbefore = NULL, renewalsallowed = 0'); |
820 |
|
803 |
|
821 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); |
804 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber); |
822 |
is( $renewokay, 0, 'Cannot renew, 0 renewals allowed'); |
805 |
is( $renewokay, 0, 'Cannot renew, 0 renewals allowed'); |
823 |
is( $error, 'too_many', 'Cannot renew, 0 renewals allowed (returned code is too_many)'); |
806 |
is( $error, 'too_many', 'Cannot renew, 0 renewals allowed (returned code is too_many)'); |
824 |
|
807 |
|
Lines 829-835
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
829 |
C4::Overdues::UpdateFine( |
812 |
C4::Overdues::UpdateFine( |
830 |
{ |
813 |
{ |
831 |
issue_id => $issue->id(), |
814 |
issue_id => $issue->id(), |
832 |
itemnumber => $itemnumber, |
815 |
itemnumber => $item_1->itemnumber, |
833 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
816 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
834 |
amount => 15.00, |
817 |
amount => 15.00, |
835 |
type => q{}, |
818 |
type => q{}, |
Lines 851-864
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
851 |
t::lib::Mocks::mock_preference('WhenLostForgiveFine','0'); |
834 |
t::lib::Mocks::mock_preference('WhenLostForgiveFine','0'); |
852 |
t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0'); |
835 |
t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0'); |
853 |
|
836 |
|
854 |
LostItem( $itemnumber, 'test', 1 ); |
837 |
LostItem( $item_1->itemnumber, 'test', 1 ); |
855 |
|
838 |
|
856 |
$line = Koha::Account::Lines->find($line->id); |
839 |
$line = Koha::Account::Lines->find($line->id); |
857 |
is( $line->accounttype, 'F', 'Account type correctly changed from FU to F' ); |
840 |
is( $line->accounttype, 'F', 'Account type correctly changed from FU to F' ); |
858 |
|
841 |
|
859 |
my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber); |
842 |
my $item = Koha::Items->find($item_1->itemnumber); |
860 |
ok( !$item->onloan(), "Lost item marked as returned has false onloan value" ); |
843 |
ok( !$item->onloan(), "Lost item marked as returned has false onloan value" ); |
861 |
my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber }); |
844 |
my $checkout = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber }); |
862 |
is( $checkout, undef, 'LostItem called with forced return has checked in the item' ); |
845 |
is( $checkout, undef, 'LostItem called with forced return has checked in the item' ); |
863 |
|
846 |
|
864 |
my $total_due = $dbh->selectrow_array( |
847 |
my $total_due = $dbh->selectrow_array( |
Lines 873-879
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
873 |
C4::Overdues::UpdateFine( |
856 |
C4::Overdues::UpdateFine( |
874 |
{ |
857 |
{ |
875 |
issue_id => $issue2->id(), |
858 |
issue_id => $issue2->id(), |
876 |
itemnumber => $itemnumber2, |
859 |
itemnumber => $item_2->itemnumber, |
877 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
860 |
borrowernumber => $renewing_borrower->{borrowernumber}, |
878 |
amount => 15.00, |
861 |
amount => 15.00, |
879 |
type => q{}, |
862 |
type => q{}, |
Lines 881-891
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
881 |
} |
864 |
} |
882 |
); |
865 |
); |
883 |
|
866 |
|
884 |
LostItem( $itemnumber2, 'test', 0 ); |
867 |
LostItem( $item_2->itemnumber, 'test', 0 ); |
885 |
|
868 |
|
886 |
my $item2 = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber2); |
869 |
my $item2 = Koha::Items->find($item_2->itemnumber); |
887 |
ok( $item2->onloan(), "Lost item *not* marked as returned has true onloan value" ); |
870 |
ok( $item2->onloan(), "Lost item *not* marked as returned has true onloan value" ); |
888 |
ok( Koha::Checkouts->find({ itemnumber => $itemnumber2 }), 'LostItem called without forced return has checked in the item' ); |
871 |
ok( Koha::Checkouts->find({ itemnumber => $item_2->itemnumber }), 'LostItem called without forced return has checked in the item' ); |
889 |
|
872 |
|
890 |
$total_due = $dbh->selectrow_array( |
873 |
$total_due = $dbh->selectrow_array( |
891 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
874 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
Lines 901-940
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
901 |
|
884 |
|
902 |
# Users cannot renew any item if there is an overdue item |
885 |
# Users cannot renew any item if there is an overdue item |
903 |
t::lib::Mocks::mock_preference('OverduesBlockRenewing','block'); |
886 |
t::lib::Mocks::mock_preference('OverduesBlockRenewing','block'); |
904 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber6); |
887 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_6->itemnumber); |
905 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, one of the items is overdue'); |
888 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, one of the items is overdue'); |
906 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber7); |
889 |
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_7->itemnumber); |
907 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, one of the items is overdue'); |
890 |
is( $renewokay, 0, '(Bug 8236), Cannot renew, one of the items is overdue'); |
908 |
|
891 |
|
909 |
t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','1'); |
892 |
t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','1'); |
910 |
$checkout = Koha::Checkouts->find( { itemnumber => $itemnumber3 } ); |
893 |
$checkout = Koha::Checkouts->find( { itemnumber => $item_3->itemnumber } ); |
911 |
LostItem( $itemnumber3, 'test', 0 ); |
894 |
LostItem( $item_3->itemnumber, 'test', 0 ); |
912 |
my $accountline = Koha::Account::Lines->find( { itemnumber => $itemnumber3 } ); |
895 |
my $accountline = Koha::Account::Lines->find( { itemnumber => $item_3->itemnumber } ); |
913 |
is( $accountline->issue_id, $checkout->id, "Issue id added for lost replacement fee charge" ); |
896 |
is( $accountline->issue_id, $checkout->id, "Issue id added for lost replacement fee charge" ); |
914 |
|
|
|
915 |
} |
897 |
} |
916 |
|
898 |
|
917 |
{ |
899 |
{ |
918 |
# GetUpcomingDueIssues tests |
900 |
# GetUpcomingDueIssues tests |
919 |
my $barcode = 'R00000342'; |
|
|
920 |
my $barcode2 = 'R00000343'; |
921 |
my $barcode3 = 'R00000344'; |
922 |
my $branch = $library2->{branchcode}; |
901 |
my $branch = $library2->{branchcode}; |
923 |
|
902 |
|
924 |
#Create another record |
903 |
#Create another record |
925 |
my $biblio2 = $builder->build_sample_biblio(); |
904 |
my $biblio2 = $builder->build_sample_biblio(); |
926 |
|
905 |
|
927 |
#Create third item |
906 |
#Create third item |
928 |
AddItem( |
907 |
my $item_1 = Koha::Items->find($reused_itemnumber_1); |
|
|
908 |
my $item_2 = Koha::Items->find($reused_itemnumber_2); |
909 |
my $item_3 = $builder->build_sample_item( |
929 |
{ |
910 |
{ |
930 |
homebranch => $branch, |
911 |
biblionumber => $biblio2->biblionumber, |
931 |
holdingbranch => $branch, |
912 |
library => $branch, |
932 |
barcode => $barcode3, |
913 |
itype => $itemtype, |
933 |
itype => $itemtype |
914 |
} |
934 |
}, |
|
|
935 |
$biblio2->biblionumber |
936 |
); |
915 |
); |
937 |
|
916 |
|
|
|
917 |
|
938 |
# Create a borrower |
918 |
# Create a borrower |
939 |
my %a_borrower_data = ( |
919 |
my %a_borrower_data = ( |
940 |
firstname => 'Fridolyn', |
920 |
firstname => 'Fridolyn', |
Lines 950-958
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
950 |
my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); |
930 |
my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); |
951 |
my $today = DateTime->today(time_zone => C4::Context->tz()); |
931 |
my $today = DateTime->today(time_zone => C4::Context->tz()); |
952 |
|
932 |
|
953 |
my $issue = AddIssue( $a_borrower, $barcode, $yesterday ); |
933 |
my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); |
954 |
my $datedue = dt_from_string( $issue->date_due() ); |
934 |
my $datedue = dt_from_string( $issue->date_due() ); |
955 |
my $issue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); |
935 |
my $issue2 = AddIssue( $a_borrower, $item_2->barcode, $two_days_ahead ); |
956 |
my $datedue2 = dt_from_string( $issue->date_due() ); |
936 |
my $datedue2 = dt_from_string( $issue->date_due() ); |
957 |
|
937 |
|
958 |
my $upcoming_dues; |
938 |
my $upcoming_dues; |
Lines 975-981
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
975 |
|
955 |
|
976 |
# Bug 11218 - Due notices not generated - GetUpcomingDueIssues needs to select due today items as well |
956 |
# Bug 11218 - Due notices not generated - GetUpcomingDueIssues needs to select due today items as well |
977 |
|
957 |
|
978 |
my $issue3 = AddIssue( $a_borrower, $barcode3, $today ); |
958 |
my $issue3 = AddIssue( $a_borrower, $item_3->barcode, $today ); |
979 |
|
959 |
|
980 |
$upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => -1 } ); |
960 |
$upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => -1 } ); |
981 |
is ( scalar ( @$upcoming_dues), 0, "Overdues can not be selected" ); |
961 |
is ( scalar ( @$upcoming_dues), 0, "Overdues can not be selected" ); |
Lines 998-1017
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
998 |
} |
978 |
} |
999 |
|
979 |
|
1000 |
{ |
980 |
{ |
1001 |
my $barcode = '1234567890'; |
|
|
1002 |
my $branch = $library2->{branchcode}; |
981 |
my $branch = $library2->{branchcode}; |
1003 |
|
982 |
|
1004 |
my $biblio = $builder->build_sample_biblio(); |
983 |
my $biblio = $builder->build_sample_biblio(); |
1005 |
|
984 |
|
1006 |
#Create third item |
985 |
#Create third item |
1007 |
my ( undef, undef, $itemnumber ) = AddItem( |
986 |
my $item = $builder->build_sample_item( |
1008 |
{ |
987 |
{ |
1009 |
homebranch => $branch, |
988 |
biblionumber => $biblio->biblionumber, |
1010 |
holdingbranch => $branch, |
989 |
library => $branch, |
1011 |
barcode => $barcode, |
990 |
itype => $itemtype, |
1012 |
itype => $itemtype |
991 |
} |
1013 |
}, |
|
|
1014 |
$biblio->biblionumber |
1015 |
); |
992 |
); |
1016 |
|
993 |
|
1017 |
# Create a borrower |
994 |
# Create a borrower |
Lines 1025-1042
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1025 |
my $borrowernumber = Koha::Patron->new(\%a_borrower_data)->store->borrowernumber; |
1002 |
my $borrowernumber = Koha::Patron->new(\%a_borrower_data)->store->borrowernumber; |
1026 |
|
1003 |
|
1027 |
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
1004 |
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
1028 |
my $issue = AddIssue( $borrower, $barcode ); |
1005 |
my $issue = AddIssue( $borrower, $item->barcode ); |
1029 |
UpdateFine( |
1006 |
UpdateFine( |
1030 |
{ |
1007 |
{ |
1031 |
issue_id => $issue->id(), |
1008 |
issue_id => $issue->id(), |
1032 |
itemnumber => $itemnumber, |
1009 |
itemnumber => $item->itemnumber, |
1033 |
borrowernumber => $borrowernumber, |
1010 |
borrowernumber => $borrowernumber, |
1034 |
amount => 0, |
1011 |
amount => 0, |
1035 |
type => q{} |
1012 |
type => q{} |
1036 |
} |
1013 |
} |
1037 |
); |
1014 |
); |
1038 |
|
1015 |
|
1039 |
my $hr = $dbh->selectrow_hashref(q{SELECT COUNT(*) AS count FROM accountlines WHERE borrowernumber = ? AND itemnumber = ?}, undef, $borrowernumber, $itemnumber ); |
1016 |
my $hr = $dbh->selectrow_hashref(q{SELECT COUNT(*) AS count FROM accountlines WHERE borrowernumber = ? AND itemnumber = ?}, undef, $borrowernumber, $item->itemnumber ); |
1040 |
my $count = $hr->{count}; |
1017 |
my $count = $hr->{count}; |
1041 |
|
1018 |
|
1042 |
is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" ); |
1019 |
is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" ); |
Lines 1060-1084
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1060 |
); |
1037 |
); |
1061 |
my $biblio = $builder->build_sample_biblio(); |
1038 |
my $biblio = $builder->build_sample_biblio(); |
1062 |
|
1039 |
|
1063 |
my $barcode1 = '1234'; |
1040 |
my $item_1 = $builder->build_sample_item( |
1064 |
my ( undef, undef, $itemnumber1 ) = AddItem( |
|
|
1065 |
{ |
1041 |
{ |
1066 |
homebranch => $library2->{branchcode}, |
1042 |
biblionumber => $biblio->biblionumber, |
1067 |
holdingbranch => $library2->{branchcode}, |
1043 |
library => $library2->{branchcode}, |
1068 |
barcode => $barcode1, |
1044 |
itype => $itemtype, |
1069 |
itype => $itemtype |
1045 |
} |
1070 |
}, |
|
|
1071 |
$biblio->biblionumber |
1072 |
); |
1046 |
); |
1073 |
my $barcode2 = '4321'; |
1047 |
|
1074 |
my ( undef, undef, $itemnumber2 ) = AddItem( |
1048 |
my $item_2= $builder->build_sample_item( |
1075 |
{ |
1049 |
{ |
1076 |
homebranch => $library2->{branchcode}, |
1050 |
biblionumber => $biblio->biblionumber, |
1077 |
holdingbranch => $library2->{branchcode}, |
1051 |
library => $library2->{branchcode}, |
1078 |
barcode => $barcode2, |
1052 |
itype => $itemtype, |
1079 |
itype => $itemtype |
1053 |
} |
1080 |
}, |
|
|
1081 |
$biblio->biblionumber |
1082 |
); |
1054 |
); |
1083 |
|
1055 |
|
1084 |
my $borrowernumber1 = Koha::Patron->new({ |
1056 |
my $borrowernumber1 = Koha::Patron->new({ |
Lines 1097-1105
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1097 |
my $borrower1 = Koha::Patrons->find( $borrowernumber1 )->unblessed; |
1069 |
my $borrower1 = Koha::Patrons->find( $borrowernumber1 )->unblessed; |
1098 |
my $borrower2 = Koha::Patrons->find( $borrowernumber2 )->unblessed; |
1070 |
my $borrower2 = Koha::Patrons->find( $borrowernumber2 )->unblessed; |
1099 |
|
1071 |
|
1100 |
my $issue = AddIssue( $borrower1, $barcode1 ); |
1072 |
my $issue = AddIssue( $borrower1, $item_1->barcode ); |
1101 |
|
1073 |
|
1102 |
my ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1074 |
my ( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1103 |
is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with no hold on the record' ); |
1075 |
is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with no hold on the record' ); |
1104 |
|
1076 |
|
1105 |
AddReserve( |
1077 |
AddReserve( |
Lines 1110-1156
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1110 |
|
1082 |
|
1111 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); |
1083 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); |
1112 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); |
1084 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); |
1113 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1085 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1114 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfholds are disabled' ); |
1086 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfholds are disabled' ); |
1115 |
|
1087 |
|
1116 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); |
1088 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 0"); |
1117 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); |
1089 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); |
1118 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1090 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1119 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled and onshelfholds is disabled' ); |
1091 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled and onshelfholds is disabled' ); |
1120 |
|
1092 |
|
1121 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
1093 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
1122 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); |
1094 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 0 ); |
1123 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1095 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1124 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is disabled and onshelfhold is enabled' ); |
1096 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower cannot renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is disabled and onshelfhold is enabled' ); |
1125 |
|
1097 |
|
1126 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
1098 |
C4::Context->dbh->do("UPDATE issuingrules SET onshelfholds = 1"); |
1127 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); |
1099 |
t::lib::Mocks::mock_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); |
1128 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1100 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1129 |
is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfhold are enabled' ); |
1101 |
is( $renewokay, 1, 'Bug 14337 - Verify the borrower can renew with a hold on the record if AllowRenewalIfOtherItemsAvailable and onshelfhold are enabled' ); |
1130 |
|
1102 |
|
1131 |
# Setting item not checked out to be not for loan but holdable |
1103 |
# Setting item not checked out to be not for loan but holdable |
1132 |
ModItem({ notforloan => -1 }, $biblio->biblionumber, $itemnumber2); |
1104 |
ModItem({ notforloan => -1 }, $biblio->biblionumber, $item_2->itemnumber); |
1133 |
|
1105 |
|
1134 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $itemnumber1 ); |
1106 |
( $renewokay, $error ) = CanBookBeRenewed( $borrowernumber1, $item_1->itemnumber ); |
1135 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' ); |
1107 |
is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' ); |
1136 |
} |
1108 |
} |
1137 |
|
1109 |
|
1138 |
{ |
1110 |
{ |
1139 |
# Don't allow renewing onsite checkout |
1111 |
# Don't allow renewing onsite checkout |
1140 |
my $barcode = 'R00000XXX'; |
|
|
1141 |
my $branch = $library->{branchcode}; |
1112 |
my $branch = $library->{branchcode}; |
1142 |
|
1113 |
|
1143 |
#Create another record |
1114 |
#Create another record |
1144 |
my $biblio = $builder->build_sample_biblio(); |
1115 |
my $biblio = $builder->build_sample_biblio(); |
1145 |
|
1116 |
|
1146 |
my (undef, undef, $itemnumber) = AddItem( |
1117 |
my $item = $builder->build_sample_item( |
1147 |
{ |
1118 |
{ |
1148 |
homebranch => $branch, |
1119 |
biblionumber => $biblio->biblionumber, |
1149 |
holdingbranch => $branch, |
1120 |
library => $branch, |
1150 |
barcode => $barcode, |
1121 |
itype => $itemtype, |
1151 |
itype => $itemtype |
1122 |
} |
1152 |
}, |
|
|
1153 |
$biblio->biblionumber |
1154 |
); |
1123 |
); |
1155 |
|
1124 |
|
1156 |
my $borrowernumber = Koha::Patron->new({ |
1125 |
my $borrowernumber = Koha::Patron->new({ |
Lines 1162-1169
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1162 |
|
1131 |
|
1163 |
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
1132 |
my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
1164 |
|
1133 |
|
1165 |
my $issue = AddIssue( $borrower, $barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
1134 |
my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); |
1166 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $itemnumber ); |
1135 |
my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $item->itemnumber ); |
1167 |
is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' ); |
1136 |
is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' ); |
1168 |
is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' ); |
1137 |
is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' ); |
1169 |
} |
1138 |
} |
Lines 1173-1196
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1173 |
|
1142 |
|
1174 |
my $biblio = $builder->build_sample_biblio(); |
1143 |
my $biblio = $builder->build_sample_biblio(); |
1175 |
|
1144 |
|
1176 |
my $barcode = 'just a barcode'; |
1145 |
my $item = $builder->build_sample_item( |
1177 |
my ( undef, undef, $itemnumber ) = AddItem( |
|
|
1178 |
{ |
1146 |
{ |
1179 |
homebranch => $library->{branchcode}, |
1147 |
biblionumber => $biblio->biblionumber, |
1180 |
holdingbranch => $library->{branchcode}, |
1148 |
library => $library->{branchcode}, |
1181 |
barcode => $barcode, |
1149 |
itype => $itemtype, |
1182 |
itype => $itemtype |
1150 |
} |
1183 |
}, |
|
|
1184 |
$biblio->biblionumber, |
1185 |
); |
1151 |
); |
1186 |
|
1152 |
|
1187 |
my $patron = $builder->build({ source => 'Borrower', value => { branchcode => $library->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
1153 |
my $patron = $builder->build({ source => 'Borrower', value => { branchcode => $library->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
1188 |
|
1154 |
|
1189 |
my $issue = AddIssue( $patron, $barcode ); |
1155 |
my $issue = AddIssue( $patron, $item->barcode ); |
1190 |
UpdateFine( |
1156 |
UpdateFine( |
1191 |
{ |
1157 |
{ |
1192 |
issue_id => $issue->id(), |
1158 |
issue_id => $issue->id(), |
1193 |
itemnumber => $itemnumber, |
1159 |
itemnumber => $item->itemnumber, |
1194 |
borrowernumber => $patron->{borrowernumber}, |
1160 |
borrowernumber => $patron->{borrowernumber}, |
1195 |
amount => 1, |
1161 |
amount => 1, |
1196 |
type => q{} |
1162 |
type => q{} |
Lines 1199-1205
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
1199 |
UpdateFine( |
1165 |
UpdateFine( |
1200 |
{ |
1166 |
{ |
1201 |
issue_id => $issue->id(), |
1167 |
issue_id => $issue->id(), |
1202 |
itemnumber => $itemnumber, |
1168 |
itemnumber => $item->itemnumber, |
1203 |
borrowernumber => $patron->{borrowernumber}, |
1169 |
borrowernumber => $patron->{borrowernumber}, |
1204 |
amount => 2, |
1170 |
amount => 2, |
1205 |
type => q{} |
1171 |
type => q{} |
Lines 1475-1502
subtest 'MultipleReserves' => sub {
Link Here
|
1475 |
|
1441 |
|
1476 |
my $branch = $library2->{branchcode}; |
1442 |
my $branch = $library2->{branchcode}; |
1477 |
|
1443 |
|
1478 |
my $barcode1 = 'R00110001'; |
1444 |
my $item_1 = $builder->build_sample_item( |
1479 |
my ( $item_bibnum1, $item_bibitemnum1, $itemnumber1 ) = AddItem( |
|
|
1480 |
{ |
1445 |
{ |
1481 |
homebranch => $branch, |
1446 |
biblionumber => $biblio->biblionumber, |
1482 |
holdingbranch => $branch, |
1447 |
library => $branch, |
1483 |
barcode => $barcode1, |
|
|
1484 |
replacementprice => 12.00, |
1448 |
replacementprice => 12.00, |
1485 |
itype => $itemtype |
1449 |
itype => $itemtype, |
1486 |
}, |
1450 |
} |
1487 |
$biblio->biblionumber |
|
|
1488 |
); |
1451 |
); |
1489 |
|
1452 |
|
1490 |
my $barcode2 = 'R00110002'; |
1453 |
my $item_2 = $builder->build_sample_item( |
1491 |
my ( $item_bibnum2, $item_bibitemnum2, $itemnumber2 ) = AddItem( |
|
|
1492 |
{ |
1454 |
{ |
1493 |
homebranch => $branch, |
1455 |
biblionumber => $biblio->biblionumber, |
1494 |
holdingbranch => $branch, |
1456 |
library => $branch, |
1495 |
barcode => $barcode2, |
|
|
1496 |
replacementprice => 12.00, |
1457 |
replacementprice => 12.00, |
1497 |
itype => $itemtype |
1458 |
itype => $itemtype, |
1498 |
}, |
1459 |
} |
1499 |
$biblio->biblionumber |
|
|
1500 |
); |
1460 |
); |
1501 |
|
1461 |
|
1502 |
my $bibitems = ''; |
1462 |
my $bibitems = ''; |
Lines 1515-1524
subtest 'MultipleReserves' => sub {
Link Here
|
1515 |
); |
1475 |
); |
1516 |
my $renewing_borrowernumber = Koha::Patron->new(\%renewing_borrower_data)->store->borrowernumber; |
1476 |
my $renewing_borrowernumber = Koha::Patron->new(\%renewing_borrower_data)->store->borrowernumber; |
1517 |
my $renewing_borrower = Koha::Patrons->find( $renewing_borrowernumber )->unblessed; |
1477 |
my $renewing_borrower = Koha::Patrons->find( $renewing_borrowernumber )->unblessed; |
1518 |
my $issue = AddIssue( $renewing_borrower, $barcode1); |
1478 |
my $issue = AddIssue( $renewing_borrower, $item_1->barcode); |
1519 |
my $datedue = dt_from_string( $issue->date_due() ); |
1479 |
my $datedue = dt_from_string( $issue->date_due() ); |
1520 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
1480 |
is (defined $issue->date_due(), 1, "item 1 checked out"); |
1521 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $itemnumber1 })->borrowernumber; |
1481 |
my $borrowing_borrowernumber = Koha::Checkouts->find({ itemnumber => $item_1->itemnumber })->borrowernumber; |
1522 |
|
1482 |
|
1523 |
my %reserving_borrower_data1 = ( |
1483 |
my %reserving_borrower_data1 = ( |
1524 |
firstname => 'Katrin', |
1484 |
firstname => 'Katrin', |
Lines 1547-1570
subtest 'MultipleReserves' => sub {
Link Here
|
1547 |
); |
1507 |
); |
1548 |
|
1508 |
|
1549 |
{ |
1509 |
{ |
1550 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber1, 1); |
1510 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber, 1); |
1551 |
is($renewokay, 0, 'Bug 17941 - should cover the case where 2 books are both reserved, so failing'); |
1511 |
is($renewokay, 0, 'Bug 17941 - should cover the case where 2 books are both reserved, so failing'); |
1552 |
} |
1512 |
} |
1553 |
|
1513 |
|
1554 |
my $barcode3 = 'R00110003'; |
1514 |
my $item_3 = $builder->build_sample_item( |
1555 |
my ( $item_bibnum3, $item_bibitemnum3, $itemnumber3 ) = AddItem( |
|
|
1556 |
{ |
1515 |
{ |
1557 |
homebranch => $branch, |
1516 |
biblionumber => $biblio->biblionumber, |
1558 |
holdingbranch => $branch, |
1517 |
library => $branch, |
1559 |
barcode => $barcode3, |
|
|
1560 |
replacementprice => 12.00, |
1518 |
replacementprice => 12.00, |
1561 |
itype => $itemtype |
1519 |
itype => $itemtype, |
1562 |
}, |
1520 |
} |
1563 |
$biblio->biblionumber |
|
|
1564 |
); |
1521 |
); |
1565 |
|
1522 |
|
1566 |
{ |
1523 |
{ |
1567 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber1, 1); |
1524 |
my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_1->itemnumber, 1); |
1568 |
is($renewokay, 1, 'Bug 17941 - should cover the case where 2 books are reserved, but a third one is available'); |
1525 |
is($renewokay, 1, 'Bug 17941 - should cover the case where 2 books are reserved, but a third one is available'); |
1569 |
} |
1526 |
} |
1570 |
}; |
1527 |
}; |
Lines 2015-2040
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2015 |
plan tests => 10; |
1972 |
plan tests => 10; |
2016 |
|
1973 |
|
2017 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
1974 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2018 |
my $barcode = 'KD123456789'; |
|
|
2019 |
|
1975 |
|
2020 |
my ( undef, undef, $item_id ) = AddItem( |
1976 |
my $item = $builder->build_sample_item( |
2021 |
{ homebranch => $library->branchcode, |
1977 |
{ |
2022 |
holdingbranch => $library->branchcode, |
1978 |
biblionumber => $biblio->biblionumber, |
2023 |
barcode => $barcode, |
1979 |
library => $library->branchcode, |
2024 |
replacementprice => $replacement_amount, |
1980 |
replacementprice => $replacement_amount, |
2025 |
itype => $item_type->itemtype |
1981 |
itype => $item_type->itemtype, |
2026 |
}, |
1982 |
} |
2027 |
$biblio->biblionumber |
|
|
2028 |
); |
1983 |
); |
2029 |
|
1984 |
|
2030 |
AddIssue( $patron->unblessed, $barcode ); |
1985 |
AddIssue( $patron->unblessed, $item->barcode ); |
2031 |
|
1986 |
|
2032 |
# Simulate item marked as lost |
1987 |
# Simulate item marked as lost |
2033 |
ModItem( { itemlost => 3 }, $biblio->biblionumber, $item_id ); |
1988 |
ModItem( { itemlost => 3 }, $biblio->biblionumber, $item->itemnumber ); |
2034 |
LostItem( $item_id, 1 ); |
1989 |
LostItem( $item->itemnumber, 1 ); |
2035 |
|
1990 |
|
2036 |
my $processing_fee_lines = Koha::Account::Lines->search( |
1991 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2037 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'PF' } ); |
1992 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } ); |
2038 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
1993 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2039 |
my $processing_fee_line = $processing_fee_lines->next; |
1994 |
my $processing_fee_line = $processing_fee_lines->next; |
2040 |
is( $processing_fee_line->amount + 0, |
1995 |
is( $processing_fee_line->amount + 0, |
Lines 2043-2049
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2043 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
1998 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2044 |
|
1999 |
|
2045 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2000 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2046 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'L' } ); |
2001 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } ); |
2047 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2002 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2048 |
my $lost_fee_line = $lost_fee_lines->next; |
2003 |
my $lost_fee_line = $lost_fee_lines->next; |
2049 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
2004 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
Lines 2061-2067
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2061 |
); |
2016 |
); |
2062 |
$credit->apply( { debits => $debts, offset_type => 'Writeoff' } ); |
2017 |
$credit->apply( { debits => $debts, offset_type => 'Writeoff' } ); |
2063 |
|
2018 |
|
2064 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item_id, $patron->id ); |
2019 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item->itemnumber, $patron->id ); |
2065 |
is( $credit_return_id, undef, 'No CR account line added' ); |
2020 |
is( $credit_return_id, undef, 'No CR account line added' ); |
2066 |
|
2021 |
|
2067 |
$lost_fee_line->discard_changes; # reload from DB |
2022 |
$lost_fee_line->discard_changes; # reload from DB |
Lines 2077-2102
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2077 |
plan tests => 12; |
2032 |
plan tests => 12; |
2078 |
|
2033 |
|
2079 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2034 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2080 |
my $barcode = 'KD123456790'; |
|
|
2081 |
|
2035 |
|
2082 |
my ( undef, undef, $item_id ) = AddItem( |
2036 |
my $item = $builder->build_sample_item( |
2083 |
{ homebranch => $library->branchcode, |
2037 |
{ |
2084 |
holdingbranch => $library->branchcode, |
2038 |
biblionumber => $biblio->biblionumber, |
2085 |
barcode => $barcode, |
2039 |
library => $library->branchcode, |
2086 |
replacementprice => $replacement_amount, |
2040 |
replacementprice => $replacement_amount, |
2087 |
itype => $item_type->itemtype |
2041 |
itype => $item_type->itemtype |
2088 |
}, |
2042 |
} |
2089 |
$biblio->biblionumber |
|
|
2090 |
); |
2043 |
); |
2091 |
|
2044 |
|
2092 |
AddIssue( $patron->unblessed, $barcode ); |
2045 |
AddIssue( $patron->unblessed, $item->barcode ); |
2093 |
|
2046 |
|
2094 |
# Simulate item marked as lost |
2047 |
# Simulate item marked as lost |
2095 |
ModItem( { itemlost => 1 }, $biblio->biblionumber, $item_id ); |
2048 |
ModItem( { itemlost => 1 }, $biblio->biblionumber, $item->itemnumber ); |
2096 |
LostItem( $item_id, 1 ); |
2049 |
LostItem( $item->itemnumber, 1 ); |
2097 |
|
2050 |
|
2098 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2051 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2099 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'PF' } ); |
2052 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } ); |
2100 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2053 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2101 |
my $processing_fee_line = $processing_fee_lines->next; |
2054 |
my $processing_fee_line = $processing_fee_lines->next; |
2102 |
is( $processing_fee_line->amount + 0, |
2055 |
is( $processing_fee_line->amount + 0, |
Lines 2105-2111
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2105 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2058 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2106 |
|
2059 |
|
2107 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2060 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2108 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'L' } ); |
2061 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } ); |
2109 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2062 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2110 |
my $lost_fee_line = $lost_fee_lines->next; |
2063 |
my $lost_fee_line = $lost_fee_lines->next; |
2111 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
2064 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
Lines 2123-2129
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2123 |
); |
2076 |
); |
2124 |
$credit->apply( { debits => $debts, offset_type => 'Payment' } ); |
2077 |
$credit->apply( { debits => $debts, offset_type => 'Payment' } ); |
2125 |
|
2078 |
|
2126 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item_id, $patron->id ); |
2079 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item->itemnumber, $patron->id ); |
2127 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2080 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2128 |
|
2081 |
|
2129 |
is( $credit_return->accounttype, 'CR', 'An account line of type CR is added' ); |
2082 |
is( $credit_return->accounttype, 'CR', 'An account line of type CR is added' ); |
Lines 2146-2171
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2146 |
plan tests => 12; |
2099 |
plan tests => 12; |
2147 |
|
2100 |
|
2148 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2101 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2149 |
my $barcode = 'KD123456791'; |
|
|
2150 |
|
2102 |
|
2151 |
my ( undef, undef, $item_id ) = AddItem( |
2103 |
my $item = $builder->build_sample_item( |
2152 |
{ homebranch => $library->branchcode, |
2104 |
{ |
2153 |
holdingbranch => $library->branchcode, |
2105 |
biblionumber => $biblio->biblionumber, |
2154 |
barcode => $barcode, |
2106 |
library => $library->branchcode, |
|
|
2107 |
replacementprice => 23.00, |
2155 |
replacementprice => $replacement_amount, |
2108 |
replacementprice => $replacement_amount, |
2156 |
itype => $item_type->itemtype |
2109 |
itype => $item_type->itemtype |
2157 |
}, |
2110 |
} |
2158 |
$biblio->biblionumber |
|
|
2159 |
); |
2111 |
); |
2160 |
|
2112 |
|
2161 |
AddIssue( $patron->unblessed, $barcode ); |
2113 |
AddIssue( $patron->unblessed, $item->barcode ); |
2162 |
|
2114 |
|
2163 |
# Simulate item marked as lost |
2115 |
# Simulate item marked as lost |
2164 |
ModItem( { itemlost => 3 }, $biblio->biblionumber, $item_id ); |
2116 |
ModItem( { itemlost => 3 }, $biblio->biblionumber, $item->itemnumber ); |
2165 |
LostItem( $item_id, 1 ); |
2117 |
LostItem( $item->itemnumber, 1 ); |
2166 |
|
2118 |
|
2167 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2119 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2168 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'PF' } ); |
2120 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } ); |
2169 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2121 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2170 |
my $processing_fee_line = $processing_fee_lines->next; |
2122 |
my $processing_fee_line = $processing_fee_lines->next; |
2171 |
is( $processing_fee_line->amount + 0, |
2123 |
is( $processing_fee_line->amount + 0, |
Lines 2174-2187
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2174 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2126 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2175 |
|
2127 |
|
2176 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2128 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2177 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'L' } ); |
2129 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } ); |
2178 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2130 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2179 |
my $lost_fee_line = $lost_fee_lines->next; |
2131 |
my $lost_fee_line = $lost_fee_lines->next; |
2180 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
2132 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
2181 |
is( $lost_fee_line->amountoutstanding + 0, |
2133 |
is( $lost_fee_line->amountoutstanding + 0, |
2182 |
$replacement_amount, 'The right L amountountstanding is generated' ); |
2134 |
$replacement_amount, 'The right L amountountstanding is generated' ); |
2183 |
|
2135 |
|
2184 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item_id, $patron->id ); |
2136 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item->itemnumber, $patron->id ); |
2185 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2137 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2186 |
|
2138 |
|
2187 |
is( $credit_return->accounttype, 'CR', 'An account line of type CR is added' ); |
2139 |
is( $credit_return->accounttype, 'CR', 'An account line of type CR is added' ); |
Lines 2200-2225
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2200 |
plan tests => 15; |
2152 |
plan tests => 15; |
2201 |
|
2153 |
|
2202 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2154 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
2203 |
my $barcode = 'KD123456792'; |
2155 |
my $item = $builder->build_sample_item( |
2204 |
|
2156 |
{ |
2205 |
my ( undef, undef, $item_id ) = AddItem( |
2157 |
biblionumber => $biblio->biblionumber, |
2206 |
{ homebranch => $library->branchcode, |
2158 |
library => $library->branchcode, |
2207 |
holdingbranch => $library->branchcode, |
|
|
2208 |
barcode => $barcode, |
2209 |
replacementprice => $replacement_amount, |
2159 |
replacementprice => $replacement_amount, |
2210 |
itype => $item_type->itemtype |
2160 |
itype => $item_type->itemtype |
2211 |
}, |
2161 |
} |
2212 |
$biblio->biblionumber |
|
|
2213 |
); |
2162 |
); |
2214 |
|
2163 |
|
2215 |
AddIssue( $patron->unblessed, $barcode ); |
2164 |
AddIssue( $patron->unblessed, $item->barcode ); |
2216 |
|
2165 |
|
2217 |
# Simulate item marked as lost |
2166 |
# Simulate item marked as lost |
2218 |
ModItem( { itemlost => 1 }, $biblio->biblionumber, $item_id ); |
2167 |
ModItem( { itemlost => 1 }, $biblio->biblionumber, $item->itemnumber ); |
2219 |
LostItem( $item_id, 1 ); |
2168 |
LostItem( $item->itemnumber, 1 ); |
2220 |
|
2169 |
|
2221 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2170 |
my $processing_fee_lines = Koha::Account::Lines->search( |
2222 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'PF' } ); |
2171 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } ); |
2223 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2172 |
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' ); |
2224 |
my $processing_fee_line = $processing_fee_lines->next; |
2173 |
my $processing_fee_line = $processing_fee_lines->next; |
2225 |
is( $processing_fee_line->amount + 0, |
2174 |
is( $processing_fee_line->amount + 0, |
Lines 2228-2234
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2228 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2177 |
$processfee_amount, 'The right PF amountoutstanding is generated' ); |
2229 |
|
2178 |
|
2230 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2179 |
my $lost_fee_lines = Koha::Account::Lines->search( |
2231 |
{ borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'L' } ); |
2180 |
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'L' } ); |
2232 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2181 |
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' ); |
2233 |
my $lost_fee_line = $lost_fee_lines->next; |
2182 |
my $lost_fee_line = $lost_fee_lines->next; |
2234 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
2183 |
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right L amount is generated' ); |
Lines 2266-2272
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2266 |
$lost_fee_line->discard_changes; |
2215 |
$lost_fee_line->discard_changes; |
2267 |
my $outstanding = $lost_fee_line->amountoutstanding; |
2216 |
my $outstanding = $lost_fee_line->amountoutstanding; |
2268 |
|
2217 |
|
2269 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item_id, $patron->id ); |
2218 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item->itemnumber, $patron->id ); |
2270 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2219 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2271 |
|
2220 |
|
2272 |
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PF - payment (CR)' ); |
2221 |
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PF - payment (CR)' ); |
Lines 2298-2315
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
2298 |
|
2247 |
|
2299 |
my $biblio = $builder->build_sample_biblio({ author => 'Hall, Kylie' }); |
2248 |
my $biblio = $builder->build_sample_biblio({ author => 'Hall, Kylie' }); |
2300 |
|
2249 |
|
2301 |
my $barcode = 'KD987654321'; |
|
|
2302 |
my $branchcode = $library2->{branchcode}; |
2250 |
my $branchcode = $library2->{branchcode}; |
2303 |
|
2251 |
|
2304 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( |
2252 |
my $item = $builder->build_sample_item( |
2305 |
{ |
2253 |
{ |
2306 |
homebranch => $branchcode, |
2254 |
biblionumber => $biblio->biblionumber, |
2307 |
holdingbranch => $branchcode, |
2255 |
library => $branchcode, |
2308 |
barcode => $barcode, |
|
|
2309 |
replacementprice => 99.00, |
2256 |
replacementprice => 99.00, |
2310 |
itype => $itemtype |
2257 |
itype => $itemtype, |
2311 |
}, |
2258 |
} |
2312 |
$biblio->biblionumber |
|
|
2313 |
); |
2259 |
); |
2314 |
|
2260 |
|
2315 |
my $patron = $builder->build( { source => 'Borrower' } ); |
2261 |
my $patron = $builder->build( { source => 'Borrower' } ); |
Lines 2319-2332
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
2319 |
{ |
2265 |
{ |
2320 |
borrowernumber => $patron->{borrowernumber}, |
2266 |
borrowernumber => $patron->{borrowernumber}, |
2321 |
accounttype => 'FU', |
2267 |
accounttype => 'FU', |
2322 |
itemnumber => $itemnumber, |
2268 |
itemnumber => $item->itemnumber, |
2323 |
amount => 99.00, |
2269 |
amount => 99.00, |
2324 |
amountoutstanding => 99.00, |
2270 |
amountoutstanding => 99.00, |
2325 |
lastincrement => 9.00, |
2271 |
lastincrement => 9.00, |
2326 |
} |
2272 |
} |
2327 |
)->store(); |
2273 |
)->store(); |
2328 |
|
2274 |
|
2329 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $itemnumber ); |
2275 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber ); |
2330 |
|
2276 |
|
2331 |
$accountline->_result()->discard_changes(); |
2277 |
$accountline->_result()->discard_changes(); |
2332 |
|
2278 |
|
Lines 2342-2348
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
2342 |
} |
2288 |
} |
2343 |
)->store(); |
2289 |
)->store(); |
2344 |
|
2290 |
|
2345 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $itemnumber, 1 ); |
2291 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 1 ); |
2346 |
|
2292 |
|
2347 |
$accountline->_result()->discard_changes(); |
2293 |
$accountline->_result()->discard_changes(); |
2348 |
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next(); |
2294 |
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next(); |
Lines 2360-2366
subtest '_FixOverduesOnReturn' => sub {
Link Here
|
2360 |
} |
2306 |
} |
2361 |
)->store(); |
2307 |
)->store(); |
2362 |
|
2308 |
|
2363 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $itemnumber, 0, 1 ); |
2309 |
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $item->itemnumber, 0, 1 ); |
2364 |
|
2310 |
|
2365 |
$accountline->_result()->discard_changes(); |
2311 |
$accountline->_result()->discard_changes(); |
2366 |
$offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Dropbox' })->next(); |
2312 |
$offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Dropbox' })->next(); |