|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 95; |
20 |
use Test::More tests => 96; |
| 21 |
|
21 |
|
| 22 |
use DateTime; |
22 |
use DateTime; |
| 23 |
|
23 |
|
|
Lines 72-77
my $borrower = {
Link Here
|
| 72 |
branchcode => $library2->{branchcode} |
72 |
branchcode => $library2->{branchcode} |
| 73 |
}; |
73 |
}; |
| 74 |
|
74 |
|
|
|
75 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
| 76 |
|
| 75 |
# No userenv, PickupLibrary |
77 |
# No userenv, PickupLibrary |
| 76 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
78 |
t::lib::Mocks::mock_preference('IndependentBranches', '0'); |
| 77 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
79 |
t::lib::Mocks::mock_preference('CircControl', 'PickupLibrary'); |
|
Lines 1631-1636
subtest 'AddReturn + CumulativeRestrictionPeriods' => sub {
Link Here
|
| 1631 |
is( $debarments->[0]->{expiration}, $expected_expiration ); |
1633 |
is( $debarments->[0]->{expiration}, $expected_expiration ); |
| 1632 |
}; |
1634 |
}; |
| 1633 |
|
1635 |
|
|
|
1636 |
subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { |
| 1637 |
plan tests => 2; |
| 1638 |
|
| 1639 |
my $library = $builder->build( { source => 'Branch' } ); |
| 1640 |
my $patron1 = $builder->build( |
| 1641 |
{ |
| 1642 |
source => 'Borrower', |
| 1643 |
value => { |
| 1644 |
branchcode => $library->{branchcode}, |
| 1645 |
} |
| 1646 |
} |
| 1647 |
); |
| 1648 |
my $patron2 = $builder->build( |
| 1649 |
{ |
| 1650 |
source => 'Borrower', |
| 1651 |
value => { |
| 1652 |
branchcode => $library->{branchcode}, |
| 1653 |
} |
| 1654 |
} |
| 1655 |
); |
| 1656 |
|
| 1657 |
C4::Context->_new_userenv('xxx'); |
| 1658 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Random Library', '', '', ''); |
| 1659 |
|
| 1660 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
| 1661 |
my $biblionumber = $biblioitem->{biblionumber}; |
| 1662 |
my $item = $builder->build( |
| 1663 |
{ source => 'Item', |
| 1664 |
value => { |
| 1665 |
homebranch => $library->{branchcode}, |
| 1666 |
holdingbranch => $library->{branchcode}, |
| 1667 |
notforloan => 0, |
| 1668 |
itemlost => 0, |
| 1669 |
withdrawn => 0, |
| 1670 |
biblionumber => $biblionumber, |
| 1671 |
} |
| 1672 |
} |
| 1673 |
); |
| 1674 |
|
| 1675 |
my ( $error, $question, $alerts ); |
| 1676 |
my $issue = AddIssue( $patron1, $item->{barcode} ); |
| 1677 |
|
| 1678 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
| 1679 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
| 1680 |
is( $question->{ISSUED_TO_ANOTHER}, 1, 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another' ); |
| 1681 |
|
| 1682 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 1); |
| 1683 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron2, $item->{barcode} ); |
| 1684 |
is( $alerts->{RETURNED_FROM_ANOTHER}->{patron}->{borrowernumber}, $patron1->{borrowernumber}, 'RETURNED_FROM_ANOTHER alert flag should be set if AutoReturnCheckedOutItems is enabled and item is checked out to another' ); |
| 1685 |
|
| 1686 |
t::lib::Mocks::mock_preference('AutoReturnCheckedOutItems', 0); |
| 1687 |
}; |
| 1688 |
|
| 1634 |
sub set_userenv { |
1689 |
sub set_userenv { |
| 1635 |
my ( $library ) = @_; |
1690 |
my ( $library ) = @_; |
| 1636 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
1691 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
| 1637 |
- |
|
|