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 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]; |
543 |
my ( $unseen_reset ) = ( C4::Circulation::GetRenewCount( $unseen_patron->borrowernumber, $unseen_item->itemnumber ) )[3]; |
544 |
is( $unseen_reset, 0, 'seen renewal resets the unseen count' ); |
544 |
is( $unseen_reset, 0, 'seen renewal resets the unseen count' ); |
545 |
|
545 |
|
|
|
546 |
# Bug 21159 - Update item shelving location on checkout |
547 |
my $itemnumber4 = Koha::Item->new( |
548 |
{ |
549 |
biblionumber => $biblionumber, |
550 |
barcode => 'barcode_6', |
551 |
itemcallnumber => 'callnumber3', |
552 |
homebranch => $branchcode_1, |
553 |
holdingbranch => $branchcode_1, |
554 |
location => 'FIC', |
555 |
itype => $itemtype |
556 |
}, |
557 |
)->store->itemnumber; |
558 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); |
559 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); |
560 |
AddIssue( $borrower_1, 'barcode_6'); |
561 |
my $item4 = Koha::Items->find( $itemnumber4 ); |
562 |
ok( $item4->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' ); |
563 |
|
564 |
#--- |
565 |
AddReturn( 'barcode_6', $branchcode_1 ); |
566 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' ); |
567 |
$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
568 |
AddIssue( $borrower_1, 'barcode_6' ); |
569 |
$item4 = Koha::Items->find( $itemnumber4 ); |
570 |
is( $item4->location, 'GEN', q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
571 |
is( $item4->permanent_location, 'GEN', q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
572 |
$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
573 |
is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged"); |
574 |
AddReturn( 'barcode_6', $branchcode_1 ); |
575 |
AddIssue( $borrower_1, 'barcode_6' ); |
576 |
$item4 = Koha::Items->find( $itemnumber4 ); |
577 |
ok( $item4->location eq 'GEN', q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"} ); |
578 |
|
579 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); |
580 |
AddReturn( 'barcode_6', $branchcode_1 ); |
581 |
AddIssue( $borrower_1, 'barcode_6' ); |
582 |
$item4 = Koha::Items->find( $itemnumber4 ); |
583 |
ok( $item4->location eq 'CART', q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"} ); |
584 |
ok( $item4->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); |
585 |
|
586 |
$item4->location('GEN')->store; |
587 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); |
588 |
AddReturn( 'barcode_6', $branchcode_1 ); |
589 |
AddIssue( $borrower_1, 'barcode_6' ); |
590 |
$item4 = Koha::Items->find( $itemnumber4 ); |
591 |
ok( $item4->location eq '', q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); |
592 |
AddReturn( 'barcode_6', $branchcode_1 ); |
593 |
AddIssue( $borrower_1, 'barcode_6' ); |
594 |
$item4 = Koha::Items->find( $itemnumber4 ); |
595 |
ok( $item4->location eq 'PROC' , q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
596 |
ok( $item4->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
597 |
AddReturn( 'barcode_6', $branchcode_1 ); |
598 |
AddIssue( $borrower_1, 'barcode_6' ); |
599 |
$item4 = Koha::Items->find( $itemnumber4 ); |
600 |
ok( $item4->location eq '' , q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); |
601 |
ok( $item4->permanent_location eq '' , q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" } ); |
602 |
|
603 |
# Bug 28472 |
604 |
my $itemnumber5 = Koha::Item->new( |
605 |
{ |
606 |
biblionumber => $biblionumber, |
607 |
barcode => 'barcode_7', |
608 |
itemcallnumber => 'callnumber5', |
609 |
homebranch => $branchcode_1, |
610 |
holdingbranch => $branchcode_1, |
611 |
location => undef, |
612 |
itype => $itemtype |
613 |
} |
614 |
)->store->itemnumber; |
615 |
|
616 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); |
617 |
AddIssue( $borrower_1, 'barcode_7' ); |
618 |
my $item5 = Koha::Items->find( $itemnumber5 ); |
619 |
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"} ); |
620 |
|
621 |
|
546 |
#End transaction |
622 |
#End transaction |
547 |
$schema->storage->txn_rollback; |
623 |
$schema->storage->txn_rollback; |
548 |
- |
|
|