[rt-commit] [svn] r486 - in rt/branches: . autrijus-3.1/html/Elements autrijus-3.1/html/Elements/CustomField autrijus-3.1/lib/RT autrijus-3.1/lib/RT/I18N autrijus-3.1/lib/RT/Interface

autrijus at fsck.com autrijus at fsck.com
Sun Mar 7 04:04:26 EST 2004


Author: autrijus
Date: Sun Mar  7 04:04:25 2004
New Revision: 486

Added:
   rt/branches/autrijus-3.1/html/Elements/EditCustomFieldBinary
   rt/branches/autrijus-3.1/html/Elements/EditCustomFieldFreeform
   rt/branches/autrijus-3.1/html/Elements/EditCustomFieldImage
   rt/branches/autrijus-3.1/html/Elements/EditCustomFieldSelect
   rt/branches/autrijus-3.1/html/Elements/EditCustomFieldText
Removed:
   rt/branches/autrijus-3.1/html/Elements/CustomField/
Modified:
   rt/branches/   (props changed)
   rt/branches/autrijus-3.1/html/Elements/EditCustomField
   rt/branches/autrijus-3.1/lib/RT/CustomField_Overlay.pm
   rt/branches/autrijus-3.1/lib/RT/CustomFields_Overlay.pm
   rt/branches/autrijus-3.1/lib/RT/I18N/zh_tw.po
   rt/branches/autrijus-3.1/lib/RT/Interface/Web.pm
   rt/branches/autrijus-3.1/lib/RT/ObjectCustomFieldValues_Overlay.pm
   rt/branches/autrijus-3.1/lib/RT/Record.pm
Log:
* refactor -Multiple and -Single out to types
* implement the rest of CF sorting and display
* ProcessTicketCustomFieldUpdates refactored to be a wrapper around 
  the new ProcessObjectCustomFieldUpdates.


Modified: rt/branches/autrijus-3.1/html/Elements/EditCustomField
==============================================================================
--- rt/branches/autrijus-3.1/html/Elements/EditCustomField	(original)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomField	Sun Mar  7 04:04:25 2004
@@ -68,18 +68,19 @@
 }
 my $Type = $CustomField->Type;
 my $MaxValues = $CustomField->MaxValues;
-$Type .= ($MaxValues > 1) ? 'Some' : $MaxValues ? 'Single' : 'Multiple';
 if ($MaxValues == 1 and $Object and $Values) {
     $Default = ($Values->Count ? $Values->First->Content : '');
 }
 return $m->comp(
-    "/Elements/CustomField/$Type",
+    "EditCustomField$Type",
     %ARGS,
     Rows => $Rows,
     Cols => $Cols,
     Default => $Default,
     Object => $Object,
     Values => $Values,
+    MaxValues => $MaxValues,
+    Multiple => ($MaxValues != 1),
     NamePrefix => $NamePrefix,
     CustomField => $CustomField,
 );

Added: rt/branches/autrijus-3.1/html/Elements/EditCustomFieldBinary
==============================================================================
--- (empty file)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomFieldBinary	Sun Mar  7 04:04:25 2004
@@ -0,0 +1,39 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+% if ($Multiple) {
+<input type="hidden" name="<%$NamePrefix%><%$CustomField->Id%>-Values-Magic" value="1">
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$Default%></textarea>
+% } else {
+<input name="<%$NamePrefix%><%$CustomField->Id%>-Value" size="<%$Cols%>" value="<%$Default ? $Default : ''%>">
+% }
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$Multiple => undef
+$Cols
+$Rows
+</%ARGS>

Added: rt/branches/autrijus-3.1/html/Elements/EditCustomFieldFreeform
==============================================================================
--- (empty file)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomFieldFreeform	Sun Mar  7 04:04:25 2004
@@ -0,0 +1,47 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+% if ($Multiple) {
+<input type="hidden" name="<%$NamePrefix%><%$CustomField->Id%>-Values-Magic" value="1">
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$Default%></textarea>
+% } else {
+<input name="<%$NamePrefix%><%$CustomField->Id%>-Value" size="<%$Cols%>" value="<%$Default ? $Default : ''%>">
+% }
+<%INIT>
+if ($Multiple and $Values) {
+    $Default = '';
+    while (my $value = $Values->Next ) {
+	$Default .= $value->Content;
+    }
+}
+</%INIT>
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$Multiple => undef
+$Cols
+$Rows
+</%ARGS>

Added: rt/branches/autrijus-3.1/html/Elements/EditCustomFieldImage
==============================================================================
--- (empty file)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomFieldImage	Sun Mar  7 04:04:25 2004
@@ -0,0 +1,47 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+% if ($Multiple) {
+<input type="hidden" name="<%$NamePrefix%><%$CustomField->Id%>-Values-Magic" value="1">
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$Default%></textarea>
+% } else {
+<input name="<%$NamePrefix%><%$CustomField->Id%>-Value" size="<%$Cols%>" value="<%$Default ? $Default : ''%>">
+% }
+<%INIT>
+if ($Multiple and $Values) {
+    $Default = '';
+    while (my $value = $Values->Next ) {
+	$Default .= $value->Content;
+    }
+}
+</%INIT>
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$Multiple => undef
+$Cols
+$Rows
+</%ARGS>

Added: rt/branches/autrijus-3.1/html/Elements/EditCustomFieldSelect
==============================================================================
--- (empty file)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomFieldSelect	Sun Mar  7 04:04:25 2004
@@ -0,0 +1,50 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+      <input type="hidden" name="<%$NamePrefix%><%$CustomField->Id%>-Values-Magic" value="1">
+      <select name="<%$NamePrefix%><%$CustomField->Id%>-Values"
+        size="<%$Rows%>"
+        <% $Multiple && 'MULTIPLE' %>>
+% my $CustomFieldValues = $CustomField->Values();
+% my $selected;
+% while (my $value = $CustomFieldValues->Next) {
+        <option value="<%$value->Name%>" 
+% if ($Values) {
+            <% $Values->HasEntry($value->Name) && ($selected = 1) && 'SELECTED' %>
+% } elsif ($Default) {
+            <% ($Default eq $value->Name) && ($selected = 1) && 'SELECTED' %>
+% }
+            ><% $value->Name%></option>
+% }
+        <option value="" <% !$selected && 'SELECTED' %>><&|/l&>(no value)</&></option>
+      </select>
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$Multiple => 0
+$Cols
+$Rows
+</%ARGS>

Added: rt/branches/autrijus-3.1/html/Elements/EditCustomFieldText
==============================================================================
--- (empty file)
+++ rt/branches/autrijus-3.1/html/Elements/EditCustomFieldText	Sun Mar  7 04:04:25 2004
@@ -0,0 +1,47 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+% if ($Multiple) {
+<input type="hidden" name="<%$NamePrefix%><%$CustomField->Id%>-Values-Magic" value="1">
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$Default%></textarea>
+% } else {
+<input name="<%$NamePrefix%><%$CustomField->Id%>-Value" size="<%$Cols%>" value="<%$Default ? $Default : ''%>">
+% }
+<%INIT>
+if ($Multiple and $Values) {
+    $Default = '';
+    while (my $value = $Values->Next ) {
+	$Default .= $value->Content;
+    }
+}
+</%INIT>
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$Multiple => undef
+$Cols
+$Rows
+</%ARGS>

Modified: rt/branches/autrijus-3.1/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/autrijus-3.1/lib/RT/CustomField_Overlay.pm	Sun Mar  7 04:04:25 2004
@@ -32,8 +32,8 @@
 # Enumerate all valid types for this custom field
 @TYPES = (
     'Freeform',	# loc
-    'Text',     # loc
     'Select',	# loc
+    'Text',     # loc
     'Image',    # loc
     'Binary',   # loc
 );
@@ -478,9 +478,9 @@
         'Enter up to [_1] values',	# loc
     ],
     Text => [
-        'Enter multiple text areas',	# loc
-        'Enter one text area',		# loc
-        'Enter up to [_1] text areas',	# loc
+        'Fill in multiple text areas',	# loc
+        'Fill in one text area',	# loc
+        'Fill in up to [_1] text areas',# loc
     ],
     Image => [
         'Upload multiple images',	# loc

Modified: rt/branches/autrijus-3.1/lib/RT/CustomFields_Overlay.pm
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/CustomFields_Overlay.pm	(original)
+++ rt/branches/autrijus-3.1/lib/RT/CustomFields_Overlay.pm	Sun Mar  7 04:04:25 2004
@@ -222,6 +222,10 @@
                  OPERATOR        => '=',
                  VALUE           => 0,
                  ENTRYAGGREGATOR => 'OR' ) if $id;
+    $self->OrderByCols(
+	{ ALIAS => $self->_OCFAlias, FIELD => 'ObjectId' },
+	{ ALIAS => $self->_OCFAlias, FIELD => 'SortOrder' },
+    );
     
     # This doesn't work on postgres. 
     #$self->OrderBy( ALIAS => $class_cfs , FIELD => "SortOrder", ORDER => 'ASC');

Modified: rt/branches/autrijus-3.1/lib/RT/I18N/zh_tw.po
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/I18N/zh_tw.po	(original)
+++ rt/branches/autrijus-3.1/lib/RT/I18N/zh_tw.po	Sun Mar  7 04:04:25 2004
@@ -2452,20 +2452,20 @@
 msgstr "英文姓名"
 
 #: lib/RT/CustomField_Overlay.pm:481
-msgid "Enter multiple text areas"
-msgstr ""
+msgid "Fill in multiple text areas"
+msgstr "填入多個文字方塊"
 
 #: lib/RT/CustomField_Overlay.pm:476
 msgid "Enter multiple values"
-msgstr "鍵入多重項目"
+msgstr "鍵入多個項目"
 
 #: NOT FOUND IN SOURCE
 msgid "Enter one or more conditions below to search for users"
 msgstr "輸入下列單一或複式條件,查詢用戶資料"
 
 #: lib/RT/CustomField_Overlay.pm:482
-msgid "Enter one text area"
-msgstr ""
+msgid "Fill in one text area"
+msgstr "填入單一文字方塊"
 
 #: lib/RT/CustomField_Overlay.pm:477
 msgid "Enter one value"
@@ -2476,12 +2476,12 @@
 msgstr "輸入申請單可鏈結到的申請單編號或網址。以空白隔開。"
 
 #: lib/RT/CustomField_Overlay.pm:483
-msgid "Enter up to %1 text areas"
-msgstr ""
+msgid "Fill in up to %1 text areas"
+msgstr "填入最多 %1 個文字方塊"
 
 #: lib/RT/CustomField_Overlay.pm:478
 msgid "Enter up to %1 values"
-msgstr ""
+msgstr "鍵入最多 %1 個項目"
 
 #: NOT FOUND IN SOURCE
 msgid "EntryBoolean"
@@ -5495,7 +5495,7 @@
 
 #: lib/RT/CustomField_Overlay.pm:471
 msgid "Select multiple values"
-msgstr "選擇多重項目"
+msgstr "選擇多個項目"
 
 #: lib/RT/CustomField_Overlay.pm:472
 msgid "Select one value"
@@ -6489,27 +6489,27 @@
 
 #: lib/RT/CustomField_Overlay.pm:491
 msgid "Upload multiple files"
-msgstr ""
+msgstr "上傳多份檔案"
 
 #: lib/RT/CustomField_Overlay.pm:486
 msgid "Upload multiple images"
-msgstr ""
+msgstr "上傳多張圖片"
 
 #: lib/RT/CustomField_Overlay.pm:492
 msgid "Upload one files"
-msgstr ""
+msgstr "上傳單一檔案"
 
 #: lib/RT/CustomField_Overlay.pm:487
 msgid "Upload one image"
-msgstr ""
+msgstr "上傳單一圖片"
 
 #: lib/RT/CustomField_Overlay.pm:493
 msgid "Upload up to %1 files"
-msgstr ""
+msgstr "上傳最多 %1 份檔案"
 
 #: lib/RT/CustomField_Overlay.pm:488
 msgid "Upload up to %1 images"
-msgstr ""
+msgstr "上傳最多 %1 張圖片"
 
 #: NOT FOUND IN SOURCE
 msgid "User"

Modified: rt/branches/autrijus-3.1/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/autrijus-3.1/lib/RT/Interface/Web.pm	Sun Mar  7 04:04:25 2004
@@ -1096,23 +1096,32 @@
 
 # }}}
 
-sub ProcessObjectCustomFieldUpdates {
-    my %args = (
-        ARGSRef => undef,
-        @_
-    );
+sub ProcessTicketCustomFieldUpdates {
+    my %args = @_;
+    $args{'Object'} = delete $args{'TicketObj'};
+    my $ARGSRef = { %{ $args{'ARGSRef'} } };
 
-    my @results;
+    # Build up a list of objects that we want to work with
+    my %custom_fields_to_mod;
+    foreach my $arg ( keys %$ARGSRef ) {
+        if ( $arg =~ /^Ticket-(\d+-.*)/) {
+	    $ARGSRef->{"Object-RT::Ticket-$1"} = delete $ARGSRef->{$arg};
+	}
+    }
+
+    return ProcessObjectCustomFieldUpdates(%args, ARGSRef => $ARGSRef);
+}
 
+sub ProcessObjectCustomFieldUpdates {
+    my %args = @_;
     my $ARGSRef = $args{'ARGSRef'};
+    my @results;
 
-    # Build up a list of tickets that we want to work with
-    my %tickets_to_mod;
+    # Build up a list of objects that we want to work with
     my %custom_fields_to_mod;
-    foreach my $arg ( keys %{$ARGSRef} ) {
+    foreach my $arg ( keys %$ARGSRef ) {
         if ( $arg =~ /^Object-([\w:]+)-(\d+)-CustomField-(\d+)-/ ) {
-
-            # For each of those tickets, find out what custom fields we want to work with.
+            # For each of those objects, find out what custom fields we want to work with.
             $custom_fields_to_mod{$1}{$2}{$3} = 1;
         }
     }
@@ -1230,145 +1239,6 @@
 	}
     }
 }
-
-# {{{ Sub ProcessTicketCustomFieldUpdates
-
-sub ProcessTicketCustomFieldUpdates {
-    my %args = (
-        ARGSRef => undef,
-        @_
-    );
-
-    my @results;
-
-    my $ARGSRef = $args{'ARGSRef'};
-
-    # Build up a list of tickets that we want to work with
-    my %tickets_to_mod;
-    my %custom_fields_to_mod;
-    foreach my $arg ( keys %{$ARGSRef} ) {
-        if ( $arg =~ /^Ticket-(\d+)-CustomField-(\d+)-/ ) {
-
-            # For each of those tickets, find out what custom fields we want to work with.
-            $custom_fields_to_mod{$1}{$2} = 1;
-        }
-    }
-
-    # For each of those tickets
-    foreach my $tick ( keys %custom_fields_to_mod ) {
-        my $Ticket = $args{'TicketObj'};
-	if (!$Ticket or $Ticket->id != $tick) {
-	    $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
-	    $Ticket->Load($tick);
-	}
-
-        # For each custom field  
-        foreach my $cf ( keys %{ $custom_fields_to_mod{$tick} } ) {
-
-	    my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
-	    $CustomFieldObj->LoadById($cf);
-
-            foreach my $arg ( keys %{$ARGSRef} ) {
-                # since http won't pass in a form element with a null value, we need
-                # to fake it
-                if ($arg =~ /^(.*?)-Values-Magic$/ ) {
-                    # We don't care about the magic, if there's really a values element;
-                    next if (exists $ARGSRef->{$1.'-Values'}) ;
-
-                    $arg = $1."-Values";
-                    $ARGSRef->{$1."-Values"} = undef;
-                
-                }
-                next unless ( $arg =~ /^Ticket-$tick-CustomField-$cf-/ );
-                my @values =
-                  ( ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) 
-                  ? @{ $ARGSRef->{$arg} }
-                  : split /\n/, $ARGSRef->{$arg} ;
-                if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) {
-                    foreach my $value (@values) {
-                        next unless length($value);
-                        my ( $val, $msg ) = $Ticket->AddCustomFieldValue(
-                            Field => $cf,
-                            Value => $value
-                        );
-                        push ( @results, $msg );
-                    }
-                }
-                elsif ( $arg =~ /-DeleteValues$/ ) {
-                    foreach my $value (@values) {
-                        next unless length($value);
-                        my ( $val, $msg ) = $Ticket->DeleteCustomFieldValue(
-                            Field => $cf,
-                            Value => $value
-                        );
-                        push ( @results, $msg );
-                    }
-                }
-                elsif ( $arg =~ /-Values$/ and $CustomFieldObj->Type !~ /Entry/) {
-                    my $cf_values = $Ticket->CustomFieldValues($cf);
-
-                    my %values_hash;
-                    foreach my $value (@values) {
-                        next unless length($value);
-
-                        # build up a hash of values that the new set has
-                        $values_hash{$value} = 1;
-
-                        unless ( $cf_values->HasEntry($value) ) {
-                            my ( $val, $msg ) = $Ticket->AddCustomFieldValue(
-                                Field => $cf,
-                                Value => $value
-                            );
-                            push ( @results, $msg );
-                        }
-
-                    }
-                    while ( my $cf_value = $cf_values->Next ) {
-                        unless ( $values_hash{ $cf_value->Content } == 1 ) {
-                            my ( $val, $msg ) = $Ticket->DeleteCustomFieldValue(
-                                Field => $cf,
-                                Value => $cf_value->Content
-                            );
-                            push ( @results, $msg);
-
-                        }
-
-                    }
-                }
-                elsif ( $arg =~ /-Values$/ ) {
-                    my $cf_values = $Ticket->CustomFieldValues($cf);
-
-		    # 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 ) = $Ticket->AddCustomFieldValue(
-			    Field => $cf,
-			    Value => $value
-			);
-			push ( @results, $msg );
-		    }
-		}
-                else {
-                    push ( @results, "User asked for an unknown update type for custom field " . $cf->Name . " for ticket " . $Ticket->id );
-                }
-            }
-        }
-        return (@results);
-    }
-}
-
-# }}}
 
 # {{{ sub ProcessTicketWatchers
 

Modified: rt/branches/autrijus-3.1/lib/RT/ObjectCustomFieldValues_Overlay.pm
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/ObjectCustomFieldValues_Overlay.pm	(original)
+++ rt/branches/autrijus-3.1/lib/RT/ObjectCustomFieldValues_Overlay.pm	Sun Mar  7 04:04:25 2004
@@ -97,5 +97,25 @@
 
 }
 
+sub _DoSearch {
+    my $self = shift;
+    
+    #unless we really want to find disabled rows, make sure we\'re only finding enabled ones.
+    unless($self->{'find_expired_rows'}) {
+        $self->LimitToCurrent();
+    }
+    
+    return($self->SUPER::_DoSearch(@_));
+    
+}
+
+sub LimitToCurrent {
+    my $self = shift;
+    
+    $self->Limit( FIELD => 'Current',
+		  VALUE => '1',
+		  OPERATOR => '=' );
+}
+
 1;
 

Modified: rt/branches/autrijus-3.1/lib/RT/Record.pm
==============================================================================
--- rt/branches/autrijus-3.1/lib/RT/Record.pm	(original)
+++ rt/branches/autrijus-3.1/lib/RT/Record.pm	Sun Mar  7 04:04:25 2004
@@ -683,6 +683,7 @@
 	$cfs->LimitToLookupType($lookup);
 	$cfs->LimitToGlobalOrObjectId($self->_LookupId($lookup));
     }
+
     return $cfs;
 }
 



More information about the Rt-commit mailing list