diff options
author | ivan <ivan> | 2006-12-29 08:51:34 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-12-29 08:51:34 +0000 |
commit | 633c48448d9468690b7ad77eb6ff7c660a286658 (patch) | |
tree | 4e08051f8d805e7e95c8dffe5e3e73b0c360f965 /httemplate/edit/svc_external.cgi | |
parent | 6cb5c702b17b98be46adea4539e15d5f312e5be1 (diff) |
service refactor!
Diffstat (limited to 'httemplate/edit/svc_external.cgi')
-rw-r--r-- | httemplate/edit/svc_external.cgi | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/httemplate/edit/svc_external.cgi b/httemplate/edit/svc_external.cgi index 1230340ac..393e71c38 100644 --- a/httemplate/edit/svc_external.cgi +++ b/httemplate/edit/svc_external.cgi @@ -1,8 +1,6 @@ -<!-- mason kludge --> -% -% %my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_external ); %if ( $cgi->param('error') ) { +% % $svc_external = new FS::svc_external ( { % map { $_, scalar($cgi->param($_)) } fields('svc_external') % } ); @@ -11,38 +9,40 @@ % $svcpart = $cgi->param('svcpart'); % $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); % die "No part_svc entry!" unless $part_svc; -%} else { -% my($query) = $cgi->keywords; -% if ( $query =~ /^(\d+)$/ ) { #editing -% $svcnum=$1; -% $svc_external=qsearchs('svc_external',{'svcnum'=>$svcnum}) -% or die "Unknown (svc_external) svcnum!"; % -% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) -% or die "Unknown (cust_svc) svcnum!"; +%} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding % -% $pkgnum=$cust_svc->pkgnum; -% $svcpart=$cust_svc->svcpart; -% -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +% $pkgnum = $1; +% $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +% $svcpart = $1; % -% } else { #adding +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -% } -% $svc_external = new FS::svc_external { svcpart => $svcpart }; +% $svc_external = new FS::svc_external { svcpart => $svcpart }; % -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $svcnum=''; % -% $svcnum=''; +% $svc_external->set_default_and_fixed; % -% $svc_external->set_default_and_fixed; +%} else { #adding +% +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum=$1; +% $svc_external=qsearchs('svc_external',{'svcnum'=>$svcnum}) +% or die "Unknown (svc_external) svcnum!"; +% +% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) +% or die "Unknown (cust_svc) svcnum!"; +% +% $pkgnum=$cust_svc->pkgnum; +% $svcpart=$cust_svc->svcpart; +% +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% } %} %my $action = $svc_external->svcnum ? 'Edit' : 'Add'; % |