1 %my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_external );
2 %if ( $cgi->param('error') ) {
4 % $svc_external = new FS::svc_external ( {
5 % map { $_, scalar($cgi->param($_)) } fields('svc_external')
7 % $svcnum = $svc_external->svcnum;
8 % $pkgnum = $cgi->param('pkgnum');
9 % $svcpart = $cgi->param('svcpart');
10 % $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
11 % die "No part_svc entry!" unless $part_svc;
13 %} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding
15 % $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
17 % $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
20 % $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
21 % die "No part_svc entry!" unless $part_svc;
23 % $svc_external = new FS::svc_external { svcpart => $svcpart };
27 % $svc_external->set_default_and_fixed;
31 % my($query) = $cgi->keywords;
32 % $query =~ /^(\d+)$/ or die "unparsable svcnum";
34 % $svc_external=qsearchs('svc_external',{'svcnum'=>$svcnum})
35 % or die "Unknown (svc_external) svcnum!";
37 % my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
38 % or die "Unknown (cust_svc) svcnum!";
40 % $pkgnum=$cust_svc->pkgnum;
41 % $svcpart=$cust_svc->svcpart;
43 % $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
44 % die "No part_svc entry!" unless $part_svc;
47 %my $action = $svc_external->svcnum ? 'Edit' : 'Add';
50 %print header("External service $action", '');
52 %print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
54 % if $cgi->param('error');
56 %print qq!<FORM ACTION="${p1}process/svc_external.cgi" METHOD=POST>!;
62 %print qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!;
63 %print qq!Service #<B>!, $svcnum ? $svcnum : "(NEW)", "</B><BR><BR>";
66 %print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!;
69 %print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
73 % $svc_external->title,
76 %print &ntable("#cccccc",2),
77 % '<TR><TD ALIGN="right">External ID</TD><TD>'.
78 % qq!<INPUT TYPE="text" NAME="id" VALUE="$id">!.
80 % '<TR><TD ALIGN="right">Title</TD><TD>'.
81 % qq!<INPUT TYPE="text" NAME="title" VALUE="$title">!.
84 %foreach my $field ($svc_external->virtual_fields) {
85 % if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) {
86 % # If the flag is X, it won't even show up in $svc_acct->virtual_fields.
87 % print $svc_external->pvf($field)->widget('HTML', 'edit',
88 % $svc_external->getfield($field));
95 </TABLE><BR><INPUT TYPE="submit" VALUE="Submit">