[Rt-commit] r4533 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Tue Feb 14 18:29:09 EST 2006


Author: ruz
Date: Tue Feb 14 18:28:56 2006
New Revision: 4533

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm

Log:
 r1704 at cubic-pc:  cubic | 2006-02-15 02:31:59 +0300
 * fixes in perl-5.8.8 unhide some "my var redefined" warnings


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	Tue Feb 14 18:28:56 2006
@@ -275,20 +275,19 @@
 
     # if we're looking for a queue by name, make it a number
     if ( defined $args{'Queue'} && $args{'Queue'} =~ /\D/ ) {
-        my $QueueObj = RT::Queue->new($self->CurrentUser);
-        $QueueObj->Load($args{'Queue'});
+        my $QueueObj = RT::Queue->new( $self->CurrentUser );
+        $QueueObj->Load( $args{'Queue'} );
         $args{'Queue'} = $QueueObj->Id;
     }
 
     # XXX - really naive implementation.  Slow. - not really. still just one query
 
-    my $CFs = RT::CustomFields->new($self->CurrentUser);
-
+    my $CFs = RT::CustomFields->new( $self->CurrentUser );
     $CFs->Limit( FIELD => 'Name', VALUE => $args{'Name'} );
     # Don't limit to queue if queue is 0.  Trying to do so breaks
     # RT::Group type CFs.
-    if (defined $args{'Queue'}) {
-	$CFs->LimitToQueue( $args{'Queue'} );
+    if ( defined $args{'Queue'} ) {
+        $CFs->LimitToQueue( $args{'Queue'} );
     }
 
     # When loading by name, it's ok if they're disabled. That's not a big deal.
@@ -296,11 +295,10 @@
 
     # We only want one entry.
     $CFs->RowsPerPage(1);
-    unless ($CFs->First) {
-        return(0);
+    unless ( $CFs->First ) {
+        return 0;
     }
     return($self->Load($CFs->First->id));
-
 }
 
 # }}}
@@ -870,7 +868,6 @@
 sub AddToObject {
     my $self  = shift;
     my $object = shift;
-    my $id = $object->Id || 0;
 
     unless (index($self->LookupType, ref($object)) == 0) {
     	return ( 0, $self->loc('Lookup type mismatch') );
@@ -880,14 +877,15 @@
         return ( 0, $self->loc('Permission Denied') );
     }
 
+    my $oid = $object->Id || 0;
     my $ObjectCF = RT::ObjectCustomField->new( $self->CurrentUser );
-
-    $ObjectCF->LoadByCols( ObjectId => $id, CustomField => $self->Id );
+    $ObjectCF->LoadByCols( ObjectId => $oid, CustomField => $self->Id );
     if ( $ObjectCF->Id ) {
         return ( 0, $self->loc("That is already the current value") );
     }
+
     my ( $id, $msg ) =
-      $ObjectCF->Create( ObjectId => $id, CustomField => $self->Id );
+      $ObjectCF->Create( ObjectId => $oid, CustomField => $self->Id );
 
     return ( $id, $msg );
 }
@@ -905,7 +903,6 @@
 sub RemoveFromObject {
     my $self = shift;
     my $object = shift;
-    my $id = $object->Id || 0;
 
     unless (index($self->LookupType, ref($object)) == 0) {
         return ( 0, $self->loc('Object type mismatch') );
@@ -915,9 +912,9 @@
         return ( 0, $self->loc('Permission Denied') );
     }
 
+    my $oid = $object->Id || 0;
     my $ObjectCF = RT::ObjectCustomField->new( $self->CurrentUser );
-
-    $ObjectCF->LoadByCols( ObjectId => $id, CustomField => $self->Id );
+    $ObjectCF->LoadByCols( ObjectId => $oid, CustomField => $self->Id );
     unless ( $ObjectCF->Id ) {
         return ( 0, $self->loc("This custom field does not apply to that object") );
     }

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Tue Feb 14 18:28:56 2006
@@ -3025,12 +3025,12 @@
 
     $RT::Handle->Commit();
 
-    my ( $trans, $msg, undef ) = $self->_NewTransaction(
-                                                   Type     => $Type,
-                                                   Field    => 'Owner',
-                                                   NewValue => $NewOwnerObj->Id,
-                                                   OldValue => $OldOwnerObj->Id,
-                                                   TimeTaken => 0 );
+    my $trans;
+    ($trans, $msg) = $self->_NewTransaction( Type      => $Type,
+                                             Field     => 'Owner',
+                                             NewValue  => $NewOwnerObj->Id,
+                                             OldValue  => $OldOwnerObj->Id,
+                                             TimeTaken => 0 );
 
     if ($trans) {
         $msg = $self->loc( "Owner changed from [_1] to [_2]",

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	Tue Feb 14 18:28:56 2006
@@ -938,7 +938,7 @@
     # RT doesn't allow to add groups as members of the
     # ticket roles, so we just hide entries in CGM table
     # with MemberId == GroupId from results
-    my $groupmembers = $self->SUPER::Limit(
+    $self->SUPER::Limit(
         LEFTJOIN   => $groupmembers,
         FIELD      => 'GroupId',
         OPERATOR   => '!=',
@@ -1171,32 +1171,30 @@
 =cut
 
 sub _CustomFieldDecipher {
-  my ($self, $field) = @_;
+    my ($self, $field) = @_;
  
-  my $queue = 0;
-  if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
-    $queue = $1;
-    $field = $2;
- }
-  $field = $1 if $field =~ /^{(.+)}$/;    # trim { }
- 
-  my $cfid;
- 
-  if ($queue) {
-    my $q = RT::Queue->new( $self->CurrentUser );
-    $q->Load($queue) if ($queue);
- 
-    my $cf;
-    if ( $q->id ) {
-      # $queue = $q->Name; # should we normalize the queue?
-      $cf = $q->CustomField($field);
+    my $queue = 0;
+    if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
+        ($queue, $field) = ($1, $2);
+    }
+    $field = $1 if $field =~ /^{(.+)}$/;    # trim { }
+
+    my $cfid;
+    if ( $queue ) {
+        my $q = RT::Queue->new( $self->CurrentUser );
+        $q->Load( $queue ) if $queue;
+
+        my $cf;
+        if ( $q->id ) {
+            # $queue = $q->Name; # should we normalize the queue?
+            $cf = $q->CustomField( $field );
+        }
+        else {
+            $cf = RT::CustomField->new( $self->CurrentUser );
+            $cf->LoadByNameAndQueue( Queue => 0, Name => $field );
+        }
+        $cfid = $cf->id if $cf;
     }
-    else {
-      $cf = RT::CustomField->new( $self->CurrentUser );
-      $cf->LoadByNameAndQueue( Queue => '0', Name => $field );
-     }
-    $cfid = $cf->id if $cf;
-  }
  
   return ($queue, $field, $cfid);
  
@@ -1301,7 +1299,8 @@
 
     # For our sanity, we can only limit on one queue at a time
 
-    my ($queue, $field, $cfid ) = $self->_CustomFieldDecipher( $field );
+    my ($queue, $cfid);
+    ($queue, $field, $cfid ) = $self->_CustomFieldDecipher( $field );
 
 # If we're trying to find custom fields that don't match something, we
 # want tickets where the custom field has no value at all.  Note that


More information about the Rt-commit mailing list