Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 98; |
20 |
use Test::More tests => 99; |
21 |
|
21 |
|
22 |
use DateTime; |
22 |
use DateTime; |
23 |
|
23 |
|
Lines 1716-1721
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
1716 |
|
1716 |
|
1717 |
}; |
1717 |
}; |
1718 |
|
1718 |
|
|
|
1719 |
subtest 'AddReturn | is_overdue' => sub { |
1720 |
plan tests => 3; |
1721 |
|
1722 |
# Set a simple circ policy |
1723 |
$dbh->do('DELETE FROM issuingrules'); |
1724 |
$dbh->do( |
1725 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, |
1726 |
maxissueqty, issuelength, lengthunit, |
1727 |
renewalsallowed, renewalperiod, |
1728 |
norenewalbefore, auto_renew, |
1729 |
fine, chargeperiod) |
1730 |
VALUES (?, ?, ?, ?, |
1731 |
?, ?, ?, |
1732 |
?, ?, |
1733 |
?, ?, |
1734 |
?, ? |
1735 |
) |
1736 |
}, |
1737 |
{}, |
1738 |
'*', '*', '*', 25, |
1739 |
1, 14, 'days', |
1740 |
1, 7, |
1741 |
undef, 0, |
1742 |
.10, 1 |
1743 |
); |
1744 |
my $five_days_go = output_pref({ dt => dt_from_string->add( days => 5 ), dateonly => 1}); |
1745 |
my $ten_days_go = output_pref({ dt => dt_from_string->add( days => 10), dateonly => 1 }); |
1746 |
my $library = $builder->build( { source => 'Branch' } ); |
1747 |
my $patron = $builder->build( { source => 'Borrower' } ); |
1748 |
|
1749 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
1750 |
my $item = $builder->build( |
1751 |
{ |
1752 |
source => 'Item', |
1753 |
value => { |
1754 |
homebranch => $library->{branchcode}, |
1755 |
holdingbranch => $library->{branchcode}, |
1756 |
notforloan => 0, |
1757 |
itemlost => 0, |
1758 |
withdrawn => 0, |
1759 |
biblionumber => $biblioitem->{biblionumber}, |
1760 |
} |
1761 |
} |
1762 |
); |
1763 |
my $issue = AddIssue( $patron, $item->{barcode}, $five_days_go ); # date due was 10d ago |
1764 |
my $actualissue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } ); |
1765 |
is( output_pref({ str => $actualissue->date_due, dateonly => 1}), $five_days_go, "First issue works"); |
1766 |
my ($issuingimpossible, $needsconfirmation) = CanBookBeIssued($patron,$item->{barcode},$ten_days_go, undef, undef, undef); |
1767 |
is( $needsconfirmation->{RENEW_ISSUE}, 1, "This is a renewal"); |
1768 |
is( $needsconfirmation->{TOO_MANY}, undef, "Not too many, is a renewal"); |
1769 |
|
1770 |
}; |
1771 |
|
1719 |
sub set_userenv { |
1772 |
sub set_userenv { |
1720 |
my ( $library ) = @_; |
1773 |
my ( $library ) = @_; |
1721 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
1774 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
1722 |
- |
|
|