diff options
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r-- | httemplate/edit/process/access_group.html | 9 | ||||
-rw-r--r-- | httemplate/edit/process/access_user.html | 5 | ||||
-rwxr-xr-x | httemplate/edit/process/agent.cgi | 5 | ||||
-rw-r--r-- | httemplate/edit/process/cgp_rule.html | 8 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/process/elements/process.html | 12 | ||||
-rw-r--r-- | httemplate/edit/process/elements/svc_Common.html | 15 | ||||
-rw-r--r-- | httemplate/edit/process/msg_template.html | 13 | ||||
-rw-r--r-- | httemplate/edit/process/part_tag.html | 11 | ||||
-rwxr-xr-x | httemplate/edit/process/rate_region.cgi | 21 | ||||
-rw-r--r-- | httemplate/edit/process/rate_time.cgi | 94 | ||||
-rwxr-xr-x | httemplate/edit/process/svc_acct.cgi | 1 |
12 files changed, 29 insertions, 167 deletions
diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html index 2d125c387..ab25cb3a2 100644 --- a/httemplate/edit/process/access_group.html +++ b/httemplate/edit/process/access_group.html @@ -1,3 +1,6 @@ +% if ( $conf->exists('disable_acl_changes') ) { + ACL changes disabled in public demo. +% } else { <% include( 'elements/process.html', 'table' => 'access_group', 'viewall_dir' => 'browse', @@ -14,14 +17,12 @@ }, ) %> +% } <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} +my $conf = new FS::Conf; </%init> diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index e6258a9b1..ca6bb603f 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -18,9 +18,4 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} - </%init> diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index e776d281c..3cdf40c9b 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -13,9 +13,4 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} - </%init> diff --git a/httemplate/edit/process/cgp_rule.html b/httemplate/edit/process/cgp_rule.html index 5326587cb..f427b6ccf 100644 --- a/httemplate/edit/process/cgp_rule.html +++ b/httemplate/edit/process/cgp_rule.html @@ -4,19 +4,13 @@ 'process_o2m' => [ { 'table' => 'cgp_rule_condition', - 'fields' => [qw( conditionname op params )], + 'fields' => [qw( condition op params )], }, { 'table' => 'cgp_rule_action', 'fields' => [qw( action params )], }, ], - 'noerror_callback' => sub { - my( $cgi, $object ) = @_; - my $error = $object->svc_export; - #shit, not a good place for error handling :/ - die $error if $error; - }, ) %> <%init> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 3158d7bbf..1311ba4f3 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -73,8 +73,6 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } -$new->tagnum( [ $cgi->param('tagnum') ] ); - my %usedatetime = ( 'birthdate' => 1 ); foreach my $dfield (qw( birthdate signupdate )) { diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 53419cde0..87cadb774 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -65,9 +65,6 @@ Example: #return an error string or empty for no error 'precheck_callback' => sub { my( $cgi ) = @_; }, - #after everything's inserted - 'noerror_callback' => sub { my( $cgi, $object ) = @_; }, - #supplies arguments to insert() and replace() # for use with tables that are FS::option_Common (among other things) 'args_callback' => sub { my( $cgi, $object ) = @_; }, @@ -207,7 +204,6 @@ if ( $opt{'agent_virt'} ) { die "illegal agentnum" unless $curuser->agentnums_href->{$new->agentnum} - or $curuser->access_right('View customers of all agents') or $opt{'agent_null_right'} && ! $new->agentnum && $curuser->access_right($opt{'agent_null_right'}); @@ -302,20 +298,12 @@ if ( !$error && $opt{'process_o2m'} ) { if ( $error ) { - $cgi->param('error', $error); if ( $opt{'clear_on_error'} && scalar(@{$opt{'clear_on_error'}}) ) { foreach my $field (@{$opt{'clear_on_error'}}) { $cgi->param($field, '') } } - -} else { - - if ( $opt{'noerror_callback'} ) { - &{ $opt{'noerror_callback'} }( $cgi, $new ); - } - } </%init> diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 5a8afbd6c..8e8c99a42 100644 --- a/httemplate/edit/process/elements/svc_Common.html +++ b/httemplate/edit/process/elements/svc_Common.html @@ -1,14 +1,15 @@ +% +% +% my %opt = @_; +% my $table = $opt{'table'}; +% $opt{'fields'} ||= [ fields($table) ]; +% push @{ $opt{'fields'} }, qw( pkgnum svcpart ); +% +% <% include( 'process.html', 'edit_ext' => 'cgi', 'redirect' => popurl(3)."view/$table.cgi?", %opt, ) %> -<%init> -my %opt = @_; -my $table = $opt{'table'}; -$opt{'fields'} ||= [ fields($table) ]; -push @{ $opt{'fields'} }, qw( pkgnum svcpart ); - -</%init> diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html deleted file mode 100644 index 70d451b72..000000000 --- a/httemplate/edit/process/msg_template.html +++ /dev/null @@ -1,13 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'msg_template', - 'viewall_dir' => 'browse', - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit templates') - || $FS::CurrentUser::CurrentUser->access_right('Edit global templates') - || $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -</%init> diff --git a/httemplate/edit/process/part_tag.html b/httemplate/edit/process/part_tag.html deleted file mode 100644 index 077dc4cd9..000000000 --- a/httemplate/edit/process/part_tag.html +++ /dev/null @@ -1,11 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'part_tag', - 'viewall_dir' => 'browse', - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -</%init> diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index d342e605a..8036f7388 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -1,8 +1,6 @@ %if ( $error ) { % $cgi->param('error', $error); <% $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ) %> -%} elsif ( $action eq 'Add' ) { -<% $cgi->redirect(popurl(2). "rate_region.cgi?$regionnum") %> %} else { <% $cgi->redirect(popurl(3). "browse/rate_region.html") %> %} @@ -13,7 +11,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $regionnum = $cgi->param('regionnum'); -my $action = $regionnum ? 'Edit' : 'Add'; my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum; @@ -36,12 +33,24 @@ my @rate_prefix = map { 'npa' => $_, } } @npa; -# we no longer process dest_detail records here + +my @dest_detail = map { + my $ratenum = $_->ratenum; + new FS::rate_detail { + 'ratenum' => $ratenum, + map { $_ => $cgi->param("$_$ratenum") } + qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ) + }; +} qsearch('rate', {} ); + + my $error; if ( $regionnum ) { - $error = $new->replace($old, 'rate_prefix' => \@rate_prefix ); + $error = $new->replace($old, 'rate_prefix' => \@rate_prefix, + 'dest_detail' => \@dest_detail, ); } else { - $error = $new->insert( 'rate_prefix' => \@rate_prefix ); + $error = $new->insert( 'rate_prefix' => \@rate_prefix, + 'dest_detail' => \@dest_detail, ); $regionnum = $new->getfield('regionnum'); } diff --git a/httemplate/edit/process/rate_time.cgi b/httemplate/edit/process/rate_time.cgi deleted file mode 100644 index 4fa78ce6d..000000000 --- a/httemplate/edit/process/rate_time.cgi +++ /dev/null @@ -1,94 +0,0 @@ -% if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "rate_time.cgi?". $cgi->query_string ) %> -% } else { -<% $cgi->redirect(popurl(3). "browse/rate_time.html" ) %> -% } -%# dumper_html(\%vars, \%old_ints, {$rate_time->intervals}) %> -<%init> -my $error = ''; -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $ratetimenum = $cgi->param('ratetimenum'); -my $ratetimename = $cgi->param('ratetimename'); -my $delete = $cgi->param('delete'); - -my %vars = $cgi->Vars; -#warn Dumper(\%vars)."\n"; - -my $rate_time; - -my %old_ints; -if( $ratetimenum ) { - # editing - $rate_time = FS::rate_time->by_key($ratetimenum); - - # make a list of existing intervals that will be deleted - foreach ($rate_time->intervals) { - $old_ints{$_->intervalnum} = $_; - } - - if ( $delete ) { - $error = $rate_time->delete; - # intervals will be deleted later - } - elsif( $ratetimename ne $rate_time->ratetimename ) { - # the only case where the rate_time itself must be replaced - $rate_time->ratetimename($ratetimename); - $error = $rate_time->replace; - } -} -else { #!$ratetimenum, adding new - $rate_time = FS::rate_time->new({ ratetimename => $ratetimename }); - $error = $rate_time->insert; - $ratetimenum = $rate_time->ratetimenum; -} - -my @new_ints; -if(!$delete and !$error) { - foreach my $i (map { /^sd(\d+)$/ } keys(%vars)) { - my $stime = l2wtime(@vars{"sd$i", "sh$i", "sm$i", "sa$i"}); - my $etime = l2wtime(@vars{"ed$i", "eh$i", "em$i", "ea$i"}); - #warn "$i: $stime - $etime"; - next if !defined($stime) or !defined($etime) or $etime == $stime; - # try to avoid needlessly wiping and replacing intervals every - # time this is edited. - if( %old_ints ) { - my $this_int = qsearchs('rate_time_interval', - { ratetimenum => $ratetimenum, - stime => $stime, - etime => $etime, } ); - if($this_int) { - delete $old_ints{$this_int->intervalnum}; - #warn "not deleting $stime-$etime\n"; - next; #$i - } - } - push @new_ints, FS::rate_time_interval->new({ ratetimenum => $ratetimenum, - stime => $stime, - etime => $etime, } ); - } -} -if(!$error) { - foreach (values(%old_ints)) { - $error = $_->delete; - #warn "deleting ".$_->stime.' '.$_->etime."\n"; - last if $error; - } -} -if(!$error) { - # do this last to avoid overlap errors with deleted intervals - foreach (@new_ints) { - $error = $_->insert; - #warn "inserting $stime-$etime\n"; - last if $error; - } -} - -sub l2wtime { - my ($d, $h, $m, $a) = @_; - $h += 24*$d + 12*$a; - $m += 60*$h; - return 60*$m -} -</%init> diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 0b272b5b1..0d2c007f1 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -70,7 +70,6 @@ if ( $svcnum ) { grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^\d+$/ } keys %hash; $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } |