[freeside-commits] freeside/rt/share/html/Elements/RT__Ticket ColumnMap, 1.5.2.1, 1.5.2.2

Mark Wells mark at wavetail.420.am
Sat Feb 18 16:35:40 PST 2012


Update of /home/cvs/cvsroot/freeside/rt/share/html/Elements/RT__Ticket
In directory wavetail.420.am:/tmp/cvs-serv2205/rt/share/html/Elements/RT__Ticket

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	ColumnMap 
Log Message:
improve customer field access in RT queries, #16490

Index: ColumnMap
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/share/html/Elements/RT__Ticket/ColumnMap,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -w -d -r1.5.2.1 -r1.5.2.2
--- ColumnMap	17 Feb 2012 02:35:39 -0000	1.5.2.1
+++ ColumnMap	19 Feb 2012 00:35:37 -0000	1.5.2.2
@@ -319,99 +319,10 @@
         },
     },
 
-    Customer => {
-        title     => 'Customer', #loc
-        attribute => 'Customer.Number', #title/attribute/name... what does it all mean?
-        value     => sub {
-            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;
-        },
-    },
-    AdvertisingSource => {
-        title     => 'Advertising Source',
-        attribute => 'Customer.Referral',
-        value => sub {
-            my $Ticket = shift;
-            my @return = ();
-            foreach my $c (ticket_cust_resolvers($Ticket)) {
-                push @return, $c->Referral, \'<BR>';
-            }
-            pop @return;
-            @return;
-        },
-    },
+    #freeside
+    $m->comp('/Elements/CustomerFields', 'ColumnMap'),
 };
 
-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'}) {



More information about the freeside-commits mailing list