[Rt-commit] r2445 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Mon Mar 14 03:02:24 EST 2005


Author: jesse
Date: Mon Mar 14 03:02:23 2005
New Revision: 2445

Modified:
   rt/branches/PLATANO-EXPERIMENTAL-CSS/   (props changed)
   rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/CustomField_Overlay.pm
   rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
Log:
 r8605 at hualien:  jesse | 2005-03-14 02:42:49 -0500
  r8493 at hualien:  jesse | 2005-03-14 02:28:04 -0500
   r6272 at hualien:  jesse | 2005-03-05 16:08:36 -0500
   Better support for loading custom fields by name
  
 


Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/CustomField_Overlay.pm	Mon Mar 14 03:02:23 2005
@@ -189,6 +189,24 @@
     return $rv;
 }
 
+=head2 Load ID/NAME
+
+Load a custom field.  If the value handed in is an integer, load by custom field ID. Otherwise, Load by name.
+
+=cut
+
+
+sub Load {
+    my $self = shift;
+    my $id = shift;
+
+    if ($id =~ /^\d+$/) {
+        return ($self->SUPER::Load($id));
+    } else {
+        return($self->LoadByName(Name => $id));
+    }
+}
+
 
 # {{{ sub LoadByName
 

Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm	Mon Mar 14 03:02:23 2005
@@ -1516,6 +1516,10 @@
     );
 
    # {{{ Get a custom field object from the 'Field' parameter.
+   #
+   # XXX TODO: RT should be looking for a custom field for this object 
+   # with this name, if it's a name, rather than just "Load"
+   #
     my $cf = RT::CustomField->new( $self->CurrentUser );
     if ( UNIVERSAL::isa( $args{'Field'}, "RT::CustomField" ) ) {
         $cf->Load( $args{'Field'}->id );


More information about the Rt-commit mailing list