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',
26 my $cust_or_prospect = $self->cust_or_prospect;
27 return $cust_or_prospect->name
28 if $cust_or_prospect->get('custnum');
29 return "Prospect #".$cust_or_prospect->prospectnum
30 if $cust_or_prospect->get('prospectnum');
36 my %location_hash = $self->location;
38 if ( %location_hash ) {
39 my $loc = new FS::cust_location(\%location_hash);
40 return $loc->location_label;
46 my $export = $self->part_export;
47 my $result = '(manual)';
48 $result = $export->exportname if $export;
54 [ "${p}view/qual.cgi?qualnum=", 'qualnum' ],
67 unless $FS::CurrentUser::CurrentUser->access_right('Qualify service');
70 my $count_query = 'SELECT COUNT(*) FROM qual';
73 if ( $cgi->param('custnum') && $cgi->param('custnum') =~ /^(\d+)$/ ) {
74 $extra_sql = " where custnum = $1 or locationnum in "
75 . " (select locationnum from cust_location where custnum = $1)";
76 } elsif ( $cgi->param('prospectnum')
77 && $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
78 $extra_sql = " where prospectnum = $1 or locationnum in "
79 . " (select locationnum from cust_location where prospectnum = $1)";