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

(-)a/C4/Serials.pm (-26 / +22 lines)
Lines 23-30 use Modern::Perl; Link Here
23
use C4::Auth qw(haspermission);
23
use C4::Auth qw(haspermission);
24
use C4::Context;
24
use C4::Context;
25
use C4::Dates qw(format_date format_date_in_iso);
25
use C4::Dates qw(format_date format_date_in_iso);
26
use DateTime;
26
use Date::Calc qw(:all);
27
use Date::Calc qw(:all);
27
use POSIX qw(strftime setlocale LC_TIME);
28
use POSIX qw(strftime);
28
use C4::Biblio;
29
use C4::Biblio;
29
use C4::Log;    # logaction
30
use C4::Log;    # logaction
30
use C4::Debug;
31
use C4::Debug;
Lines 2665-2708 num_type can take : Link Here
2665
sub _numeration {
2666
sub _numeration {
2666
    my ($value, $num_type, $locale) = @_;
2667
    my ($value, $num_type, $locale) = @_;
2667
    $value ||= 0;
2668
    $value ||= 0;
2668
    my $initlocale = setlocale(LC_TIME);
2669
    if($locale and $locale ne $initlocale) {
2670
        $locale = setlocale(LC_TIME, $locale);
2671
    }
2672
    $locale ||= $initlocale;
2673
    my $string;
2674
    $num_type //= '';
2669
    $num_type //= '';
2670
    $locale ||= 'en';
2671
    my $string;
2675
    given ($num_type) {
2672
    given ($num_type) {
2676
        when (/^dayname$/) {
2673
        when (/^dayname$/) {
2677
              $value = $value % 7;
2674
            # 1970-06-01 was a monday
2678
              $string = POSIX::strftime("%A",0,0,0,0,0,0,$value);
2675
            $value = $value % 7;
2676
            my $dt = DateTime->new(
2677
                year    => 1970,
2678
                month   => 6,
2679
                day     => $value + 1,
2680
                locale  => $locale,
2681
            );
2682
            $string = $dt->strftime("%A");
2679
        }
2683
        }
2680
        when (/^monthname$/) {
2684
        when (/^monthname$/) {
2681
              $value = $value % 12;
2685
            $value = $value % 12;
2682
              $string = POSIX::strftime("%B",0,0,0,1,$value,0,0,0,0);
2686
            my $dt = DateTime->new(
2687
                year    => 1970,
2688
                month   => $value + 1,
2689
                locale  => $locale,
2690
            );
2691
            $string = $dt->strftime("%B");
2683
        }
2692
        }
2684
        when (/^season$/) {
2693
        when (/^season$/) {
2685
              my $seasonlocale = ($locale)
2694
              my @seasons= qw( Spring Summer Fall Winter );
2686
                               ? (substr $locale,0,2)
2687
                               : "en";
2688
              my %seasons=(
2689
                 "en" =>
2690
                    [qw(Spring Summer Fall Winter)],
2691
                 "fr"=>
2692
                    [qw(Printemps Été Automne Hiver)],
2693
              );
2694
              $value = $value % 4;
2695
              $value = $value % 4;
2695
              $string = ($seasons{$seasonlocale})
2696
              $string = $seasons[$value];
2696
                      ? $seasons{$seasonlocale}->[$value]
2697
                      : $seasons{'en'}->[$value];
2698
        }
2697
        }
2699
        default {
2698
        default {
2700
            $string = $value;
2699
            $string = $value;
2701
        }
2700
        }
2702
    }
2701
    }
2703
    if($locale ne $initlocale) {
2704
        setlocale(LC_TIME, $initlocale);
2705
    }
2706
    return $string;
2702
    return $string;
2707
}
2703
}
2708
2704
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-1 / +11 lines)
Lines 250-256 $(document).ready(function() { Link Here
250
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
250
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
251
                </td>
251
                </td>
252
                <td>
252
                <td>
253
                    [% serial.serialseq %]
253
                    [% IF ( matches = serial.serialseq.match('Spring(.*)') ) %]
254
                        Spring[% matches.join("") %]
255
                    [% ELSIF ( matches = serial.serialseq.match('Summer(.*)') ) %]
256
                        Summer[% matches.join("") %]
257
                    [% ELSIF ( matches = serial.serialseq.match('Fall(.*)') ) %]
258
                        Fall[% matches.join("") %]
259
                    [% ELSIF ( matches = serial.serialseq.match('Winter(.*)') ) %]
260
                        Winter[% matches.join("") %]
261
                    [% ELSE %]
262
                        [% serial.serialseq %]
263
                    [% END %]
254
                </td>
264
                </td>
255
                <td>
265
                <td>
256
                    [% IF ( serial.status1 ) %]Expected[% END %]
266
                    [% IF ( serial.status1 ) %]Expected[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt (-1 / +13 lines)
Lines 56-62 Link Here
56
  <tbody>
56
  <tbody>
57
    [% FOREACH prediction IN predictions_loop %]
57
    [% FOREACH prediction IN predictions_loop %]
58
      <tr>
58
      <tr>
59
        <td>[% prediction.number %]</td>
59
        <td>
60
            [% IF ( matches = prediction.number.match('Spring(.*)') ) %]
61
                Spring[% matches.join("") %]
62
            [% ELSIF ( matches = prediction.number.match('Summer(.*)') ) %]
63
                Summer[% matches.join("") %]
64
            [% ELSIF ( matches = prediction.number.match('Fall(.*)') ) %]
65
                Fall[% matches.join("") %]
66
            [% ELSIF ( matches = prediction.number.match('Winter(.*)') ) %]
67
                Winter[% matches.join("") %]
68
            [% ELSE %]
69
                [% prediction.number %]
70
            [% END %]
71
        </td>
60
        <td>
72
        <td>
61
          [% IF (prediction.publicationdate) %]
73
          [% IF (prediction.publicationdate) %]
62
            [% prediction.publicationdate | $KohaDates %]
74
            [% prediction.publicationdate | $KohaDates %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt (-2 / +1 lines)
Lines 228-234 function show_blocking_subs() { Link Here
228
                  <select id="locale" name="locale">
228
                  <select id="locale" name="locale">
229
                      <option value=""></option>
229
                      <option value=""></option>
230
                      [% FOREACH locale IN locales %]
230
                      [% FOREACH locale IN locales %]
231
                        <option value="[% locale %]">[% locale %]</option>
231
                        <option value="[% locale.language %]">[% locale.description %]</option>
232
                      [% END %]
232
                      [% END %]
233
                    </select>
233
                    </select>
234
                  <span class="hint">If empty, system locale is used</span>
234
                  <span class="hint">If empty, system locale is used</span>
235
- 

Return to bug 11262