diff options
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-x | httemplate/edit/process/REAL_cust_pkg.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/process/access_user.html | 10 | ||||
-rw-r--r-- | httemplate/edit/process/acct_snarf.html | 20 | ||||
-rw-r--r-- | httemplate/edit/process/bulk-cust_pkg.cgi | 9 | ||||
-rw-r--r-- | httemplate/edit/process/cgp_rule-redirect_all.html | 24 | ||||
-rw-r--r-- | httemplate/edit/process/cgp_rule-simplified.html | 53 | ||||
-rw-r--r-- | httemplate/edit/process/cgp_rule-vacation.html | 29 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 9 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_pay.cgi | 12 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_refund.cgi | 15 | ||||
-rwxr-xr-x | httemplate/edit/process/domain_record.cgi | 19 | ||||
-rwxr-xr-x | httemplate/edit/process/part_pkg.cgi | 8 | ||||
-rw-r--r-- | httemplate/edit/process/prospect_main.html | 7 | ||||
-rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 6 | ||||
-rw-r--r-- | httemplate/edit/process/rate_time.cgi | 3 | ||||
-rwxr-xr-x | httemplate/edit/process/svc_acct.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/process/svc_domain-defaultrecords.cgi | 18 |
17 files changed, 228 insertions, 18 deletions
diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 570f0e031..3a62ee001 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -20,7 +20,7 @@ my $pkgnum = $cgi->param('pkgnum') or die; my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my %hash = $old->hash; $hash{$_}= $cgi->param($_) ? parse_datetime($cgi->param($_)) : '' - foreach qw( start_date setup bill last_bill adjourn expire ); + foreach qw( start_date setup bill last_bill adjourn expire contract_end ); my @errors = (); diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index e6258a9b1..8e7e70a06 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -10,6 +10,7 @@ 'process_m2m' => { 'link_table' => 'access_usergroup', 'target_table' => 'access_group', }, + 'precheck_callback'=> \&precheck_callback, ) %> % } @@ -23,4 +24,13 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) { die "shouldn't be reached"; } +sub precheck_callback { + my $cgi = shift; + my $o = FS::access_user->new({username => $cgi->param('username')}); + if( $o->is_system_user and !$cgi->param('usernum') ) { + $cgi->param('username',''); + return "username '".$o->username."' reserved for system account." + } + return ''; +} </%init> diff --git a/httemplate/edit/process/acct_snarf.html b/httemplate/edit/process/acct_snarf.html new file mode 100644 index 000000000..332ac5228 --- /dev/null +++ b/httemplate/edit/process/acct_snarf.html @@ -0,0 +1,20 @@ +<% include( 'elements/process.html', + 'table' => 'acct_snarf', + 'redirect' => $redirect, + 'noerror_callback' => sub { + my( $cgi, $object ) = @_; + my $error = $object->svc_export; + #shit, not a good place for error handling :/ + die $error if $error; + }, + ) +%> +<%init> + +my $redirect = sub { + my($cgi, $new) = @_; + my $svcnum = $new->svcnum; + popurl(3)."browse/acct_snarf.html?svcnum=$svcnum;snarfnum="; +}; + +</%init> diff --git a/httemplate/edit/process/bulk-cust_pkg.cgi b/httemplate/edit/process/bulk-cust_pkg.cgi new file mode 100644 index 000000000..ede3ee8cd --- /dev/null +++ b/httemplate/edit/process/bulk-cust_pkg.cgi @@ -0,0 +1,9 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $server = new FS::UI::Web::JSRPC 'FS::cust_pkg::process_bulk_cust_pkg', $cgi; + +</%init> diff --git a/httemplate/edit/process/cgp_rule-redirect_all.html b/httemplate/edit/process/cgp_rule-redirect_all.html new file mode 100644 index 000000000..162d857c2 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-redirect_all.html @@ -0,0 +1,24 @@ +<% include('cgp_rule-simplified.html', + 'name' => '#Redirect', + 'priority' => 1, + 'redirect' => 'cgp_rule-redirect_all.html', + 'conditions' => [ + ( $cgi->param('RedirHuman') + ? { conditionname => 'Human Generated', } + : () + ), + ], + 'actions' => [ + { action => ( $cgi->param('KeepToAndCc') + ? 'Mirror To' + : 'Redirect To' + ), + params => scalar($cgi->param('RedirectText')), + }, + ( $cgi->param('RedirKeep') + ? () + : ( { 'action' => 'Discard' } ) + ), + ], + ) +%> diff --git a/httemplate/edit/process/cgp_rule-simplified.html b/httemplate/edit/process/cgp_rule-simplified.html new file mode 100644 index 000000000..60769d4e6 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-simplified.html @@ -0,0 +1,53 @@ +% if ( $error ) { #redirect back to edit... +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(3).'edit/'.$opt{'redirect'}.'?'. $cgi->query_string) %> +% } else { #success XXX better msg talking about vacation vs. redirect all + <% include('/elements/header-popup.html', 'Rule updated') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY> + </HTML> +% } +<%init> + +my %opt = @_; + +my %hash = ( + 'svcnum' => scalar($cgi->param('svcnum')), + 'name' => $opt{'name'}, +); + +my $cgp_rule = qsearchs('cgp_rule', \%hash); + +my $error = ''; +if ( $cgp_rule ) { #updating + $error = $cgp_rule->delete; +} + +$cgp_rule = new FS::cgp_rule { %hash, 'priority' => $opt{'priority'} }; +$error ||= $cgp_rule->insert; + +foreach my $condition ( @{ $opt{'conditions'} } ) { + my $cgp_rule_condition = new FS::cgp_rule_condition { + %$condition, + 'rulenum' => $cgp_rule->rulenum, + }; + $error ||= $cgp_rule_condition->insert; +} + +foreach my $action ( @{ $opt{'actions'} } ) { + my $cgp_rule_action = new FS::cgp_rule_action { + %$action, + 'rulenum' => $cgp_rule->rulenum, + }; + $error ||= $cgp_rule_action->insert; +} + +unless ( $error ) { + my $export_error = $cgp_rule->svc_export; + die $export_error if $export_error; #error handling sucks wrt this... shouldn't happen though +} + +</%init> diff --git a/httemplate/edit/process/cgp_rule-vacation.html b/httemplate/edit/process/cgp_rule-vacation.html new file mode 100644 index 000000000..f10d72b73 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-vacation.html @@ -0,0 +1,29 @@ +<% include('cgp_rule-simplified.html', + 'name' => '#Vacation', + 'priority' => 2, + 'redirect' => 'cgp_rule-vacation.html', + 'conditions' => [ + { conditionname => 'Human Generated', }, + { conditionname => 'From', + op => 'not in', + params => '#RepliedAddresses', + }, + ( $cgi->param('VacationTill') + ? ( { conditionname => 'Current Date', + op => 'less than', #is less? + params => scalar($cgi->param('VacationTill')), + } + ) + : () + ), + ], + 'actions' => [ + { action => 'Reply with', + params => scalar($cgi->param('VacationText')), + }, + { action => "Remember 'From' in", + params => 'RepliedAddresses', + }, + ], + ) +%> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 3158d7bbf..24cecea64 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -73,6 +73,10 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } +if ( $cgi->param('no_credit_limit') ) { + $new->setfield('credit_limit', ''); +} + $new->tagnum( [ $cgi->param('tagnum') ] ); my %usedatetime = ( 'birthdate' => 1 ); @@ -247,6 +251,11 @@ if ( $new->custnum eq '' ) { $new->payinfo($new_account.'@'.$new_aba); } + if ( ! $conf->exists('cust_main-edit_signupdate') or + ! $new->signupdate ) { + $new->signupdate($old->signupdate); + } + warn "$me calling $new -> replace( $old, \ @invoicing_list )" if $DEBUG; local($FS::cust_main::DEBUG) = $DEBUG if $DEBUG; local($FS::Record::DEBUG) = $DEBUG if $DEBUG; diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index df506c677..d6bbf06b0 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -27,9 +27,6 @@ %} <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); - $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; @@ -47,11 +44,18 @@ my $new = new FS::cust_pay ( { map { $_, scalar($cgi->param($_)); } qw( paid payby payinfo paybatch - pkgnum + pkgnum discount_term ) #} fields('cust_pay') } ); +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $new->payby eq 'BILL'; +push @rights, 'Post cash payment' if $new->payby eq 'CASH'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $error = $new->insert( 'manual' => 1 ); </%init> diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 5749e5346..389bc990c 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -28,8 +28,21 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) my $link = $cgi->param('popup') ? 'popup' : ''; +my $payby = $cgi->param('payby'); + +my @rights = (); +push @rights, 'Post refund' if $payby /^(BILL|CASH)$/; +push @rights, 'Post check refund' if $payby eq 'BILL'; +push @rights, 'Post cash refund ' if $payby eq 'CASH'; +push @rights, 'Refund payment' if $payby /^(CARD|CHEK)$/; +push @rights, 'Refund credit card payment' if $payby eq 'CARD'; +push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $error = ''; -if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { +if ( $payby =~ /^(CARD|CHEK)$/ ) { my %options = (); my $bop = $FS::payby::payby2bop{$1}; $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index 2e427e4fb..8369f7114 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -1,8 +1,14 @@ %if ( $error ) { % errorpage($error); -%} else { +%} elsif ( $recnum ) { #editing +<% header('Nameservice record changed') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY></HTML> +%} else { #adding % my $svcnum = $new->svcnum; -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> %} <%init> @@ -11,7 +17,7 @@ die "access denied" my $recnum = $cgi->param('recnum'); -my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; +my $old = qsearchs('domain_record',{'recnum'=>$recnum}) if $recnum; my $new = new FS::domain_record ( { map { @@ -21,10 +27,11 @@ my $new = new FS::domain_record ( { my $error; if ( $recnum ) { - $error=$new->replace($old); + $new->svcnum( $old->svcnum ); + $error = $new->replace($old); } else { - $error=$new->insert; - $recnum=$new->getfield('recnum'); + $error = $new->insert; + #$recnum = $new->getfield('recnum'); } </%init> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index c0febf828..97ae4e7ee 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -103,7 +103,7 @@ my $args_callback = sub { $options{"usage_taxproductnum_$_"} = $value; } - foreach ( $cgi->param('report_option') ) { + foreach ( grep $_, $cgi->param('report_option') ) { $error ||= "Illegal optional report class: $_" unless ( $_ =~ /^\d*$/ ); $options{"report_option_$_"} = 1; } @@ -160,6 +160,12 @@ my @process_m2m = ( 'target_table' => 'tax_class', 'params' => \@tax_overrides, }, + { 'link_table' => 'part_pkg_discount', + 'target_table' => 'discount', + 'params' => [ map $cgi->param($_), + grep /^discountnum/, $cgi->param + ], + }, { 'link_table' => 'part_pkg_link', 'target_table' => 'part_pkg', 'base_field' => 'src_pkgpart', diff --git a/httemplate/edit/process/prospect_main.html b/httemplate/edit/process/prospect_main.html index 34d26421b..ca4dfabfe 100644 --- a/httemplate/edit/process/prospect_main.html +++ b/httemplate/edit/process/prospect_main.html @@ -4,7 +4,7 @@ 'agent_virt' => 1, 'process_o2m' => { 'table' => 'contact', - 'fields' => [qw( first last title comment )], + 'fields' => \@contact_fields, }, 'redirect' => popurl(3). 'view/prospect_main.html?', ) @@ -31,4 +31,9 @@ my $args_callback = sub { }; +my @contact_fields = qw( first last title comment emailaddress ); +foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { + push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum; +} + </%init> diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 2fde17f5e..599f7607c 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -66,6 +66,10 @@ my $cust_pkg = new FS::cust_pkg { 'discountnum_amount' => scalar($cgi->param('discountnum_amount')), 'discountnum_percent' => scalar($cgi->param('discountnum_percent')), 'discountnum_months' => scalar($cgi->param('discountnum_months')), + 'contract_end' => ( scalar($cgi->param('contract_end')) + ? parse_datetime($cgi->param('contract_end')) + : '' + ), #'discountnum_disabled' => scalar($cgi->param('discountnum_disabled')), }; @@ -74,7 +78,7 @@ my %opt = ( 'cust_pkg' => $cust_pkg ); if ( $locationnum == -1 ) { my $cust_location = new FS::cust_location { map { $_ => scalar($cgi->param($_)) } - qw( custnum address1 address2 city county state zip country ) + qw( custnum address1 address2 city county state zip country geocode ) }; $opt{'cust_location'} = $cust_location; } diff --git a/httemplate/edit/process/rate_time.cgi b/httemplate/edit/process/rate_time.cgi index 4fa78ce6d..2b00be3ea 100644 --- a/httemplate/edit/process/rate_time.cgi +++ b/httemplate/edit/process/rate_time.cgi @@ -4,7 +4,6 @@ % } else { <% $cgi->redirect(popurl(3). "browse/rate_time.html" ) %> % } -%# dumper_html(\%vars, \%old_ints, {$rate_time->intervals}) %> <%init> my $error = ''; die "access denied" @@ -87,7 +86,7 @@ if(!$error) { sub l2wtime { my ($d, $h, $m, $a) = @_; - $h += 24*$d + 12*$a; + $h = ($h % 12) + 24*$d + 12*$a; $m += 60*$h; return 60*$m } diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 0b272b5b1..ba21ab4b5 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -70,7 +70,7 @@ if ( $svcnum ) { grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^\d+$/ } keys %hash; + $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^-?\d+$/ } keys %hash; $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } diff --git a/httemplate/edit/process/svc_domain-defaultrecords.cgi b/httemplate/edit/process/svc_domain-defaultrecords.cgi new file mode 100644 index 000000000..ec3d221f3 --- /dev/null +++ b/httemplate/edit/process/svc_domain-defaultrecords.cgi @@ -0,0 +1,18 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice'); + +my $svcnum = scalar($cgi->param('svcnum')); + +my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svcnum }) + or die 'unknown svc_domain.svcnum'; + +my $error = $svc_domain->insert_defaultrecords; + +</%init> |