Commit d41e6a6a authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Merge branch '4.2/customfield-attributes' into 4.2-trunk

parents 7894729d 0b4296db
use strict;
use warnings;
our @Initial = (
sub {
# We do the delete in pure SQL because Attribute collections
# otherwise attempt to hash everything in memory. As this may
# be a large list, do it directly.
RT->DatabaseHandle->dbh->do(<<EOSQL);
DELETE FROM Attributes
WHERE (Name = 'LinkValueTo' OR Name = 'IncludeContentForValue')
AND (Content = '' OR Content IS NULL);
EOSQL
},
);
......@@ -1968,18 +1968,20 @@ sub _URLTemplate {
unless ( $self->CurrentUserHasRight('AdminCustomField') ) {
return ( 0, $self->loc('Permission Denied') );
}
$self->SetAttribute( Name => $template_name, Content => $value );
if (length $value and defined $value) {
$self->SetAttribute( Name => $template_name, Content => $value );
} else {
$self->DeleteAttribute( $template_name );
}
return ( 1, $self->loc('Updated') );
} else {
unless ( $self->id && $self->CurrentUserHasRight('SeeCustomField') ) {
return (undef);
}
my @attr = $self->Attributes->Named($template_name);
my $attr = shift @attr;
if ($attr) { return $attr->Content }
my ($attr) = $self->Attributes->Named($template_name);
return undef unless $attr;
return $attr->Content;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment