From 576d11eecd4aac143ac5d103b056060e2baaf4ed Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 18 Jan 2013 17:42:01 -0800 Subject: avoid cloning TimeWorked and related fields on linked tickets, #20543 --- rt/lib/RT/CustomField.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'rt/lib/RT/CustomField.pm') diff --git a/rt/lib/RT/CustomField.pm b/rt/lib/RT/CustomField.pm index 7ba24b8be..8d16c1fe1 100644 --- a/rt/lib/RT/CustomField.pm +++ b/rt/lib/RT/CustomField.pm @@ -410,6 +410,10 @@ sub Create { $self->SetUILocation( $args{'UILocation'} ); } + if ( exists $args{'NoClone'} ) { + $self->SetNoClone( $args{'NoClone'} ); + } + return ($rv, $msg) unless exists $args{'Queue'}; # Compat code -- create a new ObjectCustomField mapping @@ -1822,9 +1826,20 @@ sub SetUILocation { } } +sub NoClone { + my $self = shift; + $self->FirstAttribute('NoClone') ? 1 : ''; +} - - +sub SetNoClone { + my $self = shift; + my $value = shift; + if ( $value ) { + return $self->SetAttribute( Name => 'NoClone', Content => 1 ); + } else { + return $self->DeleteAttribute('NoClone'); + } +} =head2 id -- cgit v1.2.1 From 7588a4ac90a9b07c08a3107cd1107d773be1c991 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 4 Jun 2013 00:16:28 -0700 Subject: RT 4.0.13 --- rt/lib/RT/CustomField.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'rt/lib/RT/CustomField.pm') diff --git a/rt/lib/RT/CustomField.pm b/rt/lib/RT/CustomField.pm index 8d16c1fe1..01b4970c4 100644 --- a/rt/lib/RT/CustomField.pm +++ b/rt/lib/RT/CustomField.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -710,7 +710,7 @@ sub ValidateValuesClass { my $self = shift; my $class = shift; - return 1 if !defined $class || $class eq 'RT::CustomFieldValues'; + return 1 if !$class || $class eq 'RT::CustomFieldValues'; return 1 if grep $class eq $_, RT->Config->Get('CustomFieldValuesSources'); return undef; } @@ -1556,9 +1556,8 @@ sub _CanonicalizeValueDate { my $DateObj = RT::Date->new( $self->CurrentUser ); $DateObj->Set( Format => 'unknown', Value => $args->{'Content'}, - Timezone => 'UTC', ); - $args->{'Content'} = $DateObj->Date( Timezone => 'UTC' ); + $args->{'Content'} = $DateObj->Date( Timezone => 'user' ); } =head2 MatchPattern STRING @@ -1666,14 +1665,13 @@ sub ValuesForObject { my $object = shift; my $values = RT::ObjectCustomFieldValues->new($self->CurrentUser); - unless ($self->CurrentUserHasRight('SeeCustomField')) { + unless ($self->id and $self->CurrentUserHasRight('SeeCustomField')) { # Return an empty object if they have no rights to see + $values->Limit( FIELD => "id", VALUE => 0, SUBCLAUSE => "ACL" ); return ($values); } - - + $values->LimitToCustomField($self->Id); - $values->LimitToEnabled(); $values->LimitToObject($object); return ($values); @@ -1690,6 +1688,7 @@ Examples: 'RT::Queue-RT::Ticket-RT::Transaction' => "Ticket Transactions", # loc 'RT::User' => "Users", # loc 'RT::Group' => "Groups", # loc + 'RT::Queue' => "Queues", # loc This is a class method. @@ -2103,6 +2102,8 @@ sub _CoreAccessible { {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 => {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''}, Description => -- cgit v1.2.1