[Rt-commit] r18843 - in rt/3.8/trunk: etc/upgrade/3.8.3 sbin

ruz at bestpractical.com ruz at bestpractical.com
Wed Mar 18 19:32:18 EDT 2009


Author: ruz
Date: Wed Mar 18 19:32:17 2009
New Revision: 18843

Modified:
   rt/3.8/trunk/etc/upgrade/3.8.3/content
   rt/3.8/trunk/lib/RT/ACE_Overlay.pm
   rt/3.8/trunk/lib/RT/CustomField_Overlay.pm
   rt/3.8/trunk/sbin/rt-test-dependencies.in

Log:
* use Lingua::EN::Inflect::Number to canonicalize right names from
  plural to single form, s/s$// was too naive

Modified: rt/3.8/trunk/etc/upgrade/3.8.3/content
==============================================================================
--- rt/3.8/trunk/etc/upgrade/3.8.3/content	(original)
+++ rt/3.8/trunk/etc/upgrade/3.8.3/content	Wed Mar 18 19:32:17 2009
@@ -11,6 +11,7 @@
 
 @Final = (
     sub {
+        require Lingua::EN::Inflect::Number;
         $RT::Logger->debug("Going to canonicalize ACLs in the DB");
         my $sys = RT::System->new($RT::SystemUser);
 
@@ -18,8 +19,7 @@
         $acl->UnLimit;
         while ( my $ace = $acl->Next ) {
             my $old = $ace->__Value('RightName');
-            my $new = $old;
-            $new =~ s/s$//i;
+            my $new = Lingua::EN::Inflect::Number::to_S( $old );
             next if $new eq $old;
 
             my ($status, $msg) = $ace->__Set( Field => 'RightName', Value => $new );

Modified: rt/3.8/trunk/lib/RT/ACE_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/ACE_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/ACE_Overlay.pm	Wed Mar 18 19:32:17 2009
@@ -70,6 +70,8 @@
 use RT::Queues;
 use RT::Groups;
 
+use Lingua::EN::Inflect::Number;
+
 use vars qw (
   %LOWERCASERIGHTNAMES
   %OBJECT_TYPES
@@ -567,9 +569,9 @@
     my $self  = shift;
     unless ( $keys_cached == keys %LOWERCASERIGHTNAMES ) {
         foreach my $right ( values %LOWERCASERIGHTNAMES ) {
-            $right =~ s/s$//i;
+            $right = Lingua::EN::Inflect::Number::to_S( $right );
             $CANONICRIGHTNAMES{ lc $right } = $right;
-            $CANONICRIGHTNAMES{ lc $right .'s' } = $right;
+            $CANONICRIGHTNAMES{ lc Lingua::EN::Inflect::Number::to_PL( $right ) } = $right;
         }
     }
     return $CANONICRIGHTNAMES{ lc shift };

Modified: rt/3.8/trunk/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/CustomField_Overlay.pm	Wed Mar 18 19:32:17 2009
@@ -682,7 +682,7 @@
     my $self = shift;
 
     my $ctx = $self->ContextObject
-        or return;;
+        or return;
     return ($ctx, $ctx->ACLEquivalenceObjects);
 }
 

Modified: rt/3.8/trunk/sbin/rt-test-dependencies.in
==============================================================================
--- rt/3.8/trunk/sbin/rt-test-dependencies.in	(original)
+++ rt/3.8/trunk/sbin/rt-test-dependencies.in	Wed Mar 18 19:32:17 2009
@@ -219,6 +219,7 @@
 Locale::Maketext 1.06
 Locale::Maketext::Lexicon 0.32
 Locale::Maketext::Fuzzy
+Lingua::EN::Inflect::Number
 MIME::Entity 5.425
 Mail::Mailer 1.57
 Email::Address


More information about the Rt-commit mailing list