Bug 10694: (follow-up) add unit tests, improve AddReturn POD
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
892111c84d
commit
0b2e9dbf62
|
|
@ -1634,7 +1634,7 @@ sub GetBranchItemRule {
|
|||
=head2 AddReturn
|
||||
|
||||
($doreturn, $messages, $iteminformation, $borrower) =
|
||||
&AddReturn($barcode, $branch, $exemptfine, $dropbox, $returndate);
|
||||
&AddReturn( $barcode, $branch [,$exemptfine] [,$dropbox] [,$returndate] );
|
||||
|
||||
Returns a book.
|
||||
|
||||
|
|
@ -1645,16 +1645,16 @@ Returns a book.
|
|||
=item C<$branch> is the code of the branch where the book is being returned.
|
||||
|
||||
=item C<$exemptfine> indicates that overdue charges for the item will be
|
||||
removed.
|
||||
removed. Optional.
|
||||
|
||||
=item C<$dropbox> indicates that the check-in date is assumed to be
|
||||
yesterday, or the last non-holiday as defined in C4::Calendar . If
|
||||
overdue charges are applied and C<$dropbox> is true, the last charge
|
||||
will be removed. This assumes that the fines accrual script has run
|
||||
for _today_.
|
||||
for _today_. Optional.
|
||||
|
||||
=item C<$return_date> allows the default return date to be overridden
|
||||
by the given return date.
|
||||
by the given return date. Optional.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use C4::Circulation;
|
|||
use C4::Items;
|
||||
use C4::Context;
|
||||
|
||||
use Test::More tests => 25;
|
||||
use Test::More tests => 27;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Circulation');
|
||||
|
|
@ -331,6 +331,16 @@ is_deeply(
|
|||
"With issuing rules (renewal allowed, 1 remaining) and with a valid parameter, Getrenewcount of item1 returns 0 renews left"
|
||||
);
|
||||
|
||||
$dbh->do("TRUNCATE TABLE old_issues");
|
||||
AddReturn('barcode_1');
|
||||
my $return = $dbh->selectrow_hashref("SELECT DATE(returndate) AS return_date, CURRENT_DATE() AS today FROM old_issues LIMIT 1" );
|
||||
ok( $return->{return_date} eq $return->{today}, "Item returned with no return date specified has todays date" );
|
||||
|
||||
$dbh->do("TRUNCATE TABLE old_issues");
|
||||
C4::Circulation::AddIssue( $borrower_1, 'barcode_1', $daysago10, 0, $today );
|
||||
AddReturn('barcode_1', undef, undef, undef, '2014-04-01 23:42');
|
||||
$return = $dbh->selectrow_hashref("SELECT * FROM old_issues LIMIT 1" );
|
||||
ok( $return->{returndate} eq '2014-04-01 23:42:00', "Item returned with a return date of '2014-04-01 23:42' has that return date" );
|
||||
|
||||
#End transaction
|
||||
$dbh->rollback;
|
||||
|
|
|
|||
Loading…
Reference in New Issue