Le 21/04/2016 15:12, David Schmidt a écrit : > When I list tickets I want to show the first 3 lines of the ticket > message for each ticket. > > I am using the following patch to achieve this, but it is quite a hack. > Can someone recommend a cleaner solution. > >
you don't have to patch, you can use the callback "Once" in Elements/RT__Ticket/ColumnMap so just create a file local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once with a content that will ad such column. Something like: <%init> $COLUMN_MAP->{First3Lines} = { title => 'First3Lines', value => sub { return loc($_[0]->First3Lines) } }; </%init> <%args> $COLUMN_MAP => undef $GenericMap => undef </%args> And in a local/lib/rt/Ticket_Local.pm: package RT::Ticket; use strict; no warnings qw(redefine); use utf8; sub First3Lines { my $self = shift; [your code here] return $content; } 1; Then another callback to make this new "First3Lines" available as a columns in the search builder: local/Callbacks/YourOrg/Search/Elements/BuildFormatString/Default <%init> push @$Fields, 'First3Lines'; </%init> <%args> $Fields => undef </%args> this way, you don't have to patch and your changes should stay as is from rt versions to rt versions. -- Easter-eggs Spécialiste GNU/Linux 44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76 mailto:elac...@easter-eggs.com - http://www.easter-eggs.com --------- RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016