Bugzilla – Attachment 28698 Details for
Bug 12338
Remove smartmatch operator from C4/Serials.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12338: Remove smartmatch operator from C4/Serials.pm
Bug-12338-Remove-smartmatch-operator-from-C4Serial.patch (text/plain), 2.51 KB, created by
Jonathan Druart
on 2014-06-06 13:33:10 UTC
(
hide
)
Description:
Bug 12338: Remove smartmatch operator from C4/Serials.pm
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-06-06 13:33:10 UTC
Size:
2.51 KB
patch
obsolete
>From e7a8312f811a0580063e30dea4c195b2d26f286e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Fri, 30 May 2014 16:13:36 -0300 >Subject: [PATCH] Bug 12338: Remove smartmatch operator from C4/Serials.pm > >This patch removes the use of the 'when' smartmatch operator from >Serials.pm > >Regards >To+ > >Sponsored-by: Universidad Nacional de Cordoba >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Serials.pm | 54 +++++++++++++++++++++++++----------------------------- > 1 file changed, 25 insertions(+), 29 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 9657cbc..bcb37e3 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2668,36 +2668,32 @@ sub _numeration { > $num_type //= ''; > $locale ||= 'en'; > my $string; >- given ($num_type) { >- when (/^dayname$/) { >- # 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"); >- } >- when (/^monthname$/) { >- $value = $value % 12; >- my $dt = DateTime->new( >- year => 1970, >- month => $value + 1, >- locale => $locale, >- ); >- $string = $dt->strftime("%B"); >- } >- when (/^season$/) { >- my @seasons= qw( Spring Summer Fall Winter ); >- $value = $value % 4; >- $string = $seasons[$value]; >- } >- default { >- $string = $value; >- } >+ if ( $num_type =~ /^dayname$/ ) { >+ # 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( >+ 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]; >+ } else { >+ $string = $value; > } >+ > return $string; > } > >-- >2.0.0.rc2
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 12338
:
28578
|
28689
| 28698