summaryrefslogtreecommitdiff
path: root/httemplate/misc/qual.html
blob: 69a5f8b74253dca35e58599f1d843d0cfb95f749 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<% include('/elements/header-popup.html', 'Service Qualification' ) %>

<% include('/elements/error.html') %>

<FORM NAME="QualForm" ACTION="<% $p %>edit/process/qual.cgi" METHOD="POST">

<INPUT TYPE="hidden" NAME="<%$cust_or_prospect%>num" VALUE="<% $custnum_or_prospectnum %>">

<% ntable("#cccccc", 2) %>

<% include('/elements/tr-td-label.html',
             'cgi'       => $cgi,
	     'label'	=> 'Qualify using',
	     'cell_style' => 'font-weight: bold',
	     'id' => 'exportnum',
	  )
%>
<TD>
<% include('/elements/select.html',
             'cgi'       => $cgi,
	     'field'	=> 'exportnum',
	     'options'  => \@export_options,
	     'labels'   => $export_labels,
	     'curr_value' => $cgi->param('exportnum'),
	  )
%>
</TD>
</TR>

<% include('/elements/tr-input-text.html',
             'cgi'       => $cgi,
	     'label'	=> 'Service Telephone Number',
	     'field'	=> 'phonenum',
	     'size'	=> '12',
	     'value'	=> $cgi->param('phonenum'),
          )
%>

<% include('/elements/tr-select-cust_location.html',
             'cgi'       => $cgi,
	     $table => $cust_main_or_prospect_main,
	     'alt_format' => $conf->exists('qual-alt-address-format') ? 1 : 0,
	     'is_optional' => 1,
	     'no_bold' => 1,
          )
%>
</TABLE>

<BR>
<INPUT type="submit" VALUE="Qualify" onClick = "this.disabled=true;">

</FORM>
</BODY>
</HTML>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Qualify service'); 

my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';

$cgi->param('custnum') =~ /^(\d+)$/;
my $custnum = $1;
$cgi->param('prospectnum') =~ /^(\d+)$/;
my $prospectnum = $1;
my $cust_or_prospect = $custnum ? "cust" : "prospect";
my $table = $cust_or_prospect . "_main";
my $custnum_or_prospectnum = $custnum ? $custnum : $prospectnum;
my $cust_main_or_prospect_main = qsearchs({
  'table'     => $table,
  'hashref'   => { $cust_or_prospect."num" => $custnum_or_prospectnum },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
die "neither prospect nor customer specified or found" 
    unless $cust_main_or_prospect_main;

my @exports = grep { $_->can('qual') } qsearch( 'part_export', {} );
my @export_options = ( 0 );
my $export_labels = { '0' => '(manual)' };
foreach my $export ( @exports ) {
    push @export_options, $export->exportnum;
    $export_labels->{$export->exportnum} = $export->exportname;
}

</%init>