Lines 15-21
use C4::Bookseller;
Link Here
|
15 |
use C4::Biblio; |
15 |
use C4::Biblio; |
16 |
use C4::Budgets; |
16 |
use C4::Budgets; |
17 |
use Koha::DateUtils; |
17 |
use Koha::DateUtils; |
18 |
use Test::More tests => 49; |
18 |
use Test::More tests => 48; |
19 |
|
19 |
|
20 |
BEGIN { |
20 |
BEGIN { |
21 |
use_ok('C4::Serials'); |
21 |
use_ok('C4::Serials'); |
Lines 248-267
for my $am ( @arrived_missing ) {
Link Here
|
248 |
} |
248 |
} |
249 |
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); |
249 |
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); |
250 |
|
250 |
|
251 |
my ( $expected_serial ) = GetSerials2( $subscriptionid, [1] ); |
251 |
subtest "Do not generate an expected if one already exists" => sub { |
252 |
#Find serialid for serial with status Expected |
252 |
plan tests => 2; |
253 |
my $serialexpected = (C4::Serials::findSerialsByStatus(1,$subscriptionid))[0]; |
253 |
my ($expected_serial) = GetSerials2( $subscriptionid, [1] ); |
254 |
#delete serial with status Expected |
254 |
|
255 |
C4::Serials::ModSerialStatus( $serialexpected->{serialid},$serialexpected->{serialseq},$publisheddate,$publisheddate, $publisheddate,'1','an useless note'); |
255 |
#Find serialid for serial with status Expected |
256 |
@serialsByStatus = C4::Serials::findSerialsByStatus(1,$subscriptionid); |
256 |
my $serialexpected = ( C4::Serials::findSerialsByStatus( 1, $subscriptionid ) )[0]; |
257 |
is (@serialsByStatus,1,"ModSerialStatus delete corectly serial expected and create another if not exist"); |
257 |
|
258 |
# add 1 serial with status=Expected 1 |
258 |
#delete serial with status Expected |
259 |
C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); |
259 |
C4::Serials::ModSerialStatus( $serialexpected->{serialid}, $serialexpected->{serialseq}, $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); |
260 |
#Now we have two serials it have status expected |
260 |
@serialsByStatus = C4::Serials::findSerialsByStatus( 1, $subscriptionid ); |
261 |
#put status delete for last serial |
261 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and create another if not exist" ); |
262 |
C4::Serials::ModSerialStatus( $serialexpected->{serialid},$serialexpected->{serialseq},$publisheddate,$publisheddate, $publisheddate,'1','an useless note'); |
262 |
|
263 |
#try if create or note another serial with status is expected |
263 |
# add 1 serial with status=Expected 1 |
264 |
@serialsByStatus = C4::Serials::findSerialsByStatus(1,$subscriptionid); |
264 |
C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); |
265 |
is(@serialsByStatus,1,"ModSerialStatus delete corectly serial expected and not create another if exist"); |
265 |
|
|
|
266 |
#Now we have two serials it have status expected |
267 |
#put status delete for last serial |
268 |
C4::Serials::ModSerialStatus( $serialexpected->{serialid}, $serialexpected->{serialseq}, $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); |
269 |
|
270 |
#try if create or not another serial with status is expected |
271 |
@serialsByStatus = C4::Serials::findSerialsByStatus( 1, $subscriptionid ); |
272 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); |
273 |
}; |
266 |
|
274 |
|
267 |
$dbh->rollback; |
275 |
$dbh->rollback; |
268 |
- |
|
|