[Rt-commit] rt branch, 4.2/drop-customfields-repeated, created. rt-4.1.8-262-gd360f36

Todd Wade todd at bestpractical.com
Fri May 10 14:35:57 EDT 2013


The branch, 4.2/drop-customfields-repeated has been created
        at  d360f36596263f318ff0ac0bc00dafc657d25500 (commit)

- Log -----------------------------------------------------------------
commit d360f36596263f318ff0ac0bc00dafc657d25500
Author: Todd Wade <todd at bestpractical.com>
Date:   Fri May 10 14:25:53 2013 -0400

    Drop CustomFields.Repeated
    
    Removing column because the code for this never made the UI and
    complicates an already complicated codepath.
    
    etc/shema.*
    - removed column from ddl files
    etc/upgrade
    - added DROP COLUMN commands in etc/upgrade
    lib/RT/CustomField.pm
    - removed accessors and column attributes
    lib/RT/Interface/Web.pm
    - removed logic from conditional that would have only ran if
      CustomField.Repeated was true
    
    See issues#17454

diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index 3f78236..558d38a 100755
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -371,7 +371,6 @@ CREATE TABLE CustomFields (
         RenderType      VARCHAR2(64),
         MaxValues       NUMBER(11,0) DEFAULT 0 NOT NULL,
         Pattern         CLOB,
-        Repeated        NUMBER(11,0) DEFAULT 0 NOT NULL,
         ValuesClass     VARCHAR2(64),
         BasedOn         NUMBER(11,0) NULL,
         Description     VARCHAR2(255),
diff --git a/etc/schema.Pg b/etc/schema.Pg
index b0f9662..a331d4d 100755
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -559,7 +559,6 @@ CREATE TABLE CustomFields (
   Type varchar(200) NULL  ,
   RenderType varchar(64) NULL  ,
   MaxValues integer NOT NULL DEFAULT 0  ,
-  Repeated integer NOT NULL DEFAULT 0 , 
   ValuesClass varchar(64) NULL  ,
   BasedOn integer NULL, 
   Pattern varchar(65536) NULL  ,
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
index a10a845..8e44817 100755
--- a/etc/schema.SQLite
+++ b/etc/schema.SQLite
@@ -394,7 +394,6 @@ CREATE TABLE CustomFields (
   RenderType varchar(64) NULL  ,
   MaxValues integer,            # New -- was 'Single'(1) and 'Multiple'(0)
   Pattern varchar(65536) NULL  ,        # New -- Must validate against this
-  Repeated int2 NOT NULL DEFAULT 0 , # New -- repeated table entry
   BasedOn INTEGER NULL,
   ValuesClass varchar(64) NULL  ,
   Description varchar(255) NULL  ,
diff --git a/etc/schema.mysql b/etc/schema.mysql
index bed471e..cf306f3 100755
--- a/etc/schema.mysql
+++ b/etc/schema.mysql
@@ -372,7 +372,6 @@ CREATE TABLE CustomFields (
   RenderType varchar(64) CHARACTER SET ascii NULL  ,
   MaxValues integer,            # New -- was 'Single'(1) and 'Multiple'(0)
   Pattern TEXT NULL  ,  # New -- Must validate against this
-  Repeated int2 NOT NULL DEFAULT 0 , # New -- repeated table entry
   BasedOn INTEGER NULL,
   ValuesClass varchar(64) CHARACTER SET ascii NULL  ,
   Description varchar(255) NULL  ,
diff --git a/etc/upgrade/4.1.11/schema.Oracle b/etc/upgrade/4.1.11/schema.Oracle
new file mode 100644
index 0000000..6ae68bd
--- /dev/null
+++ b/etc/upgrade/4.1.11/schema.Oracle
@@ -0,0 +1 @@
+ALTER TABLE CustomFields DROP COLUMN Repeated;
diff --git a/etc/upgrade/4.1.11/schema.Pg b/etc/upgrade/4.1.11/schema.Pg
new file mode 100644
index 0000000..6ae68bd
--- /dev/null
+++ b/etc/upgrade/4.1.11/schema.Pg
@@ -0,0 +1 @@
+ALTER TABLE CustomFields DROP COLUMN Repeated;
diff --git a/etc/upgrade/4.1.11/schema.SQLite b/etc/upgrade/4.1.11/schema.SQLite
new file mode 100644
index 0000000..6ae68bd
--- /dev/null
+++ b/etc/upgrade/4.1.11/schema.SQLite
@@ -0,0 +1 @@
+ALTER TABLE CustomFields DROP COLUMN Repeated;
diff --git a/etc/upgrade/4.1.11/schema.mysql b/etc/upgrade/4.1.11/schema.mysql
new file mode 100644
index 0000000..6ae68bd
--- /dev/null
+++ b/etc/upgrade/4.1.11/schema.mysql
@@ -0,0 +1 @@
+ALTER TABLE CustomFields DROP COLUMN Repeated;
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 97e4b26..302a822 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -287,7 +287,6 @@ Create takes a hash of values and creates a row in the database:
   varchar(200) 'Type'.
   int(11) 'MaxValues'.
   varchar(255) 'Pattern'.
-  smallint(6) 'Repeated'.
   varchar(255) 'Description'.
   int(11) 'SortOrder'.
   varchar(255) 'LookupType'.
@@ -308,7 +307,6 @@ sub Create {
         Description => '',
         Disabled    => 0,
         LookupType  => '',
-        Repeated    => 0,
         LinkValueTo => '',
         IncludeContentForValue => '',
         @_,
@@ -393,7 +391,6 @@ sub Create {
         Description => $args{'Description'},
         Disabled    => $args{'Disabled'},
         LookupType  => $args{'LookupType'},
-        Repeated    => $args{'Repeated'},
     );
 
     if ($rv) {
@@ -1978,24 +1975,6 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
 =cut
 
 
-=head2 Repeated
-
-Returns the current value of Repeated. 
-(In the database, Repeated is stored as smallint(6).)
-
-
-
-=head2 SetRepeated VALUE
-
-
-Set Repeated to VALUE. 
-Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
-(In the database, Repeated will be stored as a smallint(6).)
-
-
-=cut
-
-
 =head2 BasedOn
 
 Returns the current value of BasedOn. 
@@ -2138,8 +2117,6 @@ sub _CoreAccessible {
         {read => 1, write => 1, sql_type => 4, length => 11,  is_blob => 0,  is_numeric => 1,  type => 'int(11)', default => ''},
         Pattern => 
         {read => 1, write => 1, sql_type => -4, length => 0,  is_blob => 1,  is_numeric => 0,  type => 'text', default => ''},
-        Repeated => 
-        {read => 1, write => 1, sql_type => 5, length => 6,  is_blob => 0,  is_numeric => 1,  type => 'smallint(6)', default => '0'},
         ValuesClass => 
         {read => 1, write => 1, sql_type => 12, length => 64,  is_blob => 0,  is_numeric => 0,  type => 'varchar(64)', default => ''},
         BasedOn => 
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index c64f70a..bef139f 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3021,7 +3021,7 @@ sub _ProcessObjectCustomFieldUpdates {
                 );
                 push( @results, $msg );
             }
-        } elsif ( $arg eq 'Values' && !$cf->Repeated ) {
+        } elsif ( $arg eq 'Values' ) {
             my $cf_values = $args{'Object'}->CustomFieldValues( $cf->id );
 
             my %values_hash;
@@ -3052,29 +3052,6 @@ sub _ProcessObjectCustomFieldUpdates {
                 );
                 push( @results, $msg );
             }
-        } elsif ( $arg eq 'Values' ) {
-            my $cf_values = $args{'Object'}->CustomFieldValues( $cf->id );
-
-            # keep everything up to the point of difference, delete the rest
-            my $delete_flag;
-            foreach my $old_cf ( @{ $cf_values->ItemsArrayRef } ) {
-                if ( !$delete_flag and @values and $old_cf->Content eq $values[0] ) {
-                    shift @values;
-                    next;
-                }
-
-                $delete_flag ||= 1;
-                $old_cf->Delete;
-            }
-
-            # now add/replace extra things, if any
-            foreach my $value (@values) {
-                my ( $val, $msg ) = $args{'Object'}->AddCustomFieldValue(
-                    Field => $cf,
-                    Value => $value
-                );
-                push( @results, $msg );
-            }
         } else {
             push(
                 @results,

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


More information about the Rt-commit mailing list