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