This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / httemplate / misc / qual.html
1 <% include('/elements/header-popup.html', 'Service Qualification' ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="QualForm" ACTION="<% $p %>edit/process/qual.cgi" METHOD="POST">
6
7 <INPUT TYPE="hidden" NAME="<%$cust_or_prospect%>num" VALUE="<% $custnum_or_prospectnum %>">
8
9 <% ntable("#cccccc", 2) %>
10
11 <% include('/elements/tr-td-label.html',
12              'cgi'        => $cgi,
13              'label'      => 'Qualify using',
14              #'cell_style' => 'font-weight: bold',
15              'id'         => 'exportnum',
16           )
17 %>
18 <TD>
19 <% include('/elements/select.html',
20              'cgi'        => $cgi,
21              'field'      => 'exportnum',
22              'options'    => \@export_options,
23              'labels'     => $export_labels,
24              'curr_value' => $exportnum,
25           )
26 %>
27 </TD>
28 </TR>
29
30 <% include('/elements/tr-input-text.html',
31              'cgi'     => $cgi,
32              'label'   => 'Service phone number',
33              'field'   => 'phonenum',
34              'size'    => '12',
35              'value'   => scalar($cgi->param('phonenum')),
36
37              'valign'  => 'middle',
38              'colspan' => 6,
39              'prefix'  => '<TABLE><TR><TD>',
40              'postfix' => '</TD><TD><FONT SIZE="-2">'. join('<BR>',
41                  'Line-share (non dry loops) - always fill in',
42                  'Dry loops - always leave empty',
43                ). '</FONT></TD></TR></TABLE>',
44           )
45 %>
46
47 <% include('/elements/tr-select-cust_location.html',
48              'cgi'           => $cgi,
49              $table          => $cust_main_or_prospect_main,
50              'alt_format'    => $conf->exists('qual-alt_address_format'),
51              'disable_empty' => $conf->exists('qual-alt_address_format'),
52              'no_bold'       => 1,
53              #required for ikano.. config? 'is_optional' => 1,
54           )
55 %>
56 </TABLE>
57
58 <BR>
59 <INPUT type="submit" VALUE="Qualify" onClick = "this.disabled=true;">
60
61 </FORM>
62 </BODY>
63 </HTML>
64 <%init>
65
66 my $curuser = $FS::CurrentUser::CurrentUser;
67
68 die "access denied"
69   unless $curuser->access_right('Qualify service'); 
70
71 my $conf = new FS::Conf;
72 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
73
74 $cgi->param('custnum') =~ /^(\d+)$/;
75 my $custnum = $1;
76 $cgi->param('prospectnum') =~ /^(\d+)$/;
77 my $prospectnum = $1;
78 my $cust_or_prospect = $custnum ? "cust" : "prospect";
79 my $table = $cust_or_prospect . "_main";
80 my $custnum_or_prospectnum = $custnum ? $custnum : $prospectnum;
81 my $cust_main_or_prospect_main = qsearchs({
82   'table'     => $table,
83   'hashref'   => { $cust_or_prospect."num" => $custnum_or_prospectnum },
84   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
85 });
86 die "neither prospect nor customer specified or found" 
87     unless $cust_main_or_prospect_main;
88
89 my @exports = grep { $_->can('qual') } qsearch( 'part_export', {} );
90 my @export_options = ( 0 );
91 my $export_labels = { '0' => '(manual)' };
92 foreach my $export ( @exports ) {
93     push @export_options, $export->exportnum;
94     $export_labels->{$export->exportnum} = $export->exportname;
95 }
96 my $exportnum = $cgi->param('error')
97                   ? scalar($cgi->param('exportnum'))
98                   : scalar(@exports) == 1
99                     ? $exports[0]->exportnum
100                     : '';
101
102 </%init>