X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_main.cgi;h=9ef3847406591e2bfa62daf4e0a723b1debf1f40;hp=c4b0ce0cd182204a3ea920e809042e70338bbbc3;hb=d5f33566675ef84accc14877733e243eec95ff01;hpb=0d1d2630e726ab4ce32bab9c3e4a889eee43fcb4 diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index c4b0ce0cd..9ef384740 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -71,7 +71,7 @@ if ( $cgi->param('browse') } elsif ( $query eq 'tickets' ) { $sortby = \*tickets_sort; $orderby = "ORDER BY tickets DESC"; - push @select, FS::TicketSystem->sql_customer_tickets. " as tickets"; + push @select, FS::TicketSystem->sql_num_customer_tickets. " as tickets"; push @addl_headers, 'Tickets'; push @addl_cols, 'tickets'; } else { @@ -279,6 +279,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { } print ' cancelled customers )'; } + if ( $cgi->param('referral_custnum') ) { $cgi->param('referral_custnum') =~ /^(\d+)$/ or eidiot "Illegal referral_custnum\n"; @@ -314,6 +315,13 @@ END ''; } + my @custom_priorities = (); + if ( $conf->config('ticket_system-custom_priority_field') + && @{[ $conf->config('ticket_system-custom_priority_field-values') ]} ) { + @custom_priorities = + $conf->config('ticket_system-custom_priority_field-values'); + } + print "

". $pager. &table(). < @@ -339,7 +347,6 @@ print <custnum}++, @cust_main) ) { @@ -391,9 +398,36 @@ END } foreach my $addl_col ( @addl_cols ) { - print qq!!. - $cust_main->get($addl_col). - ""; + print ""; + if ( $addl_col eq 'tickets' ) { + if ( @custom_priorities ) { + print ''; + foreach my $priority ( @custom_priorities, '' ) { + my $ahref = + ''; + print "". + ""; + } + print ''. + '
$ahref". + FS::TicketSystem->num_customer_tickets($custnum,$priority). + "$ahref". + ( $priority || '(none)' ). + "
'; + } + my $ahref = + ''; + print $ahref. $cust_main->get($addl_col). ''; + print "${ahref}Total
" + if @custom_priorities; + } else { + print $cust_main->get($addl_col); + } + print ""; } my($n1)=''; @@ -451,7 +485,7 @@ sub custnum_sort { } sub tickets_sort { - $a->getfield('tickets') <=> $b->getfield('tickets'); + $b->getfield('tickets') <=> $a->getfield('tickets'); } sub custnumsearch {