[Rt-commit] r5355 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jun 9 19:11:50 EDT 2006
Author: ruz
Date: Fri Jun 9 19:11:49 2006
New Revision: 5355
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
Log:
r3114 at cubic-pc (orig r5291): jesse | 2006-05-26 01:56:01 +0400
r9817 at jesse-vincents-computer-2: jesse | 2006-05-25 17:55:26 -0400
* Cleaned up a couple of warnings for redeclared variables
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 Fri Jun 9 19:11:49 2006
@@ -854,6 +854,7 @@
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') );
@@ -863,17 +864,15 @@
return ( 0, $self->loc('Permission Denied') );
}
- my $oid = $object->Id || 0;
my $ObjectCF = RT::ObjectCustomField->new( $self->CurrentUser );
- $ObjectCF->LoadByCols( ObjectId => $oid, CustomField => $self->Id );
+ $ObjectCF->LoadByCols( ObjectId => $id, CustomField => $self->Id );
if ( $ObjectCF->Id ) {
return ( 0, $self->loc("That is already the current value") );
}
+ my ( $ret, $msg ) =
+ $ObjectCF->Create( ObjectId => $id, CustomField => $self->Id );
- my ( $id, $msg ) =
- $ObjectCF->Create( ObjectId => $oid, CustomField => $self->Id );
-
- return ( $id, $msg );
+ return ( $ret, $msg );
}
@@ -889,6 +888,7 @@
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') );
@@ -898,15 +898,14 @@
return ( 0, $self->loc('Permission Denied') );
}
- my $oid = $object->Id || 0;
my $ObjectCF = RT::ObjectCustomField->new( $self->CurrentUser );
- $ObjectCF->LoadByCols( ObjectId => $oid, CustomField => $self->Id );
+ $ObjectCF->LoadByCols( ObjectId => $id, CustomField => $self->Id );
unless ( $ObjectCF->Id ) {
return ( 0, $self->loc("This custom field does not apply to that object") );
}
- my ( $id, $msg ) = $ObjectCF->Delete;
+ my ( $ret, $msg ) = $ObjectCF->Delete;
- return ( $id, $msg );
+ return ( $ret, $msg );
}
# {{{ AddValueForObject
More information about the Rt-commit
mailing list