1 <% include( 'elements/search.html',
2 'title' => 'Qualifications',
3 'name_singular' => 'qualification',
4 'query' => { 'table' => 'qual',
6 'extra_sql' => $extra_sql,
7 'order_by' => 'ORDER BY qualnum DESC',
9 'count_query' => "$count_query $extra_sql",
10 'header' => [ 'Qualification',
12 'Customer or Prospect',
13 'Service Telephone Number',
16 'Vendor Qualification #',
19 'fields' => [ 'qualnum',
24 sub { shift->cust_or_prospect->name },
25 sub { shift->phonenum || '(none - dry loop)' },
28 my %location_hash= $self->location_hash;
30 if ( %location_hash ) {
31 my $loc = new FS::cust_location(\%location_hash);
32 return $loc->location_label;
38 my $export = $self->part_export;
39 my $result = '(manual)';
40 $result = $export->exportname if $export;
46 [ "${p}view/qual.cgi?qualnum=", 'qualnum' ],
59 unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
62 my $count_query = 'SELECT COUNT(*) FROM qual';
65 if ( $cgi->param('custnum') && $cgi->param('custnum') =~ /^(\d+)$/ ) {
66 $extra_sql = " where custnum = $1 or locationnum in "
67 . " (select locationnum from cust_location where custnum = $1)";
68 } elsif ( $cgi->param('prospectnum')
69 && $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
70 $extra_sql = " where prospectnum = $1 or locationnum in "
71 . " (select locationnum from cust_location where prospectnum = $1)";