Lines 1827-1833
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
1827 |
}; |
1827 |
}; |
1828 |
|
1828 |
|
1829 |
subtest '_FixAccountForLostAndReturned' => sub { |
1829 |
subtest '_FixAccountForLostAndReturned' => sub { |
1830 |
plan tests => 2; |
1830 |
plan tests => 8; |
1831 |
|
1831 |
|
1832 |
# Generate test biblio |
1832 |
# Generate test biblio |
1833 |
my $title = 'Koha for Dummies'; |
1833 |
my $title = 'Koha for Dummies'; |
Lines 1865-1870
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
1865 |
|
1865 |
|
1866 |
is( $accountline->amountoutstanding, '0.000000', 'Lost fee has no outstanding amount' ); |
1866 |
is( $accountline->amountoutstanding, '0.000000', 'Lost fee has no outstanding amount' ); |
1867 |
is( $accountline->accounttype, 'LR', 'Lost fee now has account type of LR ( Lost Returned )'); |
1867 |
is( $accountline->accounttype, 'LR', 'Lost fee now has account type of LR ( Lost Returned )'); |
|
|
1868 |
|
1869 |
# Tests for only if unpaid |
1870 |
## Unpaid |
1871 |
$accountline->delete(); |
1872 |
$accountline = Koha::Account::Line->new( |
1873 |
{ |
1874 |
borrowernumber => $patron->{borrowernumber}, |
1875 |
accounttype => 'L', |
1876 |
itemnumber => $itemnumber, |
1877 |
amount => 99.00, |
1878 |
amountoutstanding => 99.00, |
1879 |
} |
1880 |
)->store(); |
1881 |
|
1882 |
C4::Circulation::_FixAccountForLostAndReturned( $itemnumber, $patron->{borrowernumber}, undef, 1 ); |
1883 |
|
1884 |
$accountline->_result()->discard_changes(); |
1885 |
|
1886 |
is( $accountline->amountoutstanding, '0.000000', 'Lost fee has no outstanding amount, with skip_paid = 1 and unpaid' ); |
1887 |
is( $accountline->accounttype, 'LR', 'Lost fee now has account type of LR ( Lost Returned ), with skip_paid = 1 and unpaid'); |
1888 |
|
1889 |
## Paid |
1890 |
$accountline->delete(); |
1891 |
$accountline = Koha::Account::Line->new( |
1892 |
{ |
1893 |
borrowernumber => $patron->{borrowernumber}, |
1894 |
accounttype => 'L', |
1895 |
itemnumber => $itemnumber, |
1896 |
amount => 99.00, |
1897 |
amountoutstanding => 0.00, |
1898 |
} |
1899 |
)->store(); |
1900 |
|
1901 |
C4::Circulation::_FixAccountForLostAndReturned( $itemnumber, $patron->{borrowernumber}, undef, 1 ); |
1902 |
|
1903 |
$accountline->_result()->discard_changes(); |
1904 |
|
1905 |
is( $accountline->amountoutstanding, '0.000000', 'Lost fee still has outstanding amount of 0, with skip_paid = 1 and already paid' ); |
1906 |
is( $accountline->accounttype, 'L', 'Lost fee now has account type of L ( Lost ), with skip_paid = 1 and already paid'); |
1907 |
|
1908 |
## Partially paid |
1909 |
$accountline->delete(); |
1910 |
$accountline = Koha::Account::Line->new( |
1911 |
{ |
1912 |
borrowernumber => $patron->{borrowernumber}, |
1913 |
accounttype => 'L', |
1914 |
itemnumber => $itemnumber, |
1915 |
amount => 99.00, |
1916 |
amountoutstanding => 33.00, |
1917 |
} |
1918 |
)->store(); |
1919 |
|
1920 |
C4::Circulation::_FixAccountForLostAndReturned( $itemnumber, $patron->{borrowernumber}, undef, 1 ); |
1921 |
|
1922 |
$accountline->_result()->discard_changes(); |
1923 |
|
1924 |
is( $accountline->amountoutstanding, '0.000000', 'Lost fee has no outstanding amount, with skip_paid = 1 and partially paid' ); |
1925 |
is( $accountline->accounttype, 'LR', 'Lost fee now has account type of L ( Lost ), with skip_paid = 1 and partially paid'); |
1868 |
}; |
1926 |
}; |
1869 |
|
1927 |
|
1870 |
subtest '_FixOverduesOnReturn' => sub { |
1928 |
subtest '_FixOverduesOnReturn' => sub { |