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

(-)a/C4/Serials.pm (-28 / +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-2710 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
                 "de"=>
2694
                    [qw(Frühling Sommer Herbst Winter)],
2695
              );
2696
              $value = $value % 4;
2695
              $value = $value % 4;
2697
              $string = ($seasons{$seasonlocale})
2696
              $string = $seasons[$value];
2698
                      ? $seasons{$seasonlocale}->[$value]
2699
                      : $seasons{'en'}->[$value];
2700
        }
2697
        }
2701
        default {
2698
        default {
2702
            $string = $value;
2699
            $string = $value;
2703
        }
2700
        }
2704
    }
2701
    }
2705
    if($locale ne $initlocale) {
2706
        setlocale(LC_TIME, $initlocale);
2707
    }
2708
    return $string;
2702
    return $string;
2709
}
2703
}
2710
2704
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-1 / +11 lines)
Lines 246-252 $(document).ready(function() { Link Here
246
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
246
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
247
                </td>
247
                </td>
248
                <td>
248
                <td>
249
                    [% serial.serialseq %]
249
                    [% IF ( matches = serial.serialseq.match('Spring(.*)') ) %]
250
                        Spring[% matches.join("") %]
251
                    [% ELSIF ( matches = serial.serialseq.match('Summer(.*)') ) %]
252
                        Summer[% matches.join("") %]
253
                    [% ELSIF ( matches = serial.serialseq.match('Fall(.*)') ) %]
254
                        Fall[% matches.join("") %]
255
                    [% ELSIF ( matches = serial.serialseq.match('Winter(.*)') ) %]
256
                        Winter[% matches.join("") %]
257
                    [% ELSE %]
258
                        [% serial.serialseq %]
259
                    [% END %]
250
                </td>
260
                </td>
251
                <td>
261
                <td>
252
                    [% IF ( serial.status1 ) %]Expected[% END %]
262
                    [% 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, English is used</span>
234
                  <span class="hint">If empty, English is used</span>
235
- 

Return to bug 11262