diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/elements/edit.html | 18 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 16 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 176 | ||||
-rw-r--r-- | httemplate/edit/process/elements/process.html | 5 | ||||
-rw-r--r-- | httemplate/edit/process/svc_Common.html | 13 | ||||
-rw-r--r-- | httemplate/edit/svc_Common.html | 30 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 46 | ||||
-rw-r--r-- | httemplate/edit/svc_broadband.cgi | 4 | ||||
-rwxr-xr-x | httemplate/edit/svc_domain.cgi | 56 | ||||
-rw-r--r-- | httemplate/edit/svc_external.cgi | 54 | ||||
-rwxr-xr-x | httemplate/edit/svc_forward.cgi | 49 | ||||
-rw-r--r-- | httemplate/edit/svc_www.cgi | 55 |
12 files changed, 228 insertions, 294 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index c2ea22f27..17c5ad3eb 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -53,6 +53,9 @@ % # # ... % # "html_string"; % # }, +% # +% # # overrides default popurl(1)."process/$table.html" +% # 'post_url' => popurl(1).'process/something', % % my(%opt) = @_; % @@ -77,9 +80,14 @@ % % } elsif ( $cgi->keywords || $cgi->param($pkey) ) { #editing % -% my( $query ) = $cgi->keywords; -% $query = $cgi->param($pkey) unless $query; -% $query =~ /^(\d+)$/; +% my $value; +% if ( $cgi->param($pkey) ) { +% $value = $cgi->param($pkey) +% } else { +% my( $query ) = $cgi->keywords; +% $value = $query; +% } +% $value =~ /^(\d+)$/ or die "unparsable $pkey"; % $object = qsearchs( $table, { $pkey => $1 } ); % warn "$table $pkey => $1" % if $opt{'debug'}; @@ -129,8 +137,10 @@ <BR><BR> % } +% my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; -<FORM ACTION="<% popurl(1) %>process/<% $table %>.html" METHOD=POST> +<FORM ACTION="<% $url %>" METHOD=POST> +<INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $table %>"> <INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $object->$pkey() %>"> <% ( $opt{labels} && exists $opt{labels}->{$pkey} ) ? $opt{labels}->{$pkey} diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index da59cc9ed..1fd66c251 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -1,19 +1,21 @@ % -% % my %opt = @_; % % #my( $svcnum, $pkgnum, $svcpart, $part_svc ); % my( $pkgnum, $svcpart, $part_svc ); % % #get & untaint pkgnum & svcpart -% my($query) = $cgi->keywords; #they're not proper cgi params -% if ( $query =~ /^pkgnum(\d+)-svcpart(\d+)$/ ) { -% $pkgnum = $1; -% $svcpart = $2; -% $cgi->delete_all(); #so the standard edit.html treats this correctly as new +% if ( ! $cgi->param('error') +% && $cgi->param('pkgnum') && $cgi->param('svcpart') +% ) +% { +% $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +% $pkgnum = $1; +% $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +% $svcpart = $1; +% $cgi->delete_all(); #so edit.html treats this correctly as new?? % } % -% <% include( 'edit.html', 'menubar' => [], diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index cc9145f45..ba152db9c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -55,159 +55,37 @@ For the selected table, you can give fields default or fixed (unchangable) values, or select an inventory class to manually or automatically fill in that field. <BR><BR> -% -% -%#these might belong somewhere else for other user interfaces -%#pry need to eventually create stuff that's shared amount UIs -%my $conf = new FS::Conf; -%my %defs = ( -% -% 'svc_acct' => { -% 'dir' => 'Home directory', -% 'uid' => 'UID (set to fixed and blank for no UIDs)', -% 'slipip' => 'IP address', -%# 'popnum' => qq!<A HREF="$p/browse/svc_acct_pop.cgi/">POP number</A>!, -% 'popnum' => { -% desc => 'Access number', -% type => 'select', -% select_table => 'svc_acct_pop', -% select_key => 'popnum', -% select_label => 'city', -% disable_select => 1, -% }, -% 'username' => { -% desc => 'Username', -% type => 'text', -% disable_default => 1, -% disable_fixed => 1, -% disable_select => 1, -% }, -% 'quota' => { -% desc => '', -% type => 'text', -% disable_inventory => 1, -% disable_select => 1, -% }, -% '_password' => 'Password', -% 'gid' => 'GID (when blank, defaults to UID)', -% 'shell' => { -% #desc =>'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file, set to blank for no shell tracking)', -% desc =>'Shell ( set to blank for no shell tracking)', -% type =>'select', -% select_list => [ $conf->config('shells') ], -% disable_inventory => 1, -% disable_select => 1, -% }, -% 'finger' => 'Real name (GECOS)', -% 'domsvc' => { -% desc =>'svcnum from svc_domain', -% type =>'select', -% select_table => 'svc_domain', -% select_key => 'svcnum', -% select_label => 'domain', -% disable_inventory => 1, -% disable_select => 1, -% }, -% 'usergroup' => { -% desc =>'RADIUS groups', -% type =>'radius_usergroup_selector', -% disable_select => 1, -% disable_inventory => 1, -% }, -% 'seconds' => { desc => '', -% type => 'text', -% disable_inventory => 1, -% disable_select => 1, -% }, -% }, -% -% 'svc_domain' => { -% 'domain' => 'Domain', -% }, -% -% 'svc_forward' => { -% 'srcsvc' => 'service from which mail is to be forwarded', -% 'dstsvc' => 'service to which mail is to be forwarded', -% 'dst' => 'someone@another.domain.com to use when dstsvc is 0', -% }, -% -%# 'svc_charge' => { -%# 'amount' => 'amount', -%# }, -%# 'svc_wo' => { -%# 'worker' => 'Worker', -%# '_date' => 'Date', -%# }, -% -% 'svc_www' => { -% #'recnum' => '', -% #'usersvc' => '', -% }, -% -% 'svc_broadband' => { -% 'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.', -% 'speed_up' => 'Maximum upload speed for this service in Kbps. 0 denotes unlimited.', -% 'ip_addr' => 'IP address. Leave blank for automatic assignment.', -% 'blocknum' => 'Address block.', -% }, -% -% 'svc_phone' => { -% 'countrycode' => { desc => 'Country code', -% type => 'text', -% disable_inventory => 1, -% disable_select => 1, -% }, -% 'phonenum' => 'Phone number', -% 'pin' => { desc => 'Personal Identification Number', -% type => 'text', -% disable_inventory => 1, -% disable_select => 1, -% }, -% }, -% -% 'svc_external' => { -% #'id' => '', -% #'title' => '', -% }, -% -%); -% -% my %vfields; -% foreach my $svcdb (grep dbdef->table($_), keys %defs ) { -% my $self = "FS::$svcdb"->new; -% $vfields{$svcdb} = {}; -% foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them -% my $pvf = $self->pvf($field); -% my @list = $pvf->list; -% if (scalar @list) { -% $defs{$svcdb}->{$field} = { desc => $pvf->label, -% type => 'select', -% select_list => \@list }; -% } else { -% $defs{$svcdb}->{$field} = $pvf->label; -% } #endif -% $vfields{$svcdb}->{$field} = $pvf; -% warn "\$vfields{$svcdb}->{$field} = $pvf"; -% } #next $field -% } #next $svcdb + +% #YUCK. false laziness w/part_svc.pm. go away virtual fields, please +% my %vfields; +% foreach my $svcdb ( FS::part_svc->svc_tables() ) { +% eval "use FS::$svcdb;"; +% my $self = "FS::$svcdb"->new; +% $vfields{$svcdb} = {}; +% foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them +% my $pvf = $self->pvf($field); +% $vfields{$svcdb}->{$field} = $pvf; +% #warn "\$vfields{$svcdb}->{$field} = $pvf"; +% } #next $field +% } #next $svcdb % % #code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm % # and generalize the subs % # condition sub is tested to see whether to disable display of this choice % # params: ( $def, $layer, $field ) (see SUB below) % my $inv_sub = sub { -% ref($_[0]) && ( $_[0]->{disable_inventory} -% || $_[0]->{'type'} ne 'text' ) -% }; +% $_[0]->{disable_inventory} +% || $_[0]->{'type'} ne 'text' +% }; % tie my %flag, 'Tie::IxHash', % '' => { 'desc' => 'No default', }, % 'D' => { 'desc' => 'Default', % 'condition' => -% sub { ref($_[0]) && $_[0]->{disable_default} }, +% sub { $_[0]->{disable_default} }, % }, % 'F' => { 'desc' => 'Fixed (unchangeable)', % 'condition' => -% sub { ref($_[0]) && $_[0]->{disable_fixed} }, +% sub { $_[0]->{disable_fixed} }, % }, % 'S' => { 'desc' => 'Selectable Choice', % 'condition' => @@ -229,7 +107,7 @@ that field. % % my @dbs = $hashref->{svcdb} % ? ( $hashref->{svcdb} ) -% : qw( svc_acct svc_domain svc_forward svc_www svc_broadband svc_phone svc_external ); +% : FS::part_svc->svc_tables(); % % tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs; % my $widget = new HTML::Widgets::SelectLayers( @@ -291,8 +169,9 @@ that field. % my $part_svc_column = $part_svc->part_svc_column($field); % my $value = $part_svc_column->columnvalue; % my $flag = $part_svc_column->columnflag; -% my $def = $defs{$layer}{$field}; -% my $desc = ref($def) ? $def->{desc} : $def; +% #my $def = $defs{$layer}{$field}; +% my $def = FS::part_svc->svc_table_fields($layer)->{$field}; +% my $label = $def->{'def_label'} || $def->{'label'}; % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -301,14 +180,13 @@ that field. % } % % $html .= qq!<TR><TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">!. -% $field; -% $html .= "- <FONT SIZE=-1>$desc</FONT>" if $desc; -% $html .= "</TD>"; -% $flag = '' if ref($def) && $def->{type} eq 'disabled'; +% ( $label || $field ). +% "</TD>"; +% $flag = '' if $def->{type} eq 'disabled'; % % $html .= qq!<TD CLASS="grid" BGCOLOR="$bgcolor">!; % -% if ( ref($def) && $def->{type} eq 'disabled' ) { +% if ( $def->{type} eq 'disabled' ) { % % $html .= 'No default'; % @@ -372,7 +250,7 @@ that field. % my $disabled = $flag ? '' % : 'DISABLED STYLE="background-color: #dddddd"'; % -% if ( ! ref($def) || $def->{type} eq 'text' ) { +% if ( !$def->{type} || $def->{type} eq 'text' ) { % % my $nodisplay = ' STYLE="display:none"'; % my $is_inv = ( $flag =~ /^[MA]$/ ); diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 96d568754..4b1d2c840 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -19,6 +19,8 @@ % # OR % # 'redirect' => 'view/table.cgi?', # value of primary key is appended % # +% # 'error_redirect' => popurl(2).'edit/table.cgi?', #query string appended +% # % # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the % # #naming is still inconsistent % # @@ -78,7 +80,8 @@ % if ( $error ) { % $cgi->param('error', $error); % my $edit_ext = $opt{'edit_ext'} || 'html'; -% print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); +% my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext?"; +% print $cgi->redirect($url. $cgi->query_string ); % } elsif ( $opt{'redirect'} ) { % print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); % } else { diff --git a/httemplate/edit/process/svc_Common.html b/httemplate/edit/process/svc_Common.html new file mode 100644 index 000000000..f5c869a12 --- /dev/null +++ b/httemplate/edit/process/svc_Common.html @@ -0,0 +1,13 @@ +<%init> + +$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb"; +my $table = $1; +require "FS/$table.pm"; + +</%init> +<% include( 'elements/svc_Common.html', + 'table' => $table, + 'redirect' => popurl(3)."view/svc_Common.html?svcdb=$table;svcnum=", + 'error_redirect' => popurl(3)."edit/svc_Common.html?svcdb=$table;", + ) +%> diff --git a/httemplate/edit/svc_Common.html b/httemplate/edit/svc_Common.html new file mode 100644 index 000000000..6393f9ebc --- /dev/null +++ b/httemplate/edit/svc_Common.html @@ -0,0 +1,30 @@ +<%init> + +# false laziness w/view/svc_Common.html + +$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb"; +my $table = $1; +require "FS/$table.pm"; + +my %opt; +if ( UNIVERSAL::can("FS::$table", 'table_info') ) { + $opt{'name'} = "FS::$table"->table_info->{'name'}; + + my $fields = "FS::$table"->table_info->{'fields'}; + my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields; + $opt{'labels'} = \%labels; + +} + +</%init> +<% include('elements/svc_Common.html', + 'table' => $table, + 'post_url' => popurl(1). "process/svc_Common.html", + %opt, + ) +%> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index f552967e7..f42c14618 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -18,39 +18,39 @@ % die "No part_svc entry for svcpart $svcpart!" unless $part_svc; % @groups = $cgi->param('radius_usergroup'); % -%} else { +%} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding % -% my($query) = $cgi->keywords; -% if ( $query =~ /^(\d+)$/ ) { #editing -% $svcnum=$1; -% $svc_acct=qsearchs('svc_acct',{'svcnum'=>$svcnum}) -% or die "Unknown (svc_acct) svcnum!"; +% $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +% $pkgnum = $1; +% $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +% $svcpart = $1; % -% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) -% or die "Unknown (cust_svc) svcnum!"; +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% $pkgnum=$cust_svc->pkgnum; -% $svcpart=$cust_svc->svcpart; +% $svc_acct = new FS::svc_acct({svcpart => $svcpart}); % -% $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); -% die "No part_svc entry for svcpart $svcpart!" unless $part_svc; +% $svcnum=''; % -% @groups = $svc_acct->radius_groups; +%} else { #editing % -% } else { #adding +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum=$1; +% $svc_acct=qsearchs('svc_acct',{'svcnum'=>$svcnum}) +% or die "Unknown (svc_acct) svcnum!"; % -% foreach $_ (split(/-/,$query)) { -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -% } -% $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); -% die "No part_svc entry for svcpart $svcpart!" unless $part_svc; +% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) +% or die "Unknown (cust_svc) svcnum!"; % -% $svc_acct = new FS::svc_acct({svcpart => $svcpart}); +% $pkgnum=$cust_svc->pkgnum; +% $svcpart=$cust_svc->svcpart; % -% $svcnum=''; +% $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); +% die "No part_svc entry for svcpart $svcpart!" unless $part_svc; +% +% @groups = $svc_acct->radius_groups; % -% } %} % %my( $cust_pkg, $cust_main ) = ( '', '' ); diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 6b9535508..30eb6319f 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -1,10 +1,6 @@ -<!-- mason kludge --> -% -% %# If it's stupid but it works, it's still stupid. %# -Kristian % -% %use HTML::Widgets::SelectLayers; %use Tie::IxHash; % diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 19e0e1285..5ec074bda 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,8 +1,7 @@ -% -% %my($svcnum, $pkgnum, $svcpart, $kludge_action, $purpose, $part_svc, % $svc_domain); %if ( $cgi->param('error') ) { +% % $svc_domain = new FS::svc_domain ( { % map { $_, scalar($cgi->param($_)) } fields('svc_domain') % } ); @@ -13,40 +12,41 @@ % $purpose = $cgi->param('purpose'); % $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); % die "No part_svc entry!" unless $part_svc; -%} else { -% $kludge_action = ''; -% $purpose = ''; -% my($query) = $cgi->keywords; -% if ( $query =~ /^(\d+)$/ ) { #editing -% $svcnum=$1; -% $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum}) -% or die "Unknown (svc_domain) svcnum!"; % -% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) -% or die "Unknown (cust_svc) svcnum!"; +%} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding +% +% $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +% $pkgnum = $1; +% $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +% $svcpart = $1; % -% $pkgnum=$cust_svc->pkgnum; -% $svcpart=$cust_svc->svcpart; +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $svc_domain = new FS::svc_domain({}); % -% } else { #adding +% $svcnum=''; % -% $svc_domain = new FS::svc_domain({}); -% -% foreach $_ (split(/-/,$query)) { -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -% } -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $svc_domain->set_default_and_fixed; % -% $svcnum=''; +%} else { #editing % -% $svc_domain->set_default_and_fixed; +% $kludge_action = ''; +% $purpose = ''; +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum=$1; +% $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum}) +% or die "Unknown (svc_domain) 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 = $svcnum ? 'Edit' : 'Add'; 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'; % diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 73b32dc7b..ef08ffc16 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -13,39 +13,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; +%} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding +% +% $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +% $pkgnum = $1; +% $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +% $svcpart = $1; % -% if ( $query =~ /^(\d+)$/ ) { #editing -% $svcnum=$1; -% $svc_forward=qsearchs('svc_forward',{'svcnum'=>$svcnum}) -% or die "Unknown (svc_forward) svcnum!"; +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) -% or die "Unknown (cust_svc) svcnum!"; +% $svc_forward = new FS::svc_forward({}); % -% $pkgnum=$cust_svc->pkgnum; -% $svcpart=$cust_svc->svcpart; -% -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $svcnum=''; % -% } else { #adding +% $svc_forward->set_default_and_fixed; % -% $svc_forward = new FS::svc_forward({}); +%} else { #editing % -% foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -% } -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% my($query) = $cgi->keywords; % -% $svcnum=''; +% $query =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum=$1; +% $svc_forward=qsearchs('svc_forward',{'svcnum'=>$svcnum}) +% or die "Unknown (svc_forward) svcnum!"; % -% $svc_forward->set_default_and_fixed; -% } +% 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_forward->svcnum ? 'Edit' : 'Add'; diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index 30d98f08b..4b27752ff 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -1,10 +1,9 @@ -<!-- mason kludge --> -% -% %my $conf = new FS::Conf; % %my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_www ); +% %if ( $cgi->param('error') ) { +% % $svc_www = new FS::svc_www ( { % map { $_, scalar($cgi->param($_)) } fields('svc_www') % } ); @@ -13,38 +12,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_www=qsearchs('svc_www',{'svcnum'=>$svcnum}) -% or die "Unknown (svc_www) 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; +% +% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); +% die "No part_svc entry!" unless $part_svc; % -% } else { #adding +% $svc_www = new FS::svc_www { svcpart => $svcpart }; % -% foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -% } -% $svc_www = new FS::svc_www { svcpart => $svcpart }; +% $svcnum=''; % -% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); -% die "No part_svc entry!" unless $part_svc; +% $svc_www->set_default_and_fixed; % -% $svcnum=''; +%} else { #editing % -% $svc_www->set_default_and_fixed; +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum=$1; +% $svc_www=qsearchs('svc_www',{'svcnum'=>$svcnum}) +% or die "Unknown (svc_www) 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_www->svcnum ? 'Edit' : 'Add'; % |