[Rt-devel] Extraneous '<br>' in CustomField value
Ruslan Zakirov
ruslan.zakirov at gmail.com
Thu Jun 22 20:01:49 EDT 2006
On 6/23/06, Yan Fitterer <yan.fitterer at gmail.com> wrote:
> I've made a small mod to Elements/MyTickets (and Elements/MyRequests),
> to show a column with a custom field (CustomFiels.{Client}). Next, I
> have made the field a hyperlink, which runs a search on all open and
> new tickets that match that client.
>
> The problem: When I include in the href __CustomField.{Client}__, the
> value that is being inserted in the URL is appended with '<br>', which
> of course makes the query useless.
>
> I've tracked the extra tag to Elements/RT__Ticket/ColumnMap, line 86
> (in the latest devel snapshot). Commenting out the line resolves my
> issue, but I have no idea if this is breaking anything else.
We add <br /> there to separate several values of a field. You know
filed may have several values. I agree that code could be smarter.
>
> Could somebody enlighten me?
You can made the same thing in different way. Add callback that put
into COLUMN_MAP code for the 'Client' custom field. If you look closer
into Elements/RT__Ticket/ColumnMap you could see that if $COLUMN_MAP
hash has two entries with key "CustomField.{Client}" and "CF.{Client}"
then RT never run line 86, but uses these entries to display values of
the CF.
Fill this entries with hash reference:
{
attribute => undef,
title => 'Client',
value => sub {
my $values = $_[0]->CustomFieldValues($field);
return \join ',', map {
'<a href="your_href">'. $_->Content .'</a>'
} @{ $values->ItemsArrayRef };
},
}
>
> RT 3.4.2-4 on Debian Sarge
>
> Thanks
> Yan
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>
> Best Practical is hiring! Come hack Perl for us: http://bestpractical.com/about/jobs.html
>
--
Best regards, Ruslan.
More information about the Rt-devel
mailing list