Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
|
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it |
6 |
# under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 3 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but |
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
3 |
use Modern::Perl; |
18 |
use Modern::Perl; |
|
|
19 |
|
4 |
use Koha::DateUtils; |
20 |
use Koha::DateUtils; |
5 |
use DateTime::Duration; |
21 |
use DateTime::Duration; |
6 |
use C4::Biblio; |
22 |
use C4::Biblio; |
Lines 193-208
my $sth = $dbh->prepare($query);
Link Here
|
193 |
$sth->execute; |
209 |
$sth->execute; |
194 |
my $countissue = $sth -> fetchrow_array; |
210 |
my $countissue = $sth -> fetchrow_array; |
195 |
is ($countissue ,0, "there is no issue"); |
211 |
is ($countissue ,0, "there is no issue"); |
196 |
my $datedue1 = C4::Circulation::AddIssue( $borrower_1, 'barcode_1', $daysago10,0, $today, '' ); |
212 |
my $issue1 = C4::Circulation::AddIssue( $borrower_1, 'barcode_1', $daysago10,0, $today, '' ); |
|
|
213 |
is( ref $issue1, 'Koha::Schema::Result::Issue', |
214 |
'AddIssue returns a Koha::Schema::Result::Issue object' ); |
215 |
my $datedue1 = dt_from_string( $issue1->date_due() ); |
197 |
like( |
216 |
like( |
198 |
$datedue1, |
217 |
$datedue1, |
199 |
qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/, |
218 |
qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/, |
200 |
"AddRenewal returns a date" |
219 |
"Koha::Schema::Result::Issue->date_due() returns a date" |
201 |
); |
220 |
); |
202 |
my $issue_id1 = $dbh->last_insert_id( undef, undef, 'issues', undef ); |
221 |
my $issue_id1 = $dbh->last_insert_id( undef, undef, 'issues', undef ); |
203 |
|
222 |
|
204 |
my $datedue2 = C4::Circulation::AddIssue( $borrower_1, 'nonexistent_barcode' ); |
223 |
my $issue2 = C4::Circulation::AddIssue( $borrower_1, 'nonexistent_barcode' ); |
205 |
is( $datedue2, undef, "AddIssue returns undef if no datedue is specified" ); |
224 |
is( $issue2, undef, "AddIssue returns undef if no datedue is specified" ); |
206 |
my $issue_id2 = $dbh->last_insert_id( undef, undef, 'issues', undef ); |
225 |
my $issue_id2 = $dbh->last_insert_id( undef, undef, 'issues', undef ); |
207 |
|
226 |
|
208 |
$sth->execute; |
227 |
$sth->execute; |
Lines 252-259
my $openissue = GetOpenIssue($borrower_id1, $item_id1);
Link Here
|
252 |
|
271 |
|
253 |
my @renewcount; |
272 |
my @renewcount; |
254 |
#Test GetRenewCount |
273 |
#Test GetRenewCount |
255 |
$datedue2 = C4::Circulation::AddIssue( $borrower_1, 'barcode_1' ); |
274 |
my $issue3 = C4::Circulation::AddIssue( $borrower_1, 'barcode_1' ); |
256 |
isnt( $datedue2, undef, "AddIssue does not return undef if datedue is specified" ); |
|
|
257 |
#Without anything in DB |
275 |
#Without anything in DB |
258 |
@renewcount = C4::Circulation::GetRenewCount(); |
276 |
@renewcount = C4::Circulation::GetRenewCount(); |
259 |
is_deeply( |
277 |
is_deeply( |
260 |
- |
|
|