'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
Customer,
Status,
- QueueName,
+ QueueName,
OwnerName,
Priority,
'__NEWLINE__',
- '',
- '<small>__Requestors__</small>',
'',
+ '<small>__Requestors__</small>',
+ '<small>__CustomerTags__</small>',
'<small>__CreatedRelative__</small>',
'<small>__ToldRelative__</small>',
'<small>__LastUpdatedRelative__</small>',
}
+sub AgentName {
+ my $self = shift;
+ my $rec = $self->_FreesideGetRecord() or return;
+ my $agent = $rec->{'_object'}->agent or return;
+ return $agent->agentnum . ': ' . $agent->agent;
+}
+
+sub CustomerClass {
+ my $self = shift;
+ my $rec = $self->_FreesideGetRecord() or return;
+ my $cust_class = $rec->{'_object'}->cust_class or return;
+ return $cust_class->classname;
+}
+
+sub CustomerTags {
+ my $self = shift;
+ my $rec = $self->_FreesideGetRecord() or return;
+ my @part_tag = $rec->{'_object'}->part_tag;
+ return map {
+ { 'name' => $_->tagname,
+ 'desc' => $_->tagdesc,
+ 'color' => $_->tagcolor }
+ } @part_tag;
+}
+
1;
Customer => {
title => 'Customer', #loc
- attribute => 'Customer', #title/attribute/name... what does it all mean?
+ attribute => 'Customer.Number', #title/attribute/name... what does it all mean?
value => sub {
- my $Ticket = shift;
- my @Customers = @{ $Ticket->Customers->ItemsArrayRef };
- my @CustResolvers = map $_->TargetURI->Resolver, @Customers;
- my @return = ();
- for ( 0 .. $#CustResolvers ) {
- my $c = @CustResolvers[$_];
- push @return, \'<A HREF="', $c->HREF, \'">', $c->AsString, \'</A>';
- push @return, \'<BR>' if scalar(@CustResolvers) > 1
- && $_ != $#CustResolvers;
- }
- @return;
+ my $Ticket = shift;
+ my @return = ();
+ foreach my $c (ticket_cust_resolvers($Ticket)) {
+ push @return, \'<A HREF="', $c->HREF, \'">',
+ $c->AsString,
+ \'</A>',
+ \'<BR>';
+ }
+ pop @return;
+ @return;
+ },
+ },
+ # For future reference:
+ # hash key = name of the column in the format string
+ # (see /Search/Elements/BuildFormatString)
+ # title = displayed name in the table header
+ # attribute = the field to ORDER BY when sorting on this column
+ Agent => {
+ title => 'Agent',
+ attribute => 'Customer.Agent',
+ value => sub {
+ my $Ticket = shift;
+ my @return = ();
+ foreach my $c (ticket_cust_resolvers($Ticket)) {
+ push @return, $c->AgentName, \'<BR>';
+ }
+ pop @return;
+ @return;
+ },
+ },
+ CustomerClass => {
+ title => 'Class',
+ attribute => 'Customer.Class',
+ value => sub {
+ my $Ticket = shift;
+ my @return = ();
+ foreach my $c (ticket_cust_resolvers($Ticket)) {
+ push @return, $c->CustomerClass, \'<BR>';
+ }
+ pop @return;
+ @return;
+ },
+ },
+ CustomerTags => {
+ title => '',
+ attribute => '',
+ value => sub {
+ my $Ticket = shift;
+ my @return = ();
+ foreach my $c (ticket_cust_resolvers($Ticket)) {
+ my @tags = sort { $a->{'name'} cmp $b->{'name'} }
+ $c->CustomerTags;
+ foreach my $t (@tags) {
+ push @return, \'<SPAN style="background-color:#',
+ $t->{'color'},
+ \';"> ',
+ $t->{'name'},
+ \' </SPAN>',
+ \' '
+ ;
+ }
+ pop @return;
+ push @return, \'<BR>';
+ }
+ pop @return;
+ @return;
},
},
-
};
+sub ticket_cust_resolvers {
+ my $Ticket = shift;
+ my @Customers = @{ $Ticket->Customers->ItemsArrayRef };
+ return map $_->TargetURI->Resolver, @Customers;
+}
+
# if no GPG support, then KeyOwnerName and KeyRequestors fall back to the regular
# versions
if (RT->Config->Get('GnuPG')->{'Enable'}) {