[Rt-commit] rt branch, 4.2/remove-deprecations, created. rt-4.0.6-456-g1a8944f

Alex Vandiver alexmv at bestpractical.com
Thu Aug 9 13:50:42 EDT 2012


The branch, 4.2/remove-deprecations has been created
        at  1a8944fef8189bcad27dfb8e44c03ec0d2b66c30 (commit)

- Log -----------------------------------------------------------------
commit 71f52063b3819dede3eafcabd79d24dddb2c10ea
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 17:57:29 2012 -0700

    Stop warning on four configuration options removed in 4.0
    
    ResolveDefaultUpdateType, ActiveStatus, and InactiveStatus begin warning
    about their deprecation in 4.0; remove them entirely.
    
    Additionally, stop warning about the inclusion of RTFM, a deprecation
    warning which was also added in RT 4.0.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 1203e1c..be968a2 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2695,11 +2695,4 @@ only one of the link transactions to have scrips run.
 
 Set($LinkTransactionsRun1Scrip, 0);
 
-=item C<$ResolveDefaultUpdateType>
-
-This option has been deprecated.  You can configure this site-wide
-with L</Lifecycles> (see L</Labeling and defining actions>).
-
-=cut
-
 1;
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index deb099b..ab70d7d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -579,16 +579,6 @@ our %META = (
         },
     },
     MailPlugins  => { Type => 'ARRAY' },
-    Plugins      => {
-        Type => 'ARRAY',
-        PostLoadCheck => sub {
-            my $self = shift;
-            my $value = $self->Get('Plugins');
-            # XXX Remove in RT 4.2
-            return unless $value and grep {$_ eq "RT::FM"} @{$value};
-            warn 'RTFM has been integrated into core RT, and must be removed from your @Plugins';
-        },
-    },
     GnuPG        => { Type => 'HASH' },
     GnuPGOptions => { Type => 'HASH',
         PostLoadCheck => sub {
@@ -616,15 +606,6 @@ our %META = (
         }
     },
     ReferrerWhitelist => { Type => 'ARRAY' },
-    ResolveDefaultUpdateType => {
-        PostLoadCheck => sub {
-            my $self  = shift;
-            my $value = shift;
-            return unless $value;
-            $RT::Logger->info('The ResolveDefaultUpdateType config option has been deprecated.  '.
-                              'You can change the site default in your %Lifecycles config.');
-        }
-    },
     WebPath => {
         PostLoadCheck => sub {
             my $self  = shift;
@@ -778,32 +759,6 @@ our %META = (
                 if $self->Meta('LogToScreen')->{'Source'}{'Package'};
         },
     },
-    ActiveStatus => {
-        Type => 'ARRAY',
-        PostLoadCheck => sub {
-            my $self  = shift;
-            return unless shift;
-            # XXX Remove in RT 4.2
-            warn <<EOT;
-The ActiveStatus configuration has been replaced by the new Lifecycles
-functionality. You should set the 'active' property of the 'default'
-lifecycle and add transition rules; see RT_Config.pm for documentation.
-EOT
-        },
-    },
-    InactiveStatus => {
-        Type => 'ARRAY',
-        PostLoadCheck => sub {
-            my $self  = shift;
-            return unless shift;
-            # XXX Remove in RT 4.2
-            warn <<EOT;
-The InactiveStatus configuration has been replaced by the new Lifecycles
-functionality. You should set the 'inactive' property of the 'default'
-lifecycle and add transition rules; see RT_Config.pm for documentation.
-EOT
-        },
-    },
 );
 my %OPTIONS = ();
 

commit 87dd08b37d1e03cb025745f5d7a9e51b94a85df3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 17:57:41 2012 -0700

    Mark a new deprecation warning to be removed in 4.4
    
    The LogToScreen deprecation warning, added in 4.2, should be removed in
    4.4.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ab70d7d..24f1b23 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -755,6 +755,7 @@ our %META = (
         },
         PostLoadCheck => sub {
             my $self = shift;
+            # XXX: deprecated, remove in 4.4
             $RT::Logger->info("You set \$LogToScreen in your config, but it's been renamed to \$LogToSTDERR.  Please update your config.")
                 if $self->Meta('LogToScreen')->{'Source'}{'Package'};
         },

commit a17e93d19174a345ec565ed9965c4be631933836
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:17:56 2012 -0700

    Remove no longer used components
    
    The MyRequest and MyTicket components were deprecated in 8b8e90d
    (3.6.0), and are no longer called.

diff --git a/share/html/Elements/MyRequests b/share/html/Elements/MyRequests
deleted file mode 100755
index 2ceb7f5..0000000
--- a/share/html/Elements/MyRequests
+++ /dev/null
@@ -1,49 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
-%#                                          <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# 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.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-%# DEPRECATED
-<& /Elements/ShowSearch, Name => 'My Requests' &>
diff --git a/share/html/Elements/MyTickets b/share/html/Elements/MyTickets
deleted file mode 100755
index 2b94232..0000000
--- a/share/html/Elements/MyTickets
+++ /dev/null
@@ -1,49 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
-%#                                          <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# 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.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-%# DEPRECATED
-<& /Elements/ShowSearch, Name => 'My Tickets' &>

commit 796efa1f820007e0ae55c84962e1aaf92c05ef4c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:18:44 2012 -0700

    /Elements/MyReminders is not deprecated; remove misleading comment
    
    The comment most likely originates from a failed copy-and-paste from
    MyTickets or MyRequests.

diff --git a/share/html/Elements/MyReminders b/share/html/Elements/MyReminders
index 2de4b53..5e29067 100755
--- a/share/html/Elements/MyReminders
+++ b/share/html/Elements/MyReminders
@@ -45,7 +45,6 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-%# DEPRECATED
 <&|/Widgets/TitleBox,
     class => 'reminders',
     title => loc("My reminders"),

commit 0f2377594daaea94181d8a641cc204079bf7e9de
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:20:20 2012 -0700

    Remove back-compat argument to CF admin page, deprecated in bddd336 (3.8.0)

diff --git a/share/html/Admin/CustomFields/index.html b/share/html/Admin/CustomFields/index.html
index b8bc447..a982f48 100644
--- a/share/html/Admin/CustomFields/index.html
+++ b/share/html/Admin/CustomFields/index.html
@@ -95,12 +95,6 @@ $Format => undef
 <%INIT>
 my $title = loc('Select a Custom Field');
 
-$Type ||= $ARGS{'type'} || '';
-if ( !$Type && $ARGS{'type'} ) {
-    $Type ||= $ARGS{'type'};
-    $RT::Logger->warning("'type' argument is deprecated use 'Type' instead");
-}
-
 my $CustomFields = RT::CustomFields->new($session{'CurrentUser'});
 $CustomFields->UnLimit;
 $CustomFields->FindAllRows if $ShowDisabled;

commit 015073f001694fff0b3dd88d4bf94f0da3d3be00
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:21:17 2012 -0700

    Remove back-compat _PrivacyObjects method, deprecated in 36df10d (4.0.0)

diff --git a/lib/RT/SavedSearches.pm b/lib/RT/SavedSearches.pm
index 15c90dc..ff047d7 100644
--- a/lib/RT/SavedSearches.pm
+++ b/lib/RT/SavedSearches.pm
@@ -108,15 +108,6 @@ sub LimitToPrivacy {
     }
 }
 
-### Internal methods
-
-sub _PrivacyObjects {
-    my $self = shift;
-    Carp::carp("RT::SavedSearches->_PrivacyObjects is deprecated. Please use RT::SavedSearch->_PrivacyObjects");
-    my $search = RT::SavedSearch->new($self->CurrentUser);
-    return $search->_PrivacyObjects(@_);
-}
-
 RT::Base->_ImportOverlays();
 
 1;

commit e75066b67b1e25c1370caa874eaae0d3342fe76e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:22:13 2012 -0700

    Remove back-compat argument form to SendEmail, deprecated in 699ed17 (3.8.0)

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index c458ea6..a5e4e7d 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -330,13 +330,6 @@ sub SendEmail {
     my $TicketObj = $args{'Ticket'};
     my $TransactionObj = $args{'Transaction'};
 
-    foreach my $arg( qw(Entity Bounce) ) {
-        next unless defined $args{ lc $arg };
-
-        $RT::Logger->warning("'". lc($arg) ."' argument is deprecated, use '$arg' instead");
-        $args{ $arg } = delete $args{ lc $arg };
-    }
-
     unless ( $args{'Entity'} ) {
         $RT::Logger->crit( "Could not send mail without 'Entity' object" );
         return 0;

commit 4e9ad32f48f8aefad04534bc3fd3098aff3bfe4e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:27:24 2012 -0700

    Warn, and deprecate for 4.4, the old UpdateCustomFields call convention
    
    This API was marked for deprecation in RT 3.6 -- finally start warning
    about it so that it can be removed.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 8a01217..3907b05 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1848,11 +1848,11 @@ sub ProcessUpdateMessage {
     if ( $args{ARGSRef}->{'UpdateType'} =~ /^(private|public)$/ ) {
         my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Comment(%message_args);
         push( @results, $Description );
-        $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
+        $Object->UpdateCustomFields( %{ $args{ARGSRef} } ) if $Object;
     } elsif ( $args{ARGSRef}->{'UpdateType'} eq 'response' ) {
         my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Correspond(%message_args);
         push( @results, $Description );
-        $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
+        $Object->UpdateCustomFields( %{ $args{ARGSRef} } ) if $Object;
     } else {
         push( @results,
             loc("Update type was neither correspondence nor comment.") . " " . loc("Update not recorded.") );
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index e788e54..2be9ec9 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -418,57 +418,39 @@ sub CreatedObj {
 }
 
 
-#
-# TODO: This should be deprecated
-#
+# B<DEPRECATED> and will be removed in 4.4
 sub AgeAsString {
     my $self = shift;
+    $RT::Logger->warning("RT::Record->AgeAsString is deprecated and will be removed in RT 4.4; use ->CreatedObj->AgeAsString instead");
     return ( $self->CreatedObj->AgeAsString() );
 }
 
+# B<DEPRECATED> and will be removed in 4.4
+sub LongSinceUpdateAsString {
+    my $self = shift;
+    $RT::Logger->warning("RT::Record->LongSinceUpdateAsString is deprecated and will be removed in RT 4.4; use ->LastUpdatedObj->AgeAsString instead");
 
-
-# TODO this should be deprecated
+    if ( $self->LastUpdated ) {
+        return ( $self->LastUpdatedObj->AgeAsString() );
+    } else {
+        return "never";
+    }
+}
 
 sub LastUpdatedAsString {
     my $self = shift;
     if ( $self->LastUpdated ) {
         return ( $self->LastUpdatedObj->AsString() );
-
-    }
-    else {
+    } else {
         return "never";
     }
 }
 
-
-#
-# TODO This should be deprecated 
-#
 sub CreatedAsString {
     my $self = shift;
     return ( $self->CreatedObj->AsString() );
 }
 
-
-#
-# TODO This should be deprecated
-#
-sub LongSinceUpdateAsString {
-    my $self = shift;
-    if ( $self->LastUpdated ) {
-
-        return ( $self->LastUpdatedObj->AgeAsString() );
-
-    }
-    else {
-        return "never";
-    }
-}
-
-
-
-#
 sub _Set {
     my $self = shift;
 
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index cf6ac40..e3c48ab 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -683,7 +683,7 @@ sub Create {
 
         if ( $self->Id && $Trans ) {
 
-            $TransObj->UpdateCustomFields(ARGSRef => \%args);
+            $TransObj->UpdateCustomFields( %args );
 
             $RT::Logger->info( "Ticket " . $self->Id . " created in queue '" . $QueueObj->Name . "' by " . $self->CurrentUser->Name );
             $ErrStr = $self->loc( "Ticket [_1] created in queue '[_2]'", $self->Id, $QueueObj->Name );
@@ -1859,12 +1859,16 @@ sub DueObj {
 
 =head2 DueAsString
 
-Returns this ticket's due date as a human readable string
+Returns this ticket's due date as a human readable string.
+
+B<DEPRECATED> and will be removed in 4.4; use C<<
+$ticket->DueObj->AsString >> instead.
 
 =cut
 
 sub DueAsString {
     my $self = shift;
+    $RT::Logger->warning("RT::Ticket->DueAsString is deprecated and will be removed in RT 4.4; use ->DueObj->AsString instead");
     return $self->DueObj->AsString();
 }
 
@@ -2032,12 +2036,14 @@ sub ToldObj {
 
 A convenience method that returns ToldObj->AsString
 
-TODO: This should be deprecated
+B<DEPRECATED> and will be removed in 4.4; use C<<
+$ticket->ToldObj->AsString >> instead.
 
 =cut
 
 sub ToldAsString {
     my $self = shift;
+    $RT::Logger->warning("RT::Ticket->ToldAsString is deprecated and will be removed in RT 4.4; use ->ToldObj->AsString instead");
     if ( $self->Told ) {
         return $self->ToldObj->AsString();
     }
@@ -2048,39 +2054,45 @@ sub ToldAsString {
 
 
 
+sub _DurationAsString {
+    my $self = shift;
+    my $value = shift;
+    return "" unless $value;
+    return RT::Date->new( $self->CurrentUser )
+        ->DurationAsString( $value * 60 );
+}
+
 =head2 TimeWorkedAsString
 
-Returns the amount of time worked on this ticket as a Text String
+Returns the amount of time worked on this ticket as a text string.
 
 =cut
 
 sub TimeWorkedAsString {
     my $self = shift;
-    my $value = $self->TimeWorked;
-
-    # return the # of minutes worked turned into seconds and written as
-    # a simple text string, this is not really a date object, but if we
-    # diff a number of seconds vs the epoch, we'll get a nice description
-    # of time worked.
-    return "" unless $value;
-    return RT::Date->new( $self->CurrentUser )
-        ->DurationAsString( $value * 60 );
+    return $self->_DurationAsString( $self->TimeWorked );
 }
 
-
-
 =head2  TimeLeftAsString
 
-Returns the amount of time left on this ticket as a Text String
+Returns the amount of time left on this ticket as a text string.
 
 =cut
 
 sub TimeLeftAsString {
     my $self = shift;
-    my $value = $self->TimeLeft;
-    return "" unless $value;
-    return RT::Date->new( $self->CurrentUser )
-        ->DurationAsString( $value * 60 );
+    return $self->_DurationAsString( $self->TimeLeft );
+}
+
+=head2  TimeEstimatedAsString
+
+Returns the amount of time estimated on this ticket as a text string.
+
+=cut
+
+sub TimeEstimatedAsString {
+    my $self = shift;
+    return $self->_DurationAsString( $self->TimeEstimated );
 }
 
 
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index edec90a..1040032 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1125,14 +1125,16 @@ sub FriendlyObjectType {
 }
 
 =head2 UpdateCustomFields
-    
-    Takes a hash of 
 
-    CustomField-<<Id>> => Value
-        or 
+Takes a hash of:
+
+    CustomField-C<Id> => Value
+
+or:
+
+    Object-RT::Transaction-CustomField-C<Id> => Value
 
-    Object-RT::Transaction-CustomField-<<Id>> => Value parameters to update
-    this transaction's custom fields
+parameters to update this transaction's custom fields.
 
 =cut
 
@@ -1144,12 +1146,10 @@ sub UpdateCustomFields {
     # value "ARGSRef", which was a reference to a hash of arguments.
     # This was insane. The next few lines of code preserve that API
     # while giving us something saner.
-
-    # TODO: 3.6: DEPRECATE OLD API
-
-    my $args; 
-
-    if ($args{'ARGSRef'}) { 
+    my $args;
+    if ($args{'ARGSRef'}) {
+        # XXX: deprecated, remove in 4.4
+        $RT::Logger->warning("Passing an ARGSRef to UpdateCustomFields is deprecated, and will be removed in RT 4.4; pass its contents instead");
         $args = $args{ARGSRef};
     } else {
         $args = \%args;
diff --git a/t/customfields/transaction.t b/t/customfields/transaction.t
index f2e660e..47435bc 100644
--- a/t/customfields/transaction.t
+++ b/t/customfields/transaction.t
@@ -3,7 +3,7 @@ use warnings;
 use strict;
 use Data::Dumper;
 
-use RT::Test nodata => 1, tests => 14;
+use RT::Test nodata => 1, tests => 13;
 use_ok('RT');
 use_ok('RT::Transactions');
 
@@ -43,17 +43,8 @@ is ($txn_cf->id, $cf->id, "It's the right custom field");
 my $values = $trans->CustomFieldValues($txn_cf->id);
 is ($values->Count, 0, "It has no values");
 
-# Old API
-my %cf_updates = ( 'CustomField-'.$cf->id => 'Testing');
-$trans->UpdateCustomFields( ARGSRef => \%cf_updates);
-
- $values = $trans->CustomFieldValues($txn_cf->id);
-is ($values->Count, 1, "It has one value");
-
-# New API
-
-$trans->UpdateCustomFields( 'CustomField-'.$cf->id => 'Test two');
- $values = $trans->CustomFieldValues($txn_cf->id);
-is ($values->Count, 2, "it has two values");
+$trans->UpdateCustomFields( 'CustomField-'.$cf->id => 'Test');
+$values = $trans->CustomFieldValues($txn_cf->id);
+is ($values->Count, 1, "it has a value");
 
 # TODO ok(0, "Should updating custom field values remove old values?");

commit b15e9151e0feabe4056db44fbed67126df2581ab
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 26 18:48:39 2012 -0700

    Remove deprecations on ->Limit* helpers on CustomFields
    
    Despite assuming that all CFs apply to tickets, these are useful helper
    methods.  Document their restrictions, but leave them in-place.

diff --git a/lib/RT/CustomFields.pm b/lib/RT/CustomFields.pm
index d4a5bc7..1c8436a 100644
--- a/lib/RT/CustomFields.pm
+++ b/lib/RT/CustomFields.pm
@@ -239,9 +239,10 @@ sub LimitToApplied {
 
 =head2 LimitToGlobalOrQueue QUEUEID
 
-DEPRECATED since CFs are applicable not only to tickets these days.
+Limits the set of custom fields found to global custom fields or those
+tied to the queue C<QUEUEID>, similar to L</LimitToGlobalOrObjectId>.
 
-Limits the set of custom fields found to global custom fields or those tied to the queue with ID QUEUEID
+Note that this will cause the collection to only return ticket CFs.
 
 =cut
 
@@ -255,34 +256,33 @@ sub LimitToGlobalOrQueue {
 
 =head2 LimitToQueue QUEUEID
 
-DEPRECATED since CFs are applicable not only to tickets these days.
+Takes a numeric C<QUEUEID>, and limits the Custom Field collection to
+those only applied directly to it; this limit is OR'd with other
+L</LimitToQueue> and L</LimitToGlobal> limits.
 
-Takes a queue id (numerical) as its only argument. Makes sure that
-Scopes it pulls out apply to this queue (or another that you've selected with
-another call to this method
+Note that this will cause the collection to only return ticket CFs.
 
 =cut
 
 sub LimitToQueue  {
    my $self = shift;
-  my $queue = shift;
-
-  $self->Limit (ALIAS => $self->_OCFAlias,
-                ENTRYAGGREGATOR => 'OR',
-		FIELD => 'ObjectId',
-		VALUE => "$queue")
-      if defined $queue;
-  $self->LimitToLookupType( 'RT::Queue-RT::Ticket' );
+   my $queue = shift;
+
+   $self->Limit (ALIAS => $self->_OCFAlias,
+                 ENTRYAGGREGATOR => 'OR',
+                 FIELD => 'ObjectId',
+                 VALUE => "$queue")
+       if defined $queue;
+   $self->LimitToLookupType( 'RT::Queue-RT::Ticket' );
 }
 
 
 =head2 LimitToGlobal
 
-DEPRECATED since CFs are applicable not only to tickets these days.
+Limits the Custom Field collection to global ticket CFs; this limit is
+OR'd with L</LimitToQueue> limits.
 
-Makes sure that Scopes it pulls out apply to all queues
-(or another that you've selected with
-another call to this method or LimitToQueue)
+Note that this will cause the collection to only return ticket CFs.
 
 =cut
 

commit ffd6a9079c17e6f5f49fef45257f8326274afbe1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jul 27 16:39:17 2012 -0400

    Remove ->Import methods
    
    These methods were written in the run-up to RT 2.0, to provide an RT 1.0
    -> 2.0 converter.  As the upgrade path from RT 1.0 currently requires
    1.0 -> 2.0 -> 3.0, then applying incremental upgrades, this code is only
    necessary in the RT 2 codebase.  Remove it, to reduce confusion.

diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 5d3de90..5a1fda6 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -222,22 +222,6 @@ sub Create {
     }
 }
 
-=head2 Import
-
-Create an attachment exactly as specified in the named parameters.
-
-=cut
-
-sub Import {
-    my $self = shift;
-    my %args = ( ContentEncoding => 'none', @_ );
-
-    ( $args{'ContentEncoding'}, $args{'Content'} ) =
-        $self->_EncodeLOB( $args{'Content'}, $args{'MimeType'} );
-
-    return ( $self->SUPER::Create(%args) );
-}
-
 =head2 TransactionObj
 
 Returns the transaction object asscoiated with this attachment.
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index e3c48ab..4735248 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -780,201 +780,6 @@ sub _Parse822HeadersForAttributes {
 }
 
 
-
-=head2 Import PARAMHASH
-
-Import a ticket. 
-Doesn\'t create a transaction. 
-Doesn\'t supply queue defaults, etc.
-
-Returns: TICKETID
-
-=cut
-
-sub Import {
-    my $self = shift;
-    my ( $ErrStr, $QueueObj, $Owner );
-
-    my %args = (
-        id              => undef,
-        EffectiveId     => undef,
-        Queue           => undef,
-        Requestor       => undef,
-        Type            => 'ticket',
-        Owner           => RT->Nobody->Id,
-        Subject         => '[no subject]',
-        InitialPriority => undef,
-        FinalPriority   => undef,
-        Status          => 'new',
-        TimeWorked      => "0",
-        Due             => undef,
-        Created         => undef,
-        Updated         => undef,
-        Resolved        => undef,
-        Told            => undef,
-        @_
-    );
-
-    if ( ( defined( $args{'Queue'} ) ) && ( !ref( $args{'Queue'} ) ) ) {
-        $QueueObj = RT::Queue->new(RT->SystemUser);
-        $QueueObj->Load( $args{'Queue'} );
-
-        #TODO error check this and return 0 if it\'s not loading properly +++
-    }
-    elsif ( ref( $args{'Queue'} ) eq 'RT::Queue' ) {
-        $QueueObj = RT::Queue->new(RT->SystemUser);
-        $QueueObj->Load( $args{'Queue'}->Id );
-    }
-    else {
-        $RT::Logger->debug(
-            "$self " . $args{'Queue'} . " not a recognised queue object." );
-    }
-
-    #Can't create a ticket without a queue.
-    unless ( defined($QueueObj) and $QueueObj->Id ) {
-        $RT::Logger->debug("$self No queue given for ticket creation.");
-        return ( 0, $self->loc('Could not create ticket. Queue not set') );
-    }
-
-    #Now that we have a queue, Check the ACLS
-    unless (
-        $self->CurrentUser->HasRight(
-            Right    => 'CreateTicket',
-            Object => $QueueObj
-        )
-      )
-    {
-        return ( 0,
-            $self->loc("No permission to create tickets in the queue '[_1]'"
-              , $QueueObj->Name));
-    }
-
-    # Deal with setting the owner
-
-    # Attempt to take user object, user name or user id.
-    # Assign to nobody if lookup fails.
-    if ( defined( $args{'Owner'} ) ) {
-        if ( ref( $args{'Owner'} ) ) {
-            $Owner = $args{'Owner'};
-        }
-        else {
-            $Owner = RT::User->new( $self->CurrentUser );
-            $Owner->Load( $args{'Owner'} );
-            if ( !defined( $Owner->id ) ) {
-                $Owner->Load( RT->Nobody->id );
-            }
-        }
-    }
-
-    #If we have a proposed owner and they don't have the right 
-    #to own a ticket, scream about it and make them not the owner
-    if (
-        ( defined($Owner) )
-        and ( $Owner->Id != RT->Nobody->Id )
-        and (
-            !$Owner->HasRight(
-                Object => $QueueObj,
-                Right    => 'OwnTicket'
-            )
-        )
-      )
-    {
-
-        $RT::Logger->warning( "$self user "
-              . $Owner->Name . "("
-              . $Owner->id
-              . ") was proposed "
-              . "as a ticket owner but has no rights to own "
-              . "tickets in '"
-              . $QueueObj->Name . "'" );
-
-        $Owner = undef;
-    }
-
-    #If we haven't been handed a valid owner, make it nobody.
-    unless ( defined($Owner) ) {
-        $Owner = RT::User->new( $self->CurrentUser );
-        $Owner->Load( RT->Nobody->UserObj->Id );
-    }
-
-    # }}}
-
-    unless ( $self->ValidateStatus( $args{'Status'} ) ) {
-        return ( 0, $self->loc("'[_1]' is an invalid value for status", $args{'Status'}) );
-    }
-
-    $self->{'_AccessibleCache'}{Created}       = { 'read' => 1, 'write' => 1 };
-    $self->{'_AccessibleCache'}{Creator}       = { 'read' => 1, 'auto'  => 1 };
-    $self->{'_AccessibleCache'}{LastUpdated}   = { 'read' => 1, 'write' => 1 };
-    $self->{'_AccessibleCache'}{LastUpdatedBy} = { 'read' => 1, 'auto'  => 1 };
-
-    # If we're coming in with an id, set that now.
-    my $EffectiveId = undef;
-    if ( $args{'id'} ) {
-        $EffectiveId = $args{'id'};
-
-    }
-
-    my $id = $self->SUPER::Create(
-        id              => $args{'id'},
-        EffectiveId     => $EffectiveId,
-        Queue           => $QueueObj->Id,
-        Owner           => $Owner->Id,
-        Subject         => $args{'Subject'},        # loc
-        InitialPriority => $args{'InitialPriority'},    # loc
-        FinalPriority   => $args{'FinalPriority'},    # loc
-        Priority        => $args{'InitialPriority'},    # loc
-        Status          => $args{'Status'},        # loc
-        TimeWorked      => $args{'TimeWorked'},        # loc
-        Type            => $args{'Type'},        # loc
-        Created         => $args{'Created'},        # loc
-        Told            => $args{'Told'},        # loc
-        LastUpdated     => $args{'Updated'},        # loc
-        Resolved        => $args{'Resolved'},        # loc
-        Due             => $args{'Due'},        # loc
-    );
-
-    # If the ticket didn't have an id
-    # Set the ticket's effective ID now that we've created it.
-    if ( $args{'id'} ) {
-        $self->Load( $args{'id'} );
-    }
-    else {
-        my ( $val, $msg ) =
-          $self->__Set( Field => 'EffectiveId', Value => $id );
-
-        unless ($val) {
-            $RT::Logger->err(
-                $self . "->Import couldn't set EffectiveId: $msg" );
-        }
-    }
-
-    my $create_groups_ret = $self->_CreateTicketGroups();
-    unless ($create_groups_ret) {
-        $RT::Logger->crit(
-            "Couldn't create ticket groups for ticket " . $self->Id );
-    }
-
-    $self->OwnerGroup->_AddMember( PrincipalId => $Owner->PrincipalId );
-
-    foreach my $watcher ( @{ $args{'Cc'} } ) {
-        $self->_AddWatcher( Type => 'Cc', Email => $watcher, Silent => 1 );
-    }
-    foreach my $watcher ( @{ $args{'AdminCc'} } ) {
-        $self->_AddWatcher( Type => 'AdminCc', Email => $watcher,
-            Silent => 1 );
-    }
-    foreach my $watcher ( @{ $args{'Requestor'} } ) {
-        $self->_AddWatcher( Type => 'Requestor', Email => $watcher,
-            Silent => 1 );
-    }
-
-    return ( $self->Id, $ErrStr );
-}
-
-
-
-
 =head2 _CreateTicketGroups
 
 Create the ticket groups and links for this ticket. 

commit 1a8944fef8189bcad27dfb8e44c03ec0d2b66c30
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Aug 9 13:47:26 2012 -0400

    Remove the unused DeleteCategory method from CFVs
    
    f9afeaf added the code in question, which was correct because, at the
    time, Category was an attribute on the CFV.  However, Category has been
    a first-class column, and not an attribute, since c0490c3.  Remove the
    unnecessary DeleteCategory method, and the Delete method which existed
    solely to call it.

diff --git a/lib/RT/CustomFieldValue.pm b/lib/RT/CustomFieldValue.pm
index 26df55a..15654aa 100644
--- a/lib/RT/CustomFieldValue.pm
+++ b/lib/RT/CustomFieldValue.pm
@@ -100,37 +100,6 @@ sub ValidateName {
     return defined $_[1] && length $_[1];
 };
 
-=head2 DeleteCategory
-
-Deletes the category associated with this value
-Returns -1 if there is no Category
-
-=cut
-
-sub DeleteCategory {
-    my $self = shift;
-    my $attr = $self->FirstAttribute('Category') or return (-1,'No Category Set');
-    return $attr->Delete;
-}
-
-=head2 Delete
-
-Make sure we delete our Category when we're deleted
-
-=cut
-
-sub Delete {
-    my $self = shift;
-
-    my ($result, $msg) = $self->DeleteCategory;
-
-    unless ($result) {
-        return ($result, $msg);
-    }
-
-    return $self->SUPER::Delete(@_);
-}
-
 sub _Set { 
     my $self = shift; 
 

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


More information about the Rt-commit mailing list