Bugzilla – Attachment 50363 Details for
Bug 16289
Abbreviated formatting for numbering patterns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16289) Abbreviated formatting for numbering patterns
bug16289.v1.patch (text/plain), 6.76 KB, created by
Karl Holten
on 2016-04-18 20:44:27 UTC
(
hide
)
Description:
Bug 16289) Abbreviated formatting for numbering patterns
Filename:
MIME Type:
Creator:
Karl Holten
Created:
2016-04-18 20:44:27 UTC
Size:
6.76 KB
patch
obsolete
>From 5bf92e4416448d823834e13d6ab62ae0df253a9d Mon Sep 17 00:00:00 2001 >From: Karl Holten <kholten@switchinc.org> >Date: Mon, 18 Apr 2016 14:17:40 -0500 >Subject: [PATCH] Bug 16289: Abbreviated formatting for numbering patterns > >To test: > >1) Go to Serials -> Manage numbering patterns >2) Create .New Numbering Pattern. >3) Type in a name of 'Day, Month, Season' and a numbering formula of '{X} {Y} {Z}'. >4) Set up the X field as following: add 1, every 1, set back to 1, when more than 30. >5) Select the formatting for X. There should be six options available instead of the original three. Use the formatting 'Name of Day (abbreviated)'. >5) Set up the Y field to add 1 every 30 reset back to 1 when more than 12. Use the formatting option 'Name of month (abbreviated)'. >6) Set up the Z field to add 1 every 90 reset back to 1 when more than 4. Use the formatting option 'Name of season (abbreviated)'. >8) Select a frequency of 1/day. >9) Select a first issue publication date of Jan 1, 2016. >10) Set X to begin with 5 and have an inner counter of 5. Set Z to begin with 3 and have an inner counter of 10. >11) Click the 'Test Pattern' button. >12) Abbreviated versions of the day, month and season should appear in the test pattern. > >--- > C4/Serials.pm | 25 ++++++++++++++++++++++ > .../prog/en/modules/serials/subscription-add.tt | 3 +++ > .../modules/serials/subscription-numberpatterns.tt | 15 +++++++++++++ > 3 files changed, 43 insertions(+) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index eca9b13..755fc93 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2483,8 +2483,11 @@ sub GetNextDate { > _numeration returns the string corresponding to $value in the num_type > num_type can take : > -dayname >+ -dayabrv > -monthname >+ -monthabrv > -season >+ -seasonabrv > =cut > > #' >@@ -2505,6 +2508,16 @@ sub _numeration { > locale => $locale, > ); > $string = $dt->strftime("%A"); >+ } elsif ( $num_type =~ /^dayabrv$/ ) { >+ # 1970-11-01 was a Sunday >+ $value = $value % 7; >+ my $dt = DateTime->new( >+ year => 1970, >+ month => 11, >+ day => $value + 1, >+ locale => $locale, >+ ); >+ $string = $dt->strftime("%a"); > } elsif ( $num_type =~ /^monthname$/ ) { > $value = $value % 12; > my $dt = DateTime->new( >@@ -2513,10 +2526,22 @@ sub _numeration { > locale => $locale, > ); > $string = $dt->strftime("%B"); >+ } elsif ( $num_type =~ /^monthabrv$/ ) { >+ $value = $value % 12; >+ my $dt = DateTime->new( >+ year => 1970, >+ month => $value + 1, >+ locale => $locale, >+ ); >+ $string = $dt->strftime("%b"); > } elsif ( $num_type =~ /^season$/ ) { > my @seasons= qw( Spring Summer Fall Winter ); > $value = $value % 4; > $string = $seasons[$value]; >+ } elsif ( $num_type =~ /^seasonabrv$/ ) { >+ my @seasonsabrv= qw( Spr Sum Fal Win ); >+ $value = $value % 4; >+ $string = $seasonsabrv[$value]; > } else { > $string = $value; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index a3ea8ef..c5d6888 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -837,8 +837,11 @@ $(document).ready(function() { > <select disabled="disabled" id="[% name %]" name="[% name %]" /> > <option value=""></option> > <option value="dayname">Name of day</option> >+ <option value="dayabrv">Name of day (abbreviated)</option> > <option value="monthname">Name of month</option> >+ <option value="monthabrv">Name of month (abbreviated)</option> > <option value="season">Name of season</option> >+ <option value="seasonabrv">Name of season (abbreviated)</option> > </select> > [% END %] > <td>Formatting</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >index f960c5f..098cae1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >@@ -180,16 +180,31 @@ $(document).ready(function(){ > [% ELSE %] > <option value="dayname">Name of day</option> > [% END %] >+ [% IF (value == "dayabrv") %] >+ <option selected="selected" value="dayabrv">Name of day (abbreviated)</option> >+ [% ELSE %] >+ <option value="dayabrv">Name of day (abbreviated)</option> >+ [% END %] > [% IF (value == "monthname") %] > <option selected="selected" value="monthname">Name of month</option> > [% ELSE %] > <option value="monthname">Name of month</option> > [% END %] >+ [% IF (value == "monthabrv") %] >+ <option selected="selected" value="monthabrv">Name of month (abbreviated)</option> >+ [% ELSE %] >+ <option value="monthabrv">Name of month (abbreviated)</option> >+ [% END %] > [% IF (value == "season") %] > <option selected="selected" value="season">Name of season</option> > [% ELSE %] > <option value="season">Name of season</option> > [% END %] >+ [% IF (value == "seasonabrv") %] >+ <option selected="selected" value="seasonabrv">Name of season (abbreviated)</option> >+ [% ELSE %] >+ <option value="seasonabrv">Name of season (abbreviated)</option> >+ [% END %] > </select> > [% END %] > <td>Formatting</td> >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16289
:
50363
|
52058
|
52098
|
52099