Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 50; |
20 |
use Test::More tests => 63; |
21 |
use DateTime::Duration; |
21 |
use DateTime::Duration; |
22 |
|
22 |
|
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 493-500
AddReturn( 'barcode_5', $branchcode_1 );
Link Here
|
493 |
my $item3 = Koha::Items->find( $itemnumber3 ); |
493 |
my $item3 = Koha::Items->find( $itemnumber3 ); |
494 |
is( $item3->location, 'CART', q{UpdateItemLocationOnCheckin updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} ); |
494 |
is( $item3->location, 'CART', q{UpdateItemLocationOnCheckin updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} ); |
495 |
|
495 |
|
496 |
|
|
|
497 |
|
498 |
# Bug 14640 - Cancel the hold on checking out if asked |
496 |
# Bug 14640 - Cancel the hold on checking out if asked |
499 |
my $reserve_id = AddReserve( |
497 |
my $reserve_id = AddReserve( |
500 |
{ |
498 |
{ |
Lines 543-547
AddRenewal( $unseen_patron->borrowernumber, $unseen_item->itemnumber, $branchcod
Link Here
|
543 |
my ( $unseen_reset ) = ( C4::Circulation::GetRenewCount( $unseen_patron->borrowernumber, $unseen_item->itemnumber ) )[3]; |
541 |
my ( $unseen_reset ) = ( C4::Circulation::GetRenewCount( $unseen_patron->borrowernumber, $unseen_item->itemnumber ) )[3]; |
544 |
is( $unseen_reset, 0, 'seen renewal resets the unseen count' ); |
542 |
is( $unseen_reset, 0, 'seen renewal resets the unseen count' ); |
545 |
|
543 |
|
|
|
544 |
# Bug 21159 - Update item shelving location on checkout |
545 |
my $itemnumber4 = Koha::Item->new( |
546 |
{ |
547 |
biblionumber => $biblionumber, |
548 |
barcode => 'barcode_6', |
549 |
itemcallnumber => 'callnumber3', |
550 |
homebranch => $branchcode_1, |
551 |
holdingbranch => $branchcode_1, |
552 |
location => 'FIC', |
553 |
itype => $itemtype |
554 |
}, |
555 |
)->store->itemnumber; |
556 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); |
557 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); |
558 |
AddIssue( $borrower_1, 'barcode_6'); |
559 |
my $item4 = Koha::Items->find( $itemnumber4 ); |
560 |
ok( $item4->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' ); |
561 |
|
562 |
#--- |
563 |
AddReturn( 'barcode_6', $branchcode_1 ); |
564 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' ); |
565 |
$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
566 |
AddIssue( $borrower_1, 'barcode_6' ); |
567 |
$item4 = Koha::Items->find( $itemnumber4 ); |
568 |
is( $item4->location, 'GEN', q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
569 |
is( $item4->permanent_location, 'GEN', q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
570 |
$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
571 |
is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged"); |
572 |
AddReturn( 'barcode_6', $branchcode_1 ); |
573 |
AddIssue( $borrower_1, 'barcode_6' ); |
574 |
$item4 = Koha::Items->find( $itemnumber4 ); |
575 |
ok( $item4->location eq 'GEN', q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"} ); |
576 |
|
577 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); |
578 |
AddReturn( 'barcode_6', $branchcode_1 ); |
579 |
AddIssue( $borrower_1, 'barcode_6' ); |
580 |
$item4 = Koha::Items->find( $itemnumber4 ); |
581 |
ok( $item4->location eq 'CART', q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"} ); |
582 |
ok( $item4->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); |
583 |
|
584 |
$item4->location('GEN')->store; |
585 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); |
586 |
AddReturn( 'barcode_6', $branchcode_1 ); |
587 |
AddIssue( $borrower_1, 'barcode_6' ); |
588 |
$item4 = Koha::Items->find( $itemnumber4 ); |
589 |
ok( $item4->location eq '', q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); |
590 |
AddReturn( 'barcode_6', $branchcode_1 ); |
591 |
AddIssue( $borrower_1, 'barcode_6' ); |
592 |
$item4 = Koha::Items->find( $itemnumber4 ); |
593 |
ok( $item4->location eq 'PROC' , q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
594 |
ok( $item4->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
595 |
AddReturn( 'barcode_6', $branchcode_1 ); |
596 |
AddIssue( $borrower_1, 'barcode_6' ); |
597 |
$item4 = Koha::Items->find( $itemnumber4 ); |
598 |
ok( $item4->location eq '' , q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); |
599 |
ok( $item4->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" } ); |
600 |
|
601 |
# Bug 28472 |
602 |
my $itemnumber5 = Koha::Item->new( |
603 |
{ |
604 |
biblionumber => $biblionumber, |
605 |
barcode => 'barcode_7', |
606 |
itemcallnumber => 'callnumber5', |
607 |
homebranch => $branchcode_1, |
608 |
holdingbranch => $branchcode_1, |
609 |
location => undef, |
610 |
itype => $itemtype |
611 |
} |
612 |
)->store->itemnumber; |
613 |
|
614 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); |
615 |
AddIssue( $borrower_1, 'barcode_7' ); |
616 |
my $item5 = Koha::Items->find( $itemnumber5 ); |
617 |
is( $item5->location, 'CART', q{UpdateItemLocationOnCheckout updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} ); |
618 |
|
619 |
|
546 |
#End transaction |
620 |
#End transaction |
547 |
$schema->storage->txn_rollback; |
621 |
$schema->storage->txn_rollback; |
548 |
- |
|
|