View | Details | Raw Unified | Return to bug 22188
Collapse All | Expand All

(-)a/C4/Serials.pm (-1 / +1 lines)
Lines 936-942 the sequence in string format Link Here
936
sub GetSeq {
936
sub GetSeq {
937
    my ($subscription, $pattern) = @_;
937
    my ($subscription, $pattern) = @_;
938
938
939
    if ($pattern->{numberingmethod} eq ''){
939
    if ( !defined($pattern->{numberingmethod}) ){
940
        return "pubdate";
940
        return "pubdate";
941
    }
941
    }
942
942
(-)a/t/db_dependent/Serials.t (-1 / +2 lines)
Lines 229-235 is(C4::Serials::GetLatestSerials(), undef, 'test getting lastest serials'); Link Here
229
229
230
is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing');
230
is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing');
231
231
232
is(C4::Serials::GetSeq(), undef, 'test getting seq when you enter nothing');
232
is(C4::Serials::GetSeq(), 'pubdate', 'test getting seq when you enter nothing');
233
# no input means assume using publication date as numbering pattern
233
234
234
is(C4::Serials::CountSubscriptionFromBiblionumber(), undef, 'test counting subscription when nothing is entered');
235
is(C4::Serials::CountSubscriptionFromBiblionumber(), undef, 'test counting subscription when nothing is entered');
235
236
(-)a/t/db_dependent/Serials_2.t (-2 / +36 lines)
Lines 1-13 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
use Modern::Perl;
2
use Modern::Perl;
3
3
4
use Test::More tests => 50;
4
use Test::More tests => 52;
5
5
6
use MARC::Record;
6
use MARC::Record;
7
7
8
use C4::Biblio qw( AddBiblio );
8
use C4::Biblio qw( AddBiblio );
9
use Koha::Database;
9
use Koha::Database;
10
use Koha::Patrons;
10
use Koha::Patrons;
11
use Koha::DateUtils qw( dt_from_string );
11
use t::lib::Mocks;
12
use t::lib::Mocks;
12
use t::lib::TestBuilder;
13
use t::lib::TestBuilder;
13
use_ok('C4::Serials', qw( NewSubscription GetSubscription NewIssue GetPreviousSerialid ));
14
use_ok('C4::Serials', qw( NewSubscription GetSubscription NewIssue GetPreviousSerialid ));
Lines 291-293 sub set_flags { Link Here
291
        );
292
        );
292
    }
293
    }
293
}
294
}
294
- 
295
296
# test publication date as numbering pattern
297
298
my $subscriptionid_pubdatenumpattern = NewSubscription(
299
    undef, $my_branch, undef, undef, $budget_id, $biblionumber,
300
    '2013-01-01', undef, undef, undef,  undef,
301
    undef, undef, undef, undef, undef,
302
    undef, 1, "notes", undef, '2013-01-01', undef,
303
    undef, undef, undef,  0, "intnotes",
304
    0, undef, undef, 0,
305
    undef, '2013-12-31', 0, undef, undef, undef,
306
    'dmy'
307
);
308
309
my $serial_pubdatenumpattern = Koha::Serials->find({ subscriptionid => $subscriptionid_pubdatenumpattern });
310
311
is( $serial_pubdatenumpattern->serialseq, '01 January 2013', 'serialseq should be set to first acuisition date in the date format specified' );
312
313
ModSubscription(
314
    undef, $my_branch, undef, undef, $budget_id, '2013-01-01',
315
    undef, '2013-01-01', undef, undef, undef,
316
    undef, undef, undef, undef, undef,
317
    undef, undef, undef, undef, 1,
318
    $biblionumber, undef, "notes", undef, 0,
319
    "intnotes",  0, undef, undef,
320
    0, undef, '2013-12-31', $subscriptionid_pubdatenumpattern, 0,
321
    undef, undef, undef, 'ydm'
322
);
323
324
my $serialid_pubdatenumpattern = NewIssue( "pubdate", $subscriptionid_pubdatenumpattern, $biblionumber, 1 );
325
326
my $serial_pubdatenumpattern_2 = Koha::Serials->find( $serialid_pubdatenumpattern );
327
328
is( $serial_pubdatenumpattern_2->serialseq, dt_from_string( $serial_pubdatenumpattern_2->publisheddate )->strftime('%Y %d %B'), 'receive new issue with new pub date num pattern format' );

Return to bug 22188