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

(-)a/C4/Serials.pm (-16 / +41 lines)
Lines 842-849 sub GetNextSeq { Link Here
842
842
843
    my $calculated = "";
843
    my $calculated = "";
844
    my $numberingmethod = "";
844
    my $numberingmethod = "";
845
    my $dateformat = $subscription->{pubdatepatternformat};
845
    if ($pattern eq "pubdate"){
846
    if ($pattern eq "pubdate"){
846
        $calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' );
847
        if ( $dateformat eq 'dmy' ){
848
            $calculated = dt_from_string( $planneddate )->strftime( '%d %B %Y' );
849
        } elsif ( $dateformat eq 'mdy' ){
850
            $calculated = dt_from_string( $planneddate )->strftime( '%B %d %Y' );
851
        } elsif ( $dateformat eq 'ydm' ){
852
            $calculated = dt_from_string( $planneddate )->strftime( '%Y %d %B' );
853
        } else {
854
            $calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' );
855
        }
847
    } else {
856
    } else {
848
        $numberingmethod = $pattern->{numberingmethod};
857
        $numberingmethod = $pattern->{numberingmethod};
849
    }
858
    }
Lines 1135-1160 sub ModSerialStatus { Link Here
1135
        my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern});
1144
        my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern});
1136
        my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
1145
        my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity});
1137
1146
1138
        my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1);
1147
        my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency);
1139
        my ( $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1148
        my ( $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1140
             $newinnerloop1, $newinnerloop2, $newinnerloop3 );
1149
             $newinnerloop1, $newinnerloop2, $newinnerloop3 );
1141
1150
1151
        # next issue number
1142
        if (!defined $pattern){
1152
        if (!defined $pattern){
1143
            $pattern = "pubdate";
1153
            $pattern = "pubdate";
1144
            ( $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1154
            $newserialseq = "pubdate";
1145
              $newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate );
1146
        } else {
1155
        } else {
1147
            ( $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1156
            ( $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1148
              $newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate );
1157
              $newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate );
1149
        }
1158
        }
1150
1159
1151
        # next issue number
1152
        my (
1153
            $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1154
            $newinnerloop1, $newinnerloop2, $newinnerloop3
1155
          )
1156
          = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate );
1157
1158
        # next date (calculated from actual date & frequency parameters)
1160
        # next date (calculated from actual date & frequency parameters)
1159
        my $nextpubdate = $nextpublisheddate;
1161
        my $nextpubdate = $nextpublisheddate;
1160
        $query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
1162
        $query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
Lines 1315-1321 sub ModSubscription { Link Here
1315
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1317
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1316
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1318
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1317
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1319
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1318
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
1320
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template, $dateformat
1319
    ) = @_;
1321
    ) = @_;
1320
1322
1321
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1323
    my $subscription = Koha::Subscriptions->find($subscriptionid);
Lines 1360-1365 sub ModSubscription { Link Here
1360
            mana_id           => $mana_id,
1362
            mana_id           => $mana_id,
1361
            ccode             => $ccode,
1363
            ccode             => $ccode,
1362
            published_on_template => $published_on_template,
1364
            published_on_template => $published_on_template,
1365
            pubdatepatternformat => $dateformat,
1363
        }
1366
        }
1364
    )->store;
1367
    )->store;
1365
    # FIXME Must be $subscription->serials
1368
    # FIXME Must be $subscription->serials
Lines 1380-1386 $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu Link Here
1380
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1383
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1381
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1384
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1382
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1385
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1383
    $skip_serialseq, $itemtype, $previousitemtype);
1386
    $skip_serialseq, $itemtype, $previousitemtype, $dateformat);
1384
1387
1385
Create a new subscription with value given on input args.
1388
Create a new subscription with value given on input args.
1386
1389
Lines 1398-1404 sub NewSubscription { Link Here
1398
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1401
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1399
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1402
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1400
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1403
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1401
    $published_on_template,
1404
    $published_on_template, $dateformat,
1402
    ) = @_;
1405
    ) = @_;
1403
    my $dbh = C4::Context->dbh;
1406
    my $dbh = C4::Context->dbh;
1404
1407
Lines 1443-1448 sub NewSubscription { Link Here
1443
            mana_id           => $mana_id,
1446
            mana_id           => $mana_id,
1444
            ccode             => $ccode,
1447
            ccode             => $ccode,
1445
            published_on_template => $published_on_template,
1448
            published_on_template => $published_on_template,
1449
            pubdatepatternformat => $dateformat,
1446
        }
1450
        }
1447
    )->store;
1451
    )->store;
1448
    $subscription->discard_changes;
1452
    $subscription->discard_changes;
Lines 1475-1482 sub NewSubscription { Link Here
1475
    # calculate issue number
1479
    # calculate issue number
1476
    my $serialseq = GetSeq($subscription, $pattern) || q{};
1480
    my $serialseq = GetSeq($subscription, $pattern) || q{};
1477
1481
1482
    $dateformat //= '';
1478
    if ($serialseq eq "pubdate"){
1483
    if ($serialseq eq "pubdate"){
1479
        $serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d');
1484
        if ( $dateformat eq 'dmy' ){
1485
            $serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y');
1486
        } elsif ( $dateformat eq 'mdy' ){
1487
            $serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y');
1488
        } elsif ( $dateformat eq 'ydm' ){
1489
            $serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B');
1490
        } else {
1491
            $serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d');
1492
        }
1480
    }
1493
    }
1481
1494
1482
    Koha::Serial->new(
1495
    Koha::Serial->new(
Lines 1622-1627 sub NewIssue { Link Here
1622
1635
1623
    my $subscription = Koha::Subscriptions->find( $subscriptionid );
1636
    my $subscription = Koha::Subscriptions->find( $subscriptionid );
1624
1637
1638
    my $dateformat = $subscription->pubdatepatternformat;
1639
    if ($serialseq eq "pubdate"){
1640
        if ( $dateformat eq 'dmy' ){
1641
            $serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y');
1642
        } elsif ( $dateformat eq 'mdy' ){
1643
            $serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y');
1644
        } elsif ( $dateformat eq 'ydm' ){
1645
            $serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B');
1646
        } else {
1647
            $serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d');
1648
        }
1649
    }
1650
1625
    if ( my $template = $subscription->published_on_template ) {
1651
    if ( my $template = $subscription->published_on_template ) {
1626
        $publisheddatetext = process_tt(
1652
        $publisheddatetext = process_tt(
1627
            $template,
1653
            $template,
Lines 2427-2433 sub GetNextDate { Link Here
2427
2453
2428
    return unless $subscription and $publisheddate;
2454
    return unless $subscription and $publisheddate;
2429
2455
2430
2431
    if ($freqdata->{'unit'}) {
2456
    if ($freqdata->{'unit'}) {
2432
        my ( $year, $month, $day ) = split /-/, $publisheddate;
2457
        my ( $year, $month, $day ) = split /-/, $publisheddate;
2433
2458
(-)a/Koha/Schema/Result/Subscription.pm (-1 / +9 lines)
Lines 277-282 how many issues to show to the staff Link Here
277
277
278
how many issues to show to the public
278
how many issues to show to the public
279
279
280
=head2 pubdatepatternformat
281
282
  data_type: 'varchar'
283
  is_nullable: 1
284
  size: 3
285
280
=head2 graceperiod
286
=head2 graceperiod
281
287
282
  data_type: 'integer'
288
  data_type: 'integer'
Lines 416-421 __PACKAGE__->add_columns( Link Here
416
  { data_type => "integer", is_nullable => 1 },
422
  { data_type => "integer", is_nullable => 1 },
417
  "opacdisplaycount",
423
  "opacdisplaycount",
418
  { data_type => "integer", is_nullable => 1 },
424
  { data_type => "integer", is_nullable => 1 },
425
  "pubdatepatternformat",
426
  { data_type => "varchar", is_nullable => 1, size => 3 },
419
  "graceperiod",
427
  "graceperiod",
420
  { data_type => "integer", default_value => 0, is_nullable => 0 },
428
  { data_type => "integer", default_value => 0, is_nullable => 0 },
421
  "enddate",
429
  "enddate",
Lines 566-572 __PACKAGE__->has_many( Link Here
566
);
574
);
567
575
568
576
569
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-07-14 11:46:15
577
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2023-07-14 11:46:15
570
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LICIiWzag365cUAq5OYD2A
578
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LICIiWzag365cUAq5OYD2A
571
579
572
__PACKAGE__->has_many(
580
__PACKAGE__->has_many(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-2 / +35 lines)
Lines 360-368 fieldset.rows table { clear: none; margin: 0; } Link Here
360
                                    <li>
360
                                    <li>
361
                                        <label for="numberpattern" class="required">Numbering pattern:</label>
361
                                        <label for="numberpattern" class="required">Numbering pattern:</label>
362
                                        <select name="numbering_pattern" id="numberpattern" class="required" required="required">
362
                                        <select name="numbering_pattern" id="numberpattern" class="required" required="required">
363
                                            <option value="">-- please choose --</option>
363
                                            [% IF subscriptionid %]
364
                                                <option value="">-- please choose --</option>
365
                                            [% ELSE %]
366
                                                <option value="" selected="selected">-- please choose --</option>
367
                                            [% END %]
368
                                            [% SET pattern = 0 %]
364
                                            [% FOREACH numberpattern IN numberpatterns %]
369
                                            [% FOREACH numberpattern IN numberpatterns %]
365
                                                [% IF (numberpattern.selected) %]
370
                                                [% IF (numberpattern.selected) %]
371
                                                    [% pattern = 1 %]
366
                                                    <option value="[% numberpattern.id | html %]" selected="selected">
372
                                                    <option value="[% numberpattern.id | html %]" selected="selected">
367
                                                [% ELSE %]
373
                                                [% ELSE %]
368
                                                    <option value="[% numberpattern.id | html %]">
374
                                                    <option value="[% numberpattern.id | html %]">
Lines 370-376 fieldset.rows table { clear: none; margin: 0; } Link Here
370
                                                    [% numberpattern.label | html %]
376
                                                    [% numberpattern.label | html %]
371
                                                </option>
377
                                                </option>
372
                                            [% END %]
378
                                            [% END %]
373
                                            <option value="0">Use publication date</option>
379
                                            [% IF pattern == 0 and subscriptionid %]
380
                                                <option value="0" selected="selected">Use publication date</option>
381
                                            [% ELSE %]
382
                                                <option value="0">Use publication date</option>
383
                                            [% END %]
384
                                        </select>
385
                                        <select name="date_format" size="1" id="date_format">
386
                                            <option value="">-- choose date format --</option>
387
                                            [% IF pubdatepatternformat == 'dmy' %]
388
                                                <option value="dmy" selected="selected">Day Month Year</option>
389
                                            [% ELSE %]
390
                                                <option value="dmy">Day Month Year</option>
391
                                            [% END %]
392
                                            [% IF pubdatepatternformat == 'mdy' %]
393
                                                <option value="mdy" selected="selected">Month Day Year</option>
394
                                            [% ELSE %]
395
                                                <option value="mdy">Month Day Year</option>
396
                                            [% END %]
397
                                            [% IF pubdatepatternformat == 'ymd' %]
398
                                                <option value="ymd" selected="selected">Year Month Day</option>
399
                                            [% ELSE %]
400
                                                <option value="ymd">Year Month Day</option>
401
                                            [% END %]
402
                                            [% IF pubdatepatternformat == 'ydm' %]
403
                                                <option value="ydm" selected="selected">Year Day Month</option>
404
                                            [% ELSE %]
405
                                                <option value="ydm">Year Day Month</option>
406
                                            [% END %]
374
                                        </select>
407
                                        </select>
375
                                        <span class="required">Required</span>
408
                                        <span class="required">Required</span>
376
                                    </li>
409
                                    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +1 lines)
Lines 104-110 Link Here
104
                [% IF ( numberpattern ) %]
104
                [% IF ( numberpattern ) %]
105
                    [% numberpattern.label | html %]
105
                    [% numberpattern.label | html %]
106
                [% ELSE %]
106
                [% ELSE %]
107
                    Uses publication date
107
                    Uses publication date - [% dateformat %] format
108
                [% END %]
108
                [% END %]
109
            </li>
109
            </li>
110
            [% IF ( numberpattern ) %]
110
            [% IF ( numberpattern ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-2 / +10 lines)
Lines 348-354 function testPredictionPattern() { Link Here
348
        'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
348
        'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
349
        'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
349
        'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
350
        'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale',
350
        'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale',
351
        'sfdescription', 'unitsperissue', 'issuesperunit', 'unit'
351
        'sfdescription', 'unitsperissue', 'issuesperunit', 'unit', 'date_format'
352
    ];
352
    ];
353
    for(i in ajaxParams) {
353
    for(i in ajaxParams) {
354
        var param = ajaxParams[i];
354
        var param = ajaxParams[i];
Lines 572-577 function hidePredcitionPatternTest(){ Link Here
572
}
572
}
573
573
574
function usedatepattern() {
574
function usedatepattern() {
575
    $("#date_format").show();
575
    $("#more_options").hide();
576
    $("#more_options").hide();
576
    clearAdvancedPattern();
577
    clearAdvancedPattern();
577
    if ($("#advancedpredictionpattern").is(":visible")){
578
    if ($("#advancedpredictionpattern").is(":visible")){
Lines 592-597 $(document).ready(function() { Link Here
592
        $("#new_mana_comment").hide();
593
        $("#new_mana_comment").hide();
593
        $(".mana_comment_status").hide();
594
        $(".mana_comment_status").hide();
594
    });
595
    });
596
    $("#mana_search_result").modal("hide");
597
598
    $("#date_format").hide();
599
    if ($("select#numberpattern").val() == "0"){
600
        $("#date_format").show();
601
    }
595
602
596
    $("#aqbooksellerid").on('keypress', function(e) {
603
    $("#aqbooksellerid").on('keypress', function(e) {
597
        if (e.keyCode == 13) {
604
        if (e.keyCode == 13) {
Lines 612-622 $(document).ready(function() { Link Here
612
    });
619
    });
613
    $("select#numberpattern").change(function(){
620
    $("select#numberpattern").change(function(){
614
        patternneedtobetested = 1;
621
        patternneedtobetested = 1;
615
        console.log($("select#numberpattern").val());
616
        if ($("select#numberpattern").val() == "0"){
622
        if ($("select#numberpattern").val() == "0"){
617
            usedatepattern();
623
            usedatepattern();
618
        } else {
624
        } else {
619
            numberpatternload();
625
            numberpatternload();
626
            $("#date_format").hide();
627
            $("#date_format").val("");
620
        }
628
        }
621
    });
629
    });
622
    $("#subtype").change(function(){
630
    $("#subtype").change(function(){
(-)a/serials/serials-collection.pl (-4 / +13 lines)
Lines 31-37 use Koha::DateUtils qw( dt_from_string ); Link Here
31
31
32
use List::MoreUtils qw( uniq );
32
use List::MoreUtils qw( uniq );
33
33
34
35
my $query = CGI->new;
34
my $query = CGI->new;
36
my $op = $query->param('op') || q{};
35
my $op = $query->param('op') || q{};
37
my $nbissues=$query->param('nbissues');
36
my $nbissues=$query->param('nbissues');
Lines 66-71 if($op eq 'gennext' && @subscriptionid){ Link Here
66
        $sth->execute($subscriptionid);
65
        $sth->execute($subscriptionid);
67
        # modify actual expected issue, to generate the next
66
        # modify actual expected issue, to generate the next
68
        if ( my $issue = $sth->fetchrow_hashref ) {
67
        if ( my $issue = $sth->fetchrow_hashref ) {
68
69
            my $planneddate = $date_received_today ? dt_from_string : $issue->{planneddate};
69
            my $planneddate = $date_received_today ? dt_from_string : $issue->{planneddate};
70
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
70
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
71
                    $planneddate, $issue->{publisheddate},
71
                    $planneddate, $issue->{publisheddate},
Lines 79-88 if($op eq 'gennext' && @subscriptionid){ Link Here
79
            my (
79
            my (
80
                 $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
80
                 $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
81
                 $newinnerloop1, $newinnerloop2, $newinnerloop3
81
                 $newinnerloop1, $newinnerloop2, $newinnerloop3
82
            ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate});
82
            ) = GetNextSeq($subscription, $pattern, $frequency);
83
83
84
            if (!defined $pattern && !defined $newserialseq){
84
            if (!defined $pattern && !defined $newserialseq){
85
                $newserialseq = $expected->{publisheddate};
85
                my $dateformat = $subscription->{pubdatepatternformat};
86
                if ( $dateformat eq 'dmy' ){
87
                    $newserialseq = dt_from_string( $expected->{publisheddate} )->strftime('%d %B %Y');
88
                } elsif ( $dateformat eq 'mdy' ){
89
                    $newserialseq = dt_from_string( $expected->{publisheddate} )->strftime('%B %d %Y');
90
                } elsif ( $dateformat eq 'ydm' ){
91
                    $newserialseq = dt_from_string( $expected->{publisheddate} )->strftime('%Y %d %B');
92
                } else {
93
                    $newserialseq = dt_from_string( $expected->{publisheddate} )->strftime('%Y %B %d');
94
                }
86
            }
95
            }
87
96
88
             ## We generate the next publication date
97
             ## We generate the next publication date
Lines 158-164 if (@subscriptionid){ Link Here
158
    $subs->{frequency} = $frequency;
167
    $subs->{frequency} = $frequency;
159
    my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
168
    my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
160
    if (!defined $numberpattern){
169
    if (!defined $numberpattern){
161
        $numberpattern->{label} = "Uses publication date";
170
        $numberpattern->{label} = "Uses publication date - $subs->{pubdatepatternformat} format";
162
    }
171
    }
163
    $subs->{numberpattern} = $numberpattern;
172
    $subs->{numberpattern} = $numberpattern;
164
    $subs->{'hasRouting'} = check_routing($subscriptionid);
173
    $subs->{'hasRouting'} = check_routing($subscriptionid);
(-)a/serials/showpredictionpattern.pl (-2 / +20 lines)
Lines 121-128 if(defined $subscriptionid) { Link Here
121
my @predictions_loop;
121
my @predictions_loop;
122
my ($calculated) = GetSeq(\%subscription, \%pattern);
122
my ($calculated) = GetSeq(\%subscription, \%pattern);
123
123
124
my $dateformat = scalar $input->param('date_format');
125
124
if ($calculated eq "pubdate"){
126
if ($calculated eq "pubdate"){
125
    $calculated = dt_from_string( $date )->strftime('%Y %B %d');
127
    if ( $dateformat eq 'dmy' ){
128
        $calculated = dt_from_string( $date )->strftime('%d %B %Y');
129
    } elsif ( $dateformat eq 'mdy' ){
130
        $calculated = dt_from_string( $date )->strftime('%B %d %Y');
131
    } elsif ( $dateformat eq 'ydm' ){
132
        $calculated = dt_from_string( $date )->strftime('%Y %d %B');
133
    } else {
134
        $calculated = dt_from_string( $date )->strftime('%Y %B %d');
135
    }
126
}
136
}
127
137
128
push @predictions_loop, {
138
push @predictions_loop, {
Lines 173-179 while( $i < 1000 ) { Link Here
173
    $issuenumber++;
183
    $issuenumber++;
174
    $line{'number'} = $calculated;
184
    $line{'number'} = $calculated;
175
    if ($calculated eq ''){
185
    if ($calculated eq ''){
176
        $line{'number'} = dt_from_string( $date )->strftime('%Y %B %d');
186
        if ( $dateformat eq 'dmy' ){
187
            $line{'number'} = dt_from_string( $date )->strftime('%d %B %Y');
188
        } elsif ( $dateformat eq 'mdy' ){
189
            $line{'number'} = dt_from_string( $date )->strftime('%B %d %Y');
190
        } elsif ( $dateformat eq 'ydm' ){
191
            $line{'number'} = dt_from_string( $date )->strftime('%Y %d %B');
192
        } else {
193
            $line{'number'} = dt_from_string( $date )->strftime('%Y %B %d');
194
        }
177
    }
195
    }
178
    $line{'issuenumber'} = $issuenumber;
196
    $line{'issuenumber'} = $issuenumber;
179
    if(@irreg && $issuenumber == $irreg[0]){
197
    if(@irreg && $issuenumber == $irreg[0]){
(-)a/serials/subscription-add.pl (-2 / +5 lines)
Lines 157-162 $template->param( Link Here
157
    typeloop                 => \@typearg,
157
    typeloop                 => \@typearg,
158
    previoustypeloop         => \@previoustypearg,
158
    previoustypeloop         => \@previoustypearg,
159
    locations_loop=>$locations_loop,
159
    locations_loop=>$locations_loop,
160
    pubdatepatternformat => $subs->{pubdatepatternformat},
160
);
161
);
161
162
162
# prepare template variables common to all $op conditions:
163
# prepare template variables common to all $op conditions:
Lines 353-358 sub redirect_add_subscription { Link Here
353
    if ($numberpattern == "0"){ # using publication date as numbering pattern
354
    if ($numberpattern == "0"){ # using publication date as numbering pattern
354
        $numberpattern = undef;
355
        $numberpattern = undef;
355
    }
356
    }
357
    my $dateformat = $query->param('date_format');
356
358
357
    my $subscriptionid = NewSubscription(
359
    my $subscriptionid = NewSubscription(
358
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
360
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
Lines 362-368 sub redirect_add_subscription { Link Here
362
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
364
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
363
        $manualhistory, $internalnotes, $serialsadditems,
365
        $manualhistory, $internalnotes, $serialsadditems,
364
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
366
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
365
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
367
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template, $dateformat
366
    );
368
    );
367
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
369
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
368
        my $result = Koha::SharedContent::send_entity( $query->param('mana_language') || '', $loggedinuser, $subscriptionid, 'subscription');
370
        my $result = Koha::SharedContent::send_entity( $query->param('mana_language') || '', $loggedinuser, $subscriptionid, 'subscription');
Lines 475-480 sub redirect_mod_subscription { Link Here
475
    if ($numberpattern == "0"){ # using publication date as numbering pattern
477
    if ($numberpattern == "0"){ # using publication date as numbering pattern
476
        $numberpattern = undef;
478
        $numberpattern = undef;
477
    }
479
    }
480
    my $dateformat = $query->param('date_format');
478
481
479
    ModSubscription(
482
    ModSubscription(
480
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
483
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
Lines 484-490 sub redirect_mod_subscription { Link Here
484
        $status, $biblionumber, $callnumber, $notes, $letter,
487
        $status, $biblionumber, $callnumber, $notes, $letter,
485
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
488
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
486
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
489
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
487
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
490
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template, $dateformat
488
    );
491
    );
489
492
490
    my @additional_fields;
493
    my @additional_fields;
(-)a/serials/subscription-detail.pl (-1 / +2 lines)
Lines 124-129 my @irregular_issues = split /;/, $subs->{irregularity}; Link Here
124
124
125
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
125
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
126
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
126
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
127
my $dateformat = $subs->{pubdatepatternformat};
127
128
128
$template->param(
129
$template->param(
129
    available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ),
130
    available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ),
Lines 157-162 $template->param( Link Here
157
    cannotedit => (not C4::Serials::can_edit_subscription( $subs )),
158
    cannotedit => (not C4::Serials::can_edit_subscription( $subs )),
158
    frequency => $frequency,
159
    frequency => $frequency,
159
    numberpattern => $numberpattern,
160
    numberpattern => $numberpattern,
161
    dateformat      => $dateformat,
160
    has_X           => ($numberpattern->{'numberingmethod'} =~ /{X}/) ? 1 : 0,
162
    has_X           => ($numberpattern->{'numberingmethod'} =~ /{X}/) ? 1 : 0,
161
    has_Y           => ($numberpattern->{'numberingmethod'} =~ /{Y}/) ? 1 : 0,
163
    has_Y           => ($numberpattern->{'numberingmethod'} =~ /{Y}/) ? 1 : 0,
162
    has_Z           => ($numberpattern->{'numberingmethod'} =~ /{Z}/) ? 1 : 0,
164
    has_Z           => ($numberpattern->{'numberingmethod'} =~ /{Z}/) ? 1 : 0,
163
- 

Return to bug 22188