[Rt-commit] rt branch, update-action, updated. 37e8dba49a360aedef034f97019046f736118bd9

sartak at bestpractical.com sartak at bestpractical.com
Wed Dec 9 07:56:22 EST 2009


The branch, update-action has been updated
       via  37e8dba49a360aedef034f97019046f736118bd9 (commit)
      from  34b79c37a3d1c439d75299e03294030eef8cce4d (commit)

Summary of changes:
 lib/RT/Action/TicketAction.pm |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 37e8dba49a360aedef034f97019046f736118bd9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Dec 9 07:55:40 2009 -0500

    Add canonicalizers for the time duration fields

diff --git a/lib/RT/Action/TicketAction.pm b/lib/RT/Action/TicketAction.pm
index 9c580ad..33647bd 100644
--- a/lib/RT/Action/TicketAction.pm
+++ b/lib/RT/Action/TicketAction.pm
@@ -162,6 +162,21 @@ sub _add_parameter_type {
             %args,
         ));
     };
+
+    if (my $shared_canonicalizer = $args{shared_canonicalizer}) {
+        $shared_canonicalizer = "_canonicalize_$name"
+            if $shared_canonicalizer eq '1';
+
+        unless (__PACKAGE__->can("canonicalize_$name")) {
+            *{__PACKAGE__."::canonicalize_$name"} = sub {
+                use strict 'refs';
+                my $self  = shift;
+                my $value = shift;
+
+                return $self->$shared_canonicalizer($value, @_);
+            };
+        }
+    }
 }
 
 sub _canonicalize_duration {
@@ -189,6 +204,7 @@ __PACKAGE__->_add_parameter_type(
         render_as      => 'text', # ideally would be Duration
         display_length => 3,
     },
+    shared_canonicalizer => 1,
 );
 
 __PACKAGE__->_add_parameter_type(

-----------------------------------------------------------------------


More information about the Rt-commit mailing list