1 <% include('/elements/header.html', "$action $svc", '') %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% $p %>edit/process/svc_cert.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
7 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
8 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
10 <% ntable("#cccccc",2) %>
13 <TD ALIGN="right">Private key</TD>
14 <TD BGCOLOR="#ffffff">
16 % if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) {
18 <FONT COLOR="#33ff33">Verification OK</FONT>
19 % # remove key & cert link? just unprovision?
23 % if (0) { #( $svc_cert->csr_submitted ) { #XXX add field? date? }
25 % # just show the fields once the csr has been submitted
29 % my $cust_main = $svc_cert->cust_svc->cust_pkg->cust_main;
32 <TD ALIGN="right">Common name</TD>
33 <TD><INPUT TYPE="text" NAME="common_name" SIZE=40 MAXLENGTH=80 VALUE="<% $svc_cert->common_name |h %>"></TD>
37 <TD ALIGN="right">Organization</TD>
38 <TD><INPUT TYPE="text" NAME="organization" SIZE=40 MAXLENGTH=80 VALUE="<% $svc_cert->organization || $cust_main->company |h %>"></TD>
42 <TD ALIGN="right">Organization Unit</TD>
43 <TD><INPUT TYPE="text" NAME="organization_unit" SIZE=40 MAXLENGTH=80 VALUE="<% $svc_cert->organization_unit |h %>"></TD>
47 <TD ALIGN="right">City</TD>
48 <TD><% include('/elements/city.html',
49 'city' => $svc_cert->city || $cust_main->city,
50 'state' => $svc_cert->state || $cust_main->state,
51 'country' => $svc_cert->country || $cust_main->country,
58 <TD ALIGN="right">State</TD>
59 <TD><% include('/elements/select-state.html',
60 'city' => $svc_cert->city || $cust_main->city,
61 'state' => $svc_cert->state || $cust_main->state,
62 'country' => $svc_cert->country || $cust_main->country,
69 <TD ALIGN="right">Country</TD>
70 <TD><% include('/elements/select-country.html',
71 'city' => $svc_cert->city || $cust_main->city,
72 'state' => $svc_cert->state || $cust_main->state,
73 'country' => $svc_cert->country || $cust_main->country,
80 <TD ALIGN="right">Contact email</TD>
81 <TD><INPUT TYPE="text" NAME="cert_contact" SIZE=40 MAXLENGTH=80 VALUE="<% $svc_cert->cert_contact || ($cust_main->invoicing_list_emailonly)[0] |h %>"></TD>
88 % if ( $svc_cert->privatekey ) {
89 <FONT COLOR="#ff0000">Verification error</FONT>
90 % $re = 'Clear and Re-';
92 <% include('/elements/popup_link.html', {
93 'action' => "svc_cert/generate_privatekey.html$link_query",
94 'label' => $re.'Generate',
95 'actionlabel' => 'Generate private key',
99 #'color' => '#ff0000',
100 #'closetext' => 'Go Away', # the value '' removes the link
105 <% include('/elements/popup_link.html', {
106 'action' => "svc_cert/import_privatekey.html$link_query",
107 'label' => $re.'Import',
108 'actionlabel' => 'Import private key',
112 #'color' => '#ff0000',
113 #'closetext' => 'Go Away', # the value '' removes the link
115 % if ( $svc_cert->privatekey ) {
116 <PRE><% $svc_cert->privatekey |h %></PRE>
125 <INPUT TYPE="submit" VALUE="Submit">
129 <% include('/elements/footer.html') %>
134 unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
136 my $conf = new FS::Conf;
138 my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_cert );
139 if ( $cgi->param('error') ) {
141 $svc_cert = new FS::svc_cert ( {
142 map { $_, scalar($cgi->param($_)) } fields('svc_cert')
144 $svcnum = $svc_cert->svcnum;
145 $pkgnum = $cgi->param('pkgnum');
146 $svcpart = $cgi->param('svcpart');
147 $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
148 die "No part_svc entry!" unless $part_svc;
150 } elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding
152 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
154 $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
157 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
158 die "No part_svc entry!" unless $part_svc;
160 $svc_cert = new FS::svc_cert({});
164 $svc_cert->set_default_and_fixed;
168 my($query) = $cgi->keywords;
169 $query =~ /^(\d+)$/ or die "unparsable svcnum";
171 $svc_cert=qsearchs('svc_cert',{'svcnum'=>$svcnum})
172 or die "Unknown (svc_cert) svcnum!";
174 my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
175 or die "Unknown (cust_svc) svcnum!";
177 $pkgnum=$cust_svc->pkgnum;
178 $svcpart=$cust_svc->svcpart;
180 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
181 die "No part_svc entry!" unless $part_svc;
184 my $action = $svcnum ? 'Edit' : 'Add';
186 my $svc = $part_svc->getfield('svc');
188 #my $otaker = getotaker;
192 my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart";