1 <% include('/elements/header-popup.html', 'Service Qualification' ) %>
3 <% include('/elements/error.html') %>
5 <FORM NAME="QualForm" ACTION="<% $p %>edit/process/qual.cgi" METHOD="POST">
7 <INPUT TYPE="hidden" NAME="<%$cust_or_prospect%>num" VALUE="<% $custnum_or_prospectnum %>">
9 <% ntable("#cccccc", 2) %>
11 <% include('/elements/tr-td-label.html',
13 'label' => 'Qualify using',
14 'cell_style' => 'font-weight: bold',
19 <% include('/elements/select.html',
21 'field' => 'exportnum',
22 'options' => \@export_options,
23 'labels' => $export_labels,
24 'curr_value' => $cgi->param('exportnum'),
30 <% include('/elements/tr-input-text.html',
32 'label' => 'Service Telephone Number',
33 'field' => 'phonenum',
35 'value' => $cgi->param('phonenum'),
39 <% include('/elements/tr-select-cust_location.html',
41 $table => $cust_main_or_prospect_main,
42 'alt_format' => $conf->exists('qual-alt-address-format') ? 1 : 0,
50 <INPUT type="submit" VALUE="Qualify" onClick = "this.disabled=true;">
57 my $curuser = $FS::CurrentUser::CurrentUser;
60 unless $curuser->access_right('Qualify service');
62 my $conf = new FS::Conf;
63 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
65 $cgi->param('custnum') =~ /^(\d+)$/;
67 $cgi->param('prospectnum') =~ /^(\d+)$/;
69 my $cust_or_prospect = $custnum ? "cust" : "prospect";
70 my $table = $cust_or_prospect . "_main";
71 my $custnum_or_prospectnum = $custnum ? $custnum : $prospectnum;
72 my $cust_main_or_prospect_main = qsearchs({
74 'hashref' => { $cust_or_prospect."num" => $custnum_or_prospectnum },
75 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
77 die "neither prospect nor customer specified or found"
78 unless $cust_main_or_prospect_main;
80 my @exports = grep { $_->can('qual') } qsearch( 'part_export', {} );
81 my @export_options = ( 0 );
82 my $export_labels = { '0' => '(manual)' };
83 foreach my $export ( @exports ) {
84 push @export_options, $export->exportnum;
85 $export_labels->{$export->exportnum} = $export->exportname;