[Rt-commit] r10539 - rt/branches/3.999-DANGEROUS/lib/RT/Model

ruz at bestpractical.com ruz at bestpractical.com
Mon Jan 28 17:57:16 EST 2008


Author: ruz
Date: Mon Jan 28 17:57:15 2008
New Revision: 10539

Modified:
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValue.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomField.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm

Log:
* CustomField -> custom_field

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	Mon Jan 28 17:57:15 2008
@@ -63,7 +63,7 @@
 use Jifty::DBI::Record schema {
 
     column name => max_length is 200, type is 'varchar(200)', default is '';
-    column Type => max_length is 200, type is 'varchar(200)', default is '';
+    column type => max_length is 200, type is 'varchar(200)', default is '';
     column MaxValues => max_length is 11, type is 'int(11)', default is '0';
     column Pattern => type is 'longtext', default is '';
     column Repeated => max_length is 6, type is 'smallint(6)', default is '0';
@@ -169,7 +169,7 @@
 Create takes a hash of values and creates a row in the database:
 
   varchar(200) 'name'.
-  varchar(200) 'Type'.
+  varchar(200) 'type'.
   int(11) 'MaxValues'.
   varchar(255) 'Pattern'.
   smallint(6) 'Repeated'.
@@ -187,7 +187,7 @@
     my $self = shift;
     my %args = (
         name        => '',
-        Type        => '',
+        type        => '',
         MaxValues   => 0,
         Pattern     => '',
         Description => '',
@@ -208,10 +208,10 @@
     }
 
     if ( $args{TypeComposite} ) {
-        @args{ 'Type', 'MaxValues' } = split( /-/, $args{TypeComposite}, 2 );
-    } elsif ( $args{Type} =~ s/(?:(Single)|Multiple)$// ) {
+        @args{ 'type', 'MaxValues' } = split( /-/, $args{TypeComposite}, 2 );
+    } elsif ( $args{type} =~ s/(?:(Single)|Multiple)$// ) {
 
-        # old style Type string
+        # old style type string
         $args{'MaxValues'} = $1 ? 1 : 0;
     }
 
@@ -247,7 +247,7 @@
 
     ( my $rv, $msg ) = $self->SUPER::create(
         name        => $args{'name'},
-        Type        => $args{'Type'},
+        type        => $args{'type'},
         MaxValues   => $args{'MaxValues'},
         Pattern     => $args{'Pattern'},
         Description => $args{'Description'},
@@ -265,7 +265,7 @@
     # Compat code -- create a new ObjectCustomField mapping
     my $OCF = RT::Model::ObjectCustomField->new;
     $OCF->create(
-        CustomField => $self->id,
+        custom_field => $self->id,
         object_id   => $args{'Queue'},
     );
 
@@ -407,7 +407,7 @@
     }
 
     my $newval = RT::Model::CustomFieldValue->new;
-    return $newval->create( %args, CustomField => $self->id );
+    return $newval->create( %args, custom_field => $self->id );
 }
 
 # }}}
@@ -577,7 +577,7 @@
 
     if ( $type =~ s/(?:Single|Multiple)$// ) {
         Jifty->log->warn(
-            "Prefix 'Single' and 'Multiple' to Type deprecated, use MaxValues instead at ("
+            "Prefix 'Single' and 'Multiple' to type deprecated, use MaxValues instead at ("
                 . join( ":", caller )
                 . ")" );
     }
@@ -599,7 +599,7 @@
                 . ")" );
         $self->set_MaxValues( $1 ? 1 : 0 );
     }
-    $self->_set( column => 'Type', value => $type );
+    $self->_set( column => 'type', value => $type );
 }
 
 =head2 SetPattern STRING
@@ -771,7 +771,7 @@
     }
     return 1,
         _(
-        "Type changed from '%1' to '%2'",
+        "type changed from '%1' to '%2'",
         $self->friendly_type_composite($old),
         $self->friendly_type_composite($composite),
         );
@@ -876,12 +876,12 @@
     }
 
     my $ObjectCF = RT::Model::ObjectCustomField->new;
-    $ObjectCF->load_by_cols( object_id => $id, CustomField => $self->id );
+    $ObjectCF->load_by_cols( object_id => $id, custom_field => $self->id );
     if ( $ObjectCF->id ) {
         return ( 0, _("That is already the current value") );
     }
     my ( $oid, $msg )
-        = $ObjectCF->create( object_id => $id, CustomField => $self->id );
+        = $ObjectCF->create( object_id => $id, custom_field => $self->id );
 
     return ( $oid, $msg );
 }
@@ -908,7 +908,7 @@
     }
 
     my $ObjectCF = RT::Model::ObjectCustomField->new;
-    $ObjectCF->load_by_cols( object_id => $id, CustomField => $self->id );
+    $ObjectCF->load_by_cols( object_id => $id, custom_field => $self->id );
     unless ( $ObjectCF->id ) {
         return ( 0, _("This custom field does not apply to that object") );
     }
@@ -988,7 +988,7 @@
         Content      => $args{'Content'},
         LargeContent => $args{'LargeContent'},
         ContentType  => $args{'ContentType'},
-        CustomField  => $self->id
+        custom_field  => $self->id
     );
 
     unless ($val) {
@@ -1076,7 +1076,7 @@
         $oldval->load_by_object_content_and_custom_field(
             Object      => $args{'Object'},
             Content     => $args{'Content'},
-            CustomField => $self->id,
+            custom_field => $self->id,
         );
     }
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldCollection.pm	Mon Jan 28 17:57:15 2008
@@ -78,7 +78,7 @@
             alias1  => 'main',
             column1 => 'id',
             alias2  => $self->ocf_alias,
-            column2 => 'CustomField'
+            column2 => 'custom_field'
         );
     }
     return ( $self->{_sql_ocfalias} );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValue.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValue.pm	Mon Jan 28 17:57:15 2008
@@ -63,7 +63,7 @@
         LastUpdatedBy => type is 'int(11)',
         max_length is 11, default is '0';
     column SortOrder   => type is 'int(11)', max_length is 11, default is '0';
-    column CustomField => type is 'int(11)', max_length is 11, default is '0';
+    column custom_field => type is 'int(11)', max_length is 11, default is '0';
     column Created     => type is 'datetime', default is '';
     column LastUpdated => type is 'datetime', default is '';
     column name => type is 'varchar(200)', max_length is 200, default is '';
@@ -83,7 +83,7 @@
 sub create {
     my $self = shift;
     my %args = (
-        CustomField => 0,
+        custom_field => 0,
         name        => '',
         Description => '',
         SortOrder   => 0,
@@ -92,9 +92,9 @@
     );
 
     my $cf_id
-        = ref $args{'CustomField'}
-        ? $args{'CustomField'}->id
-        : $args{'CustomField'};
+        = ref $args{'custom_field'}
+        ? $args{'custom_field'}->id
+        : $args{'custom_field'};
 
     my $cf = RT::Model::CustomField->new;
     $cf->load($cf_id);
@@ -106,7 +106,7 @@
     }
 
     my ( $id, $msg ) = $self->SUPER::create(
-        CustomField => $cf_id,
+        custom_field => $cf_id,
         map { $_ => $args{$_} } qw(name Description SortOrder)
     );
     return ( $id, $msg ) unless $id;

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm	Mon Jan 28 17:57:15 2008
@@ -65,7 +65,7 @@
     my $self = shift;
     my $cf   = shift;
     $self->limit(
-        column   => 'CustomField',
+        column   => 'custom_field',
         value    => $cf,
         operator => '=',
     );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomField.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomField.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomField.pm	Mon Jan 28 17:57:15 2008
@@ -57,7 +57,7 @@
 sub table {'ObjectCustomFields'}
 use Jifty::DBI::Schema;
 use Jifty::DBI::Record schema {
-    column CustomField => type is 'int(11)', max_length is 11, default is '0';
+    column custom_field => type is 'int(11)', max_length is 11, default is '0';
     column Creator     => type is 'int(11)', max_length is 11, default is '0';
     column object_id   => type is 'int(11)', max_length is 11, default is '0';
     column
@@ -72,16 +72,16 @@
 sub create {
     my $self = shift;
     my %args = (
-        CustomField => 0,
+        custom_field => 0,
         object_id   => 0,
         SortOrder   => undef,
         @_
     );
 
-    my $cf = $self->custom_field_obj( $args{'CustomField'} );
+    my $cf = $self->custom_field_obj( $args{'custom_field'} );
     unless ( $cf->id ) {
         Jifty->log->error(
-            "Couldn't load '$args{'CustomField'}' custom field");
+            "Couldn't load '$args{'custom_field'}' custom field");
         return 0;
     }
 
@@ -110,7 +110,7 @@
     }
 
     return $self->SUPER::create(
-        CustomField => $args{'CustomField'},
+        custom_field => $args{'custom_field'},
         object_id   => $args{'object_id'},
         SortOrder   => $args{'SortOrder'},
     );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm	Mon Jan 28 17:57:15 2008
@@ -55,7 +55,7 @@
 sub limit_to_custom_field {
     my $self = shift;
     my $id   = shift;
-    $self->limit( column => 'CustomField', value => $id );
+    $self->limit( column => 'custom_field', value => $id );
 }
 
 sub limit_to_object_id {
@@ -70,7 +70,7 @@
 
     $self->{'_cfs_alias'} ||= $self->join(
         alias1  => 'main',
-        column1 => 'CustomField',
+        column1 => 'custom_field',
         table2  => 'CustomFields',
         column2 => 'id',
     );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm	Mon Jan 28 17:57:15 2008
@@ -69,7 +69,7 @@
     column disabled => type is 'smallint(6)', max_length is 6, default is '0';
     column SortOrder => type is 'int(11)', max_length is 11, default is '0';
     column Created => type is 'datetime', default is '';
-    column CustomField => type is 'int(11)', max_length is 11, default is '0';
+    column custom_field => type is 'int(11)', max_length is 11, default is '0';
     column
         Content => type is 'varchar(255)',
         max_length is 255, default is '';
@@ -88,7 +88,7 @@
     my $self = shift;
     unless ( $self->{cf} ) {
         $self->{cf} = RT::Model::CustomField->new;
-        $self->{cf}->load( $self->CustomField );
+        $self->{cf}->load( $self->custom_field );
     }
     return $self->{cf};
 }
@@ -96,7 +96,7 @@
 sub create {
     my $self = shift;
     my %args = (
-        CustomField     => 0,
+        custom_field     => 0,
         object_type     => '',
         object_id       => 0,
         disabled        => 0,
@@ -123,7 +123,7 @@
         if defined $args{'LargeContent'};
 
     return $self->SUPER::create(
-        CustomField     => $args{'CustomField'},
+        custom_field     => $args{'custom_field'},
         object_type     => $args{'object_type'},
         object_id       => $args{'object_id'},
         disabled        => $args{'disabled'},
@@ -140,9 +140,9 @@
         $self->_value( 'LargeContent', decode_utf8 => 0 ) );
 }
 
-=head2 LoadByTicketContentAndCustomField { Ticket => TICKET, CustomField => customfield, Content => CONTENT }
+=head2 LoadByTicketContentAndCustomField { Ticket => TICKET, custom_field => customfield, Content => CONTENT }
 
-Loads a custom field value by Ticket, Content and which CustomField it's tied to
+Loads a custom field value by Ticket, Content and which custom_field it's tied to
 
 =cut
 
@@ -150,14 +150,14 @@
     my $self = shift;
     my %args = (
         Ticket      => undef,
-        CustomField => undef,
+        custom_field => undef,
         Content     => undef,
         @_
     );
 
     return $self->load_by_cols(
         Content     => $args{'Content'},
-        CustomField => $args{'CustomField'},
+        custom_field => $args{'custom_field'},
         object_type => 'RT::Model::Ticket',
         object_id   => $args{'Ticket'},
         disabled    => 0
@@ -168,7 +168,7 @@
     my $self = shift;
     my %args = (
         Object      => undef,
-        CustomField => undef,
+        custom_field => undef,
         Content     => undef,
         @_
     );
@@ -177,7 +177,7 @@
 
     return $self->load_by_cols(
         Content     => $args{'Content'},
-        CustomField => $args{'CustomField'},
+        custom_field => $args{'custom_field'},
         object_type => ref($obj),
         object_id   => $obj->id,
         disabled    => 0

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm	Mon Jan 28 17:57:15 2008
@@ -65,7 +65,7 @@
     my $self = shift;
     my $cf   = shift;
     return $self->limit(
-        column => 'CustomField',
+        column => 'custom_field',
         value  => $cf,
     );
 }

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm	Mon Jan 28 17:57:15 2008
@@ -1241,7 +1241,7 @@
         );
         $self->SUPER::limit(
             leftjoin         => $TicketCFs,
-            column           => 'CustomField',
+            column           => 'custom_field',
             value            => $cfid,
             entry_aggregator => 'AND'
         );
@@ -1263,7 +1263,7 @@
         $CFs = $self->{_sql_cf_alias}{$cfkey} = $self->join(
             type    => 'left',
             alias1  => $ocfalias,
-            column1 => 'CustomField',
+            column1 => 'custom_field',
             table2  => 'CustomFields',
             column2 => 'id',
         );
@@ -1273,7 +1273,7 @@
             alias1  => $CFs,
             column1 => 'id',
             table2  => 'Objectcustom_field_values',
-            column2 => 'CustomField',
+            column2 => 'custom_field',
         );
         $self->SUPER::limit(
             leftjoin         => $TicketCFs,
@@ -1427,9 +1427,9 @@
             my $CFvs = $self->join(
                 type    => 'left',
                 alias1  => $TicketCFs,
-                column1 => 'CustomField',
+                column1 => 'custom_field',
                 table2  => 'custom_field_values',
-                column2 => 'CustomField',
+                column2 => 'custom_field',
             );
             $self->SUPER::limit(
                 leftjoin         => $CFvs,


More information about the Rt-commit mailing list