diff options
Diffstat (limited to 'httemplate/misc/process')
33 files changed, 0 insertions, 1610 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi deleted file mode 100644 index aa371266c..000000000 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ /dev/null @@ -1,68 +0,0 @@ -% die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); -% -% my $param = $cgi->Vars; -% -% #my $paybatch = $param->{'paybatch'}; -% my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); -% -% my @cust_pay = (); -% #my $row = 0; -% #while ( exists($param->{"custnum$row"}) ) { -% for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { -% my $custnum = $param->{"custnum$row"}; -% my $cust_main; -% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) { -% $cust_main = qsearchs({ -% 'table' => 'cust_main', -% 'hashref' => { 'custnum' => $1 }, -% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -% }); -% } -% if ( !$cust_main ) { # not found, try agent_custid -% $cust_main = qsearchs({ -% 'table' => 'cust_main', -% 'hashref' => { 'agent_custid' => $custnum }, -% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -% }); -% } -% $custnum = $cust_main->custnum if $cust_main; -% # if !$cust_main, then this will throw an error on batch_insert -% -% push @cust_pay, new FS::cust_pay { -% 'custnum' => $custnum, -% 'paid' => $param->{"paid$row"}, -% 'payby' => 'BILL', -% 'payinfo' => $param->{"payinfo$row"}, -% 'discount_term' => $param->{"discount_term$row"}, -% 'paybatch' => $paybatch, -% } -% if $param->{"custnum$row"} -% || $param->{"paid$row"} -% || $param->{"payinfo$row"}; -% #$row++; -% } -% -% my @errors = FS::cust_pay->batch_insert(@cust_pay); -% my $num_errors = scalar(grep $_, @errors); -% -% if ( $num_errors ) { -% -% $cgi->param('error', "$num_errors error". ($num_errors>1 ? 's' : ''). -% ' - Batch not processed, correct and resubmit' -% ); -% -% my $erow=0; -% $cgi->param('error'. $erow++, shift @errors) while @errors; -% -% my $query = $m->scomp('/elements/create_uri_query'); -% -<% $cgi->redirect($p."batch-cust_pay.html?$query") - - %> -% } else { -% -% -<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %> -% } - diff --git a/httemplate/misc/process/bill_batch-print.html b/httemplate/misc/process/bill_batch-print.html deleted file mode 100644 index 54d639eeb..000000000 --- a/httemplate/misc/process/bill_batch-print.html +++ /dev/null @@ -1,5 +0,0 @@ -% die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); -% my $server = FS::UI::Web::JSRPC->new('FS::bill_batch::process_print_pdf', $cgi); -<% $server->process %> -<%init></%init> diff --git a/httemplate/misc/process/bulk_change_pkg.cgi b/httemplate/misc/process/bulk_change_pkg.cgi deleted file mode 100755 index e22dafef0..000000000 --- a/httemplate/misc/process/bulk_change_pkg.cgi +++ /dev/null @@ -1,56 +0,0 @@ -% if ($error) { -<% $cgi->redirect(popurl(2)."/bulk_change_pkg.cgi?".$cgi->query_string ) %> -% } -<% include('/elements/header-popup.html', "Packages Changed") %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages'); - -my %search_hash = (); - -$search_hash{'query'} = $cgi->param('query'); - -for my $param (qw(agentnum magic status classnum pkgpart)) { - $search_hash{$param} = $cgi->param($param) - if $cgi->param($param); -} - -### -# parse dates -### - -#false laziness w/report_cust_pkg.html -my %disable = ( - 'all' => {}, - 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, - 'active' => { 'susp'=>1, 'cancel'=>1 }, - 'suspended' => { 'cancel' => 1 }, - 'cancelled' => {}, - '' => {}, -); - -foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { - - my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field); - - next if $beginning == 0 && $ending == 4294967295 - or $disable{$cgi->param('status')}->{$field}; - - $search_hash{$field} = [ $beginning, $ending ]; - -} - -my $sql_query = FS::cust_pkg->search(\%search_hash); -$sql_query->{'select'} = 'cust_pkg.pkgnum'; - -my $error = FS::cust_pkg::bulk_change( [ $cgi->param('new_pkgpart') ], - [ map { $_->pkgnum } qsearch($sql_query) ], - ); - -$cgi->param("error", substr($error, 0, 512)); # arbitrary length believed - # suited for all supported - # browsers - - -</%init> diff --git a/httemplate/misc/process/bulk_pkg_increment_bill.cgi b/httemplate/misc/process/bulk_pkg_increment_bill.cgi deleted file mode 100755 index 0d8417b26..000000000 --- a/httemplate/misc/process/bulk_pkg_increment_bill.cgi +++ /dev/null @@ -1,76 +0,0 @@ -%if ($error) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). 'bulk_pkg_increment_bill.cgi?'. $cgi->query_string ) %> -%} else { -<% header('Packages Adjusted') %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> -% } -<%init> - -local $FS::UID::AutoCommit = 0; -my $dbh = dbh; -my $error; - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages') - and $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); - -my $days = $cgi->param('days') or die "missing parameter: days"; -$days > 0 or $error = "Number of days must be > 0"; - -my %search_hash = (); - -$search_hash{'query'} = $cgi->param('query'); - -for my $param (qw(agentnum magic status classnum pkgpart)) { - $search_hash{$param} = $cgi->param($param) - if $cgi->param($param); -} - -### -# parse dates -### - -#false laziness w/report_cust_pkg.html -# and, now, w/bulk_change_pkg.cgi -my %disable = ( - 'all' => {}, - 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, - 'active' => { 'susp'=>1, 'cancel'=>1 }, - 'suspended' => { 'cancel' => 1 }, - 'cancelled' => {}, - '' => {}, -); - -foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { - - my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field); - - next if $beginning == 0 && $ending == 4294967295 - or $disable{$cgi->param('status')}->{$field}; - - $search_hash{$field} = [ $beginning, $ending ]; - -} - -if(!$error) { - foreach my $cust_pkg (qsearch(FS::cust_pkg->search(\%search_hash))) { - next if ! $cust_pkg->bill; - my $new_cust_pkg = FS::cust_pkg->new({ $cust_pkg->hash }); - $new_cust_pkg->bill($new_cust_pkg->bill + $days*86400); - $error = $new_cust_pkg->replace($cust_pkg); - - if($error) { - $cgi->param("error",substr($error, 0, 512)); - $dbh->rollback; - return; - } - } - - $dbh->commit; -} - -</%init> diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html deleted file mode 100755 index e17872c06..000000000 --- a/httemplate/misc/process/cancel_pkg.html +++ /dev/null @@ -1,72 +0,0 @@ -<% header("Package $past{$method}") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY> -</HTML> -<%once> - -my %past = ( 'cancel' => 'cancelled', - 'expire' => 'expired', - 'suspend' => 'suspended', - 'adjourn' => 'adjourned', - ); - -#i'm sure this is false laziness with somewhere, at least w/misc/cancel_pkg.html -my %right = ( 'cancel' => 'Cancel customer package immediately', - 'expire' => 'Cancel customer package later', - 'suspend' => 'Suspend customer package', - 'adjourn' => 'Suspend customer package later', - ); - -</%once> -<%init> - -#untaint method -my $method = $cgi->param('method'); -$method =~ /^(cancel|expire|suspend|adjourn)$/ or die "Illegal method"; -$method = $1; - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right($right{$method}); - -#untaint pkgnum -my $pkgnum = $cgi->param('pkgnum'); -$pkgnum =~ /^(\d+)$/ or die "Illegal pkgnum"; -$pkgnum = $1; - -#untaint reasonnum -my $reasonnum = $cgi->param('reasonnum'); -$reasonnum =~ /^(-?\d+)$/ or die "Illegal reasonnum"; -$reasonnum = $1; - -my $date = time; -if ($method eq 'expire' || $method eq 'adjourn'){ - #untaint date - $date = $cgi->param('date'); - parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; - $date = $1; - $method = ($method eq 'expire') ? 'cancel' : 'suspend'; -} - -my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); - -#my $otaker = $FS::CurrentUser::CurrentUser->name; -#$otaker = $FS::CurrentUser::CurrentUser->username -# if ($otaker eq "User, Legacy"); - -if ($reasonnum == -1) { - $reasonnum = { - 'typenum' => scalar( $cgi->param('newreasonnumT') ), - 'reason' => scalar( $cgi->param('newreasonnum' ) ), - }; -} - -my $error = $cust_pkg->$method( 'reason' => $reasonnum, 'date' => $date ); - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); -} - -</%init> diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi deleted file mode 100755 index 0dda2eada..000000000 --- a/httemplate/misc/process/catchall.cgi +++ /dev/null @@ -1,35 +0,0 @@ -%if ($error) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "catchall.cgi?". $cgi->query_string ) %> -%} else { -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> -%} -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall'); - -$FS::svc_domain::whois_hack=1; - -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum =$1; - -my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; - -my $new = new FS::svc_domain ( { - map { - ($_, scalar($cgi->param($_))); - } ( fields('svc_domain'), qw( pkgnum svcpart ) ) -} ); - -$new->setfield('action' => 'M'); - -my $error; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->getfield('svcnum'); -} - -</%init> diff --git a/httemplate/misc/process/cdr-import.html b/httemplate/misc/process/cdr-import.html deleted file mode 100644 index edc441e35..000000000 --- a/httemplate/misc/process/cdr-import.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::cdr::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/copy-rate_detail.html b/httemplate/misc/process/copy-rate_detail.html deleted file mode 100644 index 60b2aebee..000000000 --- a/httemplate/misc/process/copy-rate_detail.html +++ /dev/null @@ -1,61 +0,0 @@ -%# if ( $error ) { -%# <% $cgi->redirect(popurl(2).'copy-rate_detail.html?'. $cgi->query_string ) %> -%# } else { -<% include('/elements/header.html', 'Rates copied', - menubar( 'View all rate plans' => popurl(3).'browse/rate.cgi' ), - ) %> -%# } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -$cgi->param('src_ratenum') =~ /^(\d+)$/ or die 'Illegal src_ratenum'; -my $src_ratenum = $1; - -$cgi->param('dst_ratenum') =~ /^(\d+)$/ or die 'Illegal src_ratenum'; -my $dst_ratenum = $1; - -my @countrycodes = map { /^countrycode(\d+)$/ or die; $1 } - grep { /^countrycode(\d+)$/ && $cgi->param($_) } - $cgi->param; - -foreach my $countrycode ( @countrycodes ) { - - my @src_rate_detail = qsearch({ - 'table' => 'rate_detail', - 'addl_from' => 'JOIN rate_region'. - ' ON ( rate_detail.dest_regionnum = rate_region.regionnum )', - 'hashref' => { 'ratenum' => $src_ratenum }, - 'extra_sql' => - "AND 0 < ( SELECT COUNT(*) FROM rate_prefix - WHERE rate_prefix.regionnum = rate_region.regionnum - AND countrycode = '$countrycode' - ) - ", - }); - - foreach my $src_rate_detail ( @src_rate_detail ) { - - my %hash = ( - 'ratenum' => $dst_ratenum, - map { $_ => $src_rate_detail->get($_) } - qw( orig_regionnum dest_regionnum ) - ); - - my $dst_rate_detail = qsearchs( 'rate_detail', \%hash) - || new FS::rate_detail \%hash; - - $dst_rate_detail->$_( $src_rate_detail->get($_) ) - foreach qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ); - - my $method = $dst_rate_detail->ratedetailnum ? 'replace' : 'insert'; - - my $error = $dst_rate_detail->$method(); - - die $error if $error; # "shouldn't" happen - - } -} - -</%init> diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi deleted file mode 100644 index 2b705a6fc..000000000 --- a/httemplate/misc/process/cust_main-import.cgi +++ /dev/null @@ -1,10 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = - new FS::UI::Web::JSRPC 'FS::cust_main::Import::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi deleted file mode 100644 index bda3e3b70..000000000 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ /dev/null @@ -1,24 +0,0 @@ -% if ( $error ) { -% errorpage($error); -% } else { - <% include('/elements/header.html','Import successful') %> - <% include('/elements/footer.html') %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $fh = $cgi->upload('csvfile'); -#warn $cgi; -#warn $fh; - -my $error = defined($fh) - ? FS::cust_main::batch_charge( { - filehandle => $fh, - 'agentnum' => scalar($cgi->param('agentnum')), - 'format' => scalar($cgi->param('format')), - } ) - : 'No file'; - -</%init> diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi deleted file mode 100644 index 6625e0029..000000000 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ /dev/null @@ -1,85 +0,0 @@ -<% include("/elements/header.html", "Batch Customer Note Import $op") %> - -The following items <% $op eq 'Preview' ? 'would not be' : 'were not' %> imported. (See below for imported items) -<PRE> -% foreach my $row (@uninserted) { -% $csv->combine( (map{ $row->{$_} } qw(last first note) ), -% $row->{error} ? ('#!', $row->{error}) : (), -% ); -<% $csv->string %> -% } -</PRE> - -The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See above for unimported items) - -<PRE> -% foreach my $row (@inserted) { -% $csv->combine( (map{ $row->{$_} } qw(custnum last first note) ), -% ('#!', $row->{name}), -% ); -<% $csv->string %> -% } -</PRE> - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -$FS::cust_main::import=1; # the customer records are already in the database -my $date = time; -my $otaker = $FS::CurrentUser::CurrentUser->username; -my $csv = new Text::CSV_XS; - -my $param = $cgi->Vars; - -my $op = $param->{preview} ? "Preview" : "Results"; - -my @inserted = (); -my @uninserted = (); -for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { - if ( $param->{"custnum$row"} ) { - my $error = ''; - if ( $param->{use_comments} ) { # why? notes are sexier - my $cust_main = qsearchs('cust_main', - { 'custnum' => $param->{"custnum$row"} } - ); - if ($cust_main) { - $cust_main->comments - ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"}) - : $cust_main->comments($param->{"note$row"}); - $error = $cust_main->replace; - }else{ - $error = "Can't find customer " . $param->{"custnum$row"}; - } - } else { - my $cust_main_note = new FS::cust_main_note { - 'custnum' => $param->{"custnum$row"}, - '_date' => $date, - 'otaker' => $otaker, - 'comments' => $param->{"note$row"}, - }; - $error = $cust_main_note->insert unless ($op eq "Preview"); - } - my $result = { 'custnum' => $param->{"custnum$row"}, - 'last' => $param->{"last$row"}, - 'first' => $param->{"first$row"}, - 'note' => $param->{"note$row"}, - 'name' => $param->{"name$row"}, - 'error' => $error, - }; - if ($error) { - push @uninserted, $result; - }else{ - push @inserted, $result; - } - }else{ - push @uninserted, { 'custnum' => '', - 'last' => $param->{"last$row"}, - 'first' => $param->{"first$row"}, - 'note' => $param->{"note$row"}, - 'error' => '', - }; - } -} -</%init> diff --git a/httemplate/misc/process/cust_pay-import.cgi b/httemplate/misc/process/cust_pay-import.cgi deleted file mode 100644 index 92b6e5a36..000000000 --- a/httemplate/misc/process/cust_pay-import.cgi +++ /dev/null @@ -1,21 +0,0 @@ -<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %> -<%init> - -my $fh = $cgi->upload('csvfile'); - -# webbatch? I suppose -my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); - -my $error = defined($fh) - ? FS::cust_pay::batch_import( { - 'filehandle' => $fh, - 'agentnum' => scalar($cgi->param('agentnum')), - 'format' => scalar($cgi->param('format')), - 'paybatch' => $paybatch, - } ) - : 'No file'; - -errorpage($error) - if ( $error ); - -</%init> diff --git a/httemplate/misc/process/cust_pkg-import.html b/httemplate/misc/process/cust_pkg-import.html deleted file mode 100644 index 1021817e4..000000000 --- a/httemplate/misc/process/cust_pkg-import.html +++ /dev/null @@ -1,10 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = - new FS::UI::Web::JSRPC 'FS::cust_pkg::Import::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/delay_susp_pkg.html b/httemplate/misc/process/delay_susp_pkg.html deleted file mode 100755 index 8649cc235..000000000 --- a/httemplate/misc/process/delay_susp_pkg.html +++ /dev/null @@ -1,41 +0,0 @@ -<% header("Package suspension delayed") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY> -</HTML> -<%once> - -my $right = 'Delay suspension events'; - -</%once> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right($right); - -my ($pkgnum, $date, $cust_pkg, $cust_main, $error); - -#untaint pkgnum -$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -$pkgnum = $1; - -#untaint date -parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; -my $date = $1; - -$cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); -if ($cust_pkg) { - $cust_main = $cust_pkg->cust_main; - $cust_main->dundate( $date ); - $error = $cust_main->replace; -} else { - $error = "Invalid pkgnum"; -} - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); -} - -</%init> diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi deleted file mode 100755 index 12011311a..000000000 --- a/httemplate/misc/process/delete-customer.cgi +++ /dev/null @@ -1,33 +0,0 @@ -%if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ) %> -%} elsif ( $new_custnum ) { -<% $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum") %> -%} else { -<% $cgi->redirect(popurl(3)) %> -%} -<%init> - -my $conf = new FS::Conf; -die "Customer deletions not enabled in configuration" - unless $conf->exists('deletecustomers'); - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Delete customer'); - -$cgi->param('custnum') =~ /^(\d+)$/; -my $custnum = $1; -my $new_custnum; -if ( $cgi->param('new_custnum') ) { - $cgi->param('new_custnum') =~ /^(\d+)$/ - or die "Illegal new customer number: ". $cgi->param('new_custnum'); - $new_custnum = $1; -} else { - $new_custnum = ''; -} -my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) - or die "Customer not found: $custnum"; - -my $error = $cust_main->delete('new_custnum' => $new_custnum); - -</%init> diff --git a/httemplate/misc/process/email-customers.html b/httemplate/misc/process/email-customers.html deleted file mode 100644 index de2bb926b..000000000 --- a/httemplate/misc/process/email-customers.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices'); - -my $server = new FS::UI::Web::JSRPC 'FS::cust_main_Mixin::process_email_search_result', $cgi; - -</%init> diff --git a/httemplate/misc/process/enable_or_disable_tax.html b/httemplate/misc/process/enable_or_disable_tax.html deleted file mode 100755 index 9b7324b0d..000000000 --- a/httemplate/misc/process/enable_or_disable_tax.html +++ /dev/null @@ -1,41 +0,0 @@ -%if ($error) { -<% $cgi->redirect(popurl(2).'enable_or_disable_tax.html?'.$cgi->query_string) %> -%}else{ - <% include('/elements/header-popup.html', $title) %> - - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - - </BODY> - </HTML> -%} -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $action = ''; -if ( $cgi->param('action') =~ /^(\w+)$/ ) { - $action = $1; -} - -my ($query, $count_query) = FS::tax_rate::browse_queries(scalar($cgi->Vars)); -my @tax_rate = qsearch( $query ); - -#transaction? -my $error; -$error = "Invalid action" unless ($action =~ /enable|disable/); - -foreach my $tax_rate (@tax_rate) { - $action eq 'enable' ? $tax_rate->disabled('') : $tax_rate->disabled('Y'); - # $tax_rate->manual('Y'); - $error ||= $tax_rate->replace; - last if $error; -} -$cgi->param('error', $error) if $error; - -my $title = scalar(@tax_rate) == 1 ? 'Tax rate ' : 'Tax rates '; -$title .= lc($action). 'd'; - -</%init> diff --git a/httemplate/misc/process/inventory_item-import.html b/httemplate/misc/process/inventory_item-import.html deleted file mode 100644 index 377943fb1..000000000 --- a/httemplate/misc/process/inventory_item-import.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::inventory_item::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi deleted file mode 100755 index 77546f3f7..000000000 --- a/httemplate/misc/process/link.cgi +++ /dev/null @@ -1,78 +0,0 @@ -%unless ($error) { -% #no errors, so let's view this customer. -% my $custnum = $new->cust_pkg->custnum; -% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ -% ? '' -% : ';show=packages'; -% my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment -<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" ) %> -%} else { -% errorpage($error); -%} -<%init> - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access denied" - unless $curuser->access_right('View/link unlinked services'); - -my $DEBUG = 0; - -$cgi->param('pkgnum') =~ /^(\d+)$/; -my $pkgnum = $1; -$cgi->param('svcpart') =~ /^(\d+)$/; -my $svcpart = $1; -$cgi->param('svcnum') =~ /^(\d*)$/; -my $svcnum = $1; - -unless ( $svcnum ) { - my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); - my $svcdb = $part_svc->getfield('svcdb'); - $cgi->param('link_field') =~ /^(\w+)$/; - my $link_field = $1; - my %search = ( $link_field => $cgi->param('link_value') ); - if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { - $search{$1} = $cgi->param('link_value2'); - } - - my @svc_x = ( sort { ($a->cust_svc->pkgnum > 0) <=> ($b->cust_svc->pkgnum > 0) - or ($b->cust_svc->svcpart == $svcpart) - <=> ($a->cust_svc->svcpart == $svcpart) - } - qsearch( $svcdb, \%search ) - ); - - if ( $DEBUG ) { - warn scalar(@svc_x). " candidate accounts found for linking ". - "(svcpart $svcpart):\n"; - foreach my $svc_x ( @svc_x ) { - warn " ". $svc_x->email. - " (svcnum ". $svc_x->svcnum. ",". - " pkgnum ". $svc_x->cust_svc->pkgnum. ",". - " svcpart ". $svc_x->cust_svc->svcpart. ")\n"; - } - } - - my $svc_x = $svc_x[0]; - - errorpage("$link_field not found!") unless $svc_x; - - $svcnum = $svc_x->svcnum; - -} - -my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -die "svcnum not found!" unless $old; -my $conf = new FS::Conf; -my($error, $new); -if ( $old->pkgnum && ! $conf->exists('legacy_link-steal') ) { - $error = "svcnum $svcnum already linked to package ". $old->pkgnum; -} else { - $new = new FS::cust_svc { $old->hash }; - $new->pkgnum($pkgnum); - $new->svcpart($svcpart); - - $error = $new->replace($old); -} - -</%init> diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi deleted file mode 100644 index 68ae49c60..000000000 --- a/httemplate/misc/process/meta-import.cgi +++ /dev/null @@ -1,190 +0,0 @@ -<% include("/elements/header.html",'Map tables') %> - -<SCRIPT> -var gSafeOnload = new Array(); -var gSafeOnsubmit = new Array(); -window.onload = SafeOnload; -function SafeAddOnLoad(f) { - gSafeOnload[gSafeOnload.length] = f; -} -function SafeOnload() { - for (var i=0;i<gSafeOnload.length;i++) - gSafeOnload[i](); -} -function SafeAddOnSubmit(f) { - gSafeOnsubmit[gSafeOnsubmit.length] = f; -} -function SafeOnsubmit() { - for (var i=0;i<gSafeOnsubmit.length;i++) - gSafeOnsubmit[i](); -} -</SCRIPT> - -<FORM NAME="OneTrueForm" METHOD="POST" ACTION="meta-import.cgi"> -% -% #use DBIx::DBSchema; -% my $schema = new_native DBIx::DBSchema -% map { $cgi->param($_) } qw( data_source username password ); -% foreach my $field (qw( data_source username password )) { - - <INPUT TYPE="hidden" NAME=<% $field %> VALUE="<% $cgi->param($field) %>"> -% } -% -% my %schema; -% use Tie::DxHash; -% tie %schema, 'Tie::DxHash'; -% if ( $cgi->param('schema') ) { -% my $schema_string = $cgi->param('schema'); -% - <INPUT TYPE="hidden" NAME="schema" VALUE="<%$schema_string%>"> -% -% %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ -% or die "guru meditation #420: $_"; -% ( $1 => $2 ); -% } -% split( /\n/, $schema_string ); -% } -% -% #first page -% unless ( $cgi->param('magic') ) { - - - <INPUT TYPE="hidden" NAME="magic" VALUE="process"> - <% hashmaker('schema', [ $schema->tables ], - [ grep !/^h_/, dbdef->tables ], ) %> - <br><INPUT TYPE="submit" VALUE="done"> -% -% -% #second page -% } elsif ( $cgi->param('magic') eq 'process' ) { - - - <INPUT TYPE="hidden" NAME="magic" VALUE="process2"> -% -% -% my %unique; -% foreach my $table ( keys %schema ) { -% -% my @from_columns = $schema->table($table)->columns; -% my @fs_columns = dbdef->table($schema{$table})->columns; -% -% - - <% hashmaker( $table.'__'.$unique{$table}++, - \@from_columns => \@fs_columns, - $table => $schema{$table}, ) %> - <br><hr><br> -% -% -% } -% -% - - <br><INPUT TYPE="submit" VALUE="done"> -% -% -% #third (results) -% } elsif ( $cgi->param('magic') eq 'process2' ) { -% -% print "<pre>\n"; -% -% my %unique; -% foreach my $table ( keys %schema ) { -% ( my $spaces = $table ) =~ s/./ /g; -% print "'$table' => { 'table' => '$schema{$table}',\n". -% #(length($table) x ' '). " 'map' => {\n"; -% "$spaces 'map' => {\n"; -% my %map = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ -% or die "guru meditation #420: $_"; -% ( $1 => $2 ); -% } -% split( /\n/, $cgi->param($table.'__'.$unique{$table}++) ); -% foreach ( keys %map ) { -% print "$spaces '$_' => '$map{$_}',\n"; -% } -% print "$spaces },\n"; -% print "$spaces },\n"; -% -% } -% print "\n</pre>"; -% -% } else { -% warn "unrecognized magic: ". $cgi->param('magic'); -% } -% -% - -</FORM> -</BODY> -</HTML> -% -% #hashmaker widget -% sub hashmaker { -% my($name, $from, $to, $labelfrom, $labelto) = @_; -% my $fromsize = scalar(@$from); -% my $tosize = scalar(@$to); -% "<TABLE><TR><TH>$labelfrom</TH><TH>$labelto</TH></TR><TR><TD>". -% qq!<SELECT NAME="${name}_from" SIZE=$fromsize>\n!. -% join("\n", map { qq!<OPTION VALUE="$_">$_</OPTION>! } sort { $a cmp $b } @$from ). -% "</SELECT>\n<BR>". -% qq!<INPUT TYPE="button" VALUE="refill" onClick="repack_${name}_from()">!. -% '</TD><TD>'. -% qq!<SELECT NAME="${name}_to" SIZE=$tosize>\n!. -% join("\n", map { qq!<OPTION VALUE="$_">$_</OPTION>! } sort { $a cmp $b } @$to ). -% "</SELECT>\n<BR>". -% qq!<INPUT TYPE="button" VALUE="refill" onClick="repack_${name}_to()">!. -% '</TD></TR>'. -% '<TR><TD COLSPAN=2>'. -% qq!<INPUT TYPE="button" VALUE="map" onClick="toke_$name(this.form)">!. -% '</TD></TR><TR><TD COLSPAN=2>'. -% qq!<TEXTAREA NAME="$name" COLS=80 ROWS=8></TEXTAREA>!. -% '</TD></TR></TABLE>'. -% "<script> -% function toke_$name() { -% fromObject = document.OneTrueForm.${name}_from; -% for (var i=fromObject.options.length-1;i>-1;i--) { -% if (fromObject.options[i].selected) -% fromname = deleteOption_$name(fromObject,i); -% } -% toObject = document.OneTrueForm.${name}_to; -% for (var i=toObject.options.length-1;i>-1;i--) { -% if (toObject.options[i].selected) -% toname = deleteOption_$name(toObject,i); -% } -% document.OneTrueForm.$name.value = document.OneTrueForm.$name.value + fromname + ' => ' + toname + '\\n'; -% } -% function deleteOption_$name(object,index) { -% value = object.options[index].value; -% object.options[index] = null; -% return value; -% } -% function repack_${name}_from() { -% var object = document.OneTrueForm.${name}_from; -% object.options.length = 0; -% ". join("\n", -% map { "addOption_$name(object, '$_');\n" } -% ( sort { $a cmp $b } @$from ) ). " -% } -% function repack_${name}_to() { -% var object = document.OneTrueForm.${name}_to; -% object.options.length = 0; -% ". join("\n", -% map { "addOption_$name(object, '$_');\n" } -% ( sort { $a cmp $b } @$to ) ). " -% } -% function addOption_$name(object,value) { -% var length = object.length; -% object.options[length] = new Option(value, value, false, false); -% } -% </script>". -% ''; -% } -% -% -<%init> - -#there's no ACL for this... haven't used in ages -#make XSS-safe if this is used for more than just admins to import data.... -die 'meta-import not enabled; remove this if you want to use it'; - -</%init> diff --git a/httemplate/misc/process/part_device-import.html b/httemplate/misc/process/part_device-import.html deleted file mode 100644 index eac111a40..000000000 --- a/httemplate/misc/process/part_device-import.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::part_device::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/pay_batch-approve.cgi b/httemplate/misc/process/pay_batch-approve.cgi deleted file mode 100644 index f857e2318..000000000 --- a/httemplate/misc/process/pay_batch-approve.cgi +++ /dev/null @@ -1,16 +0,0 @@ -% if ( $error ) { -% $cgi->param('error', $error); -% } -<% $cgi->redirect(popurl(3)."search/cust_pay_batch.cgi?dcln=1;batchnum=$batchnum") %> -<%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Process batches'); - -my $batchnum = $cgi->param('batchnum'); -# make a record in the paybatch of who did this -my $paybatch = 'manual-'.$FS::CurrentUser::CurrentUser->username. - '-' . time2str('%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); -my $pay_batch = qsearchs('pay_batch', { 'batchnum' => $batchnum }) - or die "batchnum '$batchnum' not found"; -my $error = $pay_batch->manual_approve('paybatch' => $paybatch); -</%init> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi deleted file mode 100644 index c1c9071f9..000000000 --- a/httemplate/misc/process/payment.cgi +++ /dev/null @@ -1,214 +0,0 @@ -% if ( $cgi->param('batch') ) { - - <% include( '/elements/header.html', ucfirst($type{$payby}). ' processing successful', - include('/elements/menubar.html'), - - ) - %> - - <% include( '/elements/small_custview.html', $cust_main, '', '', popurl(3). "view/cust_main.cgi" ) %> - - <% include('/elements/footer.html') %> - -% } else { -<% $cgi->redirect(popurl(3). "view/cust_pay.html?paynum=$paynum" ) %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Process payment'); - -#some false laziness w/MyAccount::process_payment - -$cgi->param('custnum') =~ /^(\d+)$/ - or die "illegal custnum ". $cgi->param('custnum'); -my $custnum = $1; - -my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); -die "unknown custnum $custnum" unless $cust_main; - -$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/ - or errorpage("illegal amount ". $cgi->param('amount')); -my $amount = $1; -errorpage("amount <= 0") unless $amount > 0; - -if ( $cgi->param('fee') =~ /^\s*(\d*(\.\d\d)?)\s*$/ ) { - my $fee = $1; - $amount = sprintf('%.2f', $amount + $fee); -} - -$cgi->param('year') =~ /^(\d+)$/ - or errorpage("illegal year ". $cgi->param('year')); -my $year = $1; - -$cgi->param('month') =~ /^(\d+)$/ - or errorpage("illegal month ". $cgi->param('month')); -my $month = $1; - -$cgi->param('payby') =~ /^(CARD|CHEK)$/ - or errorpage("illegal payby ". $cgi->param('payby')); -my $payby = $1; -my %payby2fields = ( - 'CARD' => [ qw( address1 address2 city county state zip country ) ], - 'CHEK' => [ qw( ss paytype paystate stateid stateid_state ) ], -); -my %type = ( 'CARD' => 'credit card', - 'CHEK' => 'electronic check (ACH)', - ); - -$cgi->param('payname') =~ /^([\w \,\.\-\']+)$/ - or errorpage(gettext('illegal_name'). " payname: ". $cgi->param('payname')); -my $payname = $1; - -$cgi->param('payunique') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/ - or errorpage(gettext('illegal_text'). " payunique: ". $cgi->param('payunique')); -my $payunique = $1; - -$cgi->param('balance') =~ /^\s*(\-?\s*\d*(\.\d\d)?)\s*$/ - or errorpage("illegal balance"); -my $balance = $1; - -my $payinfo; -my $paycvv = ''; -if ( $payby eq 'CHEK' ) { - - if ($cgi->param('payinfo1') =~ /xx/i || $cgi->param('payinfo2') =~ /xx/i ) { - $payinfo = $cust_main->payinfo; - } else { - $cgi->param('payinfo1') =~ /^(\d+)$/ - or errorpage("illegal account number ". $cgi->param('payinfo1')); - my $payinfo1 = $1; - $cgi->param('payinfo2') =~ /^(\d+)$/ - or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2')); - my $payinfo2 = $1; - $payinfo = $payinfo1. '@'. $payinfo2; - } - -} elsif ( $payby eq 'CARD' ) { - - $payinfo = $cgi->param('payinfo'); - if ($payinfo eq $cust_main->paymask) { - $payinfo = $cust_main->payinfo; - } - $payinfo =~ s/\D//g; - $payinfo =~ /^(\d{13,16})$/ - or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo; - $payinfo = $1; - validate($payinfo) - or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo; - - errorpage(gettext('unknown_card_type')) - if $payinfo !~ /^99\d{14}$/ #token - && cardtype($payinfo) eq "Unknown"; - - if ( defined $cust_main->dbdef_table->column('paycvv') ) { - if ( length($cgi->param('paycvv') ) ) { - if ( cardtype($payinfo) eq 'American Express card' ) { - $cgi->param('paycvv') =~ /^(\d{4})$/ - or errorpage("CVV2 (CID) for American Express cards is four digits."); - $paycvv = $1; - } else { - $cgi->param('paycvv') =~ /^(\d{3})$/ - or errorpage("CVV2 (CVC2/CID) is three digits."); - $paycvv = $1; - } - } - } - -} else { - die "unknown payby $payby"; -} - -$cgi->param('discount_term') =~ /^\d*$/ - or errorpage("illegal discount_term"); -my $discount_term = $1; - -my $error = ''; -my $paynum = ''; -if ( $cgi->param('batch') ) { - - $error = 'Prepayment discounts not supported with batched payments' - if $discount_term; - - $error ||= $cust_main->batch_card( - 'payby' => $payby, - 'amount' => $amount, - 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", - 'payname' => $payname, - map { $_ => $cgi->param($_) } - @{$payby2fields{$payby}} - ); - errorpage($error) if $error; - -} else { - - $error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount, - 'quiet' => 1, - 'manual' => 1, - 'balance' => $balance, - 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", - 'payname' => $payname, - 'payunique' => $payunique, - 'paycvv' => $paycvv, - 'paynum_ref' => \$paynum, - 'discount_term' => $discount_term, - map { $_ => $cgi->param($_) } @{$payby2fields{$payby}} - ); - errorpage($error) if $error; - - #no error, so order the fee package if applicable... - if ( $cgi->param('fee_pkgpart') =~ /^(\d+)$/ ) { - - my $cust_pkg = new FS::cust_pkg { 'pkgpart' => $1 }; - - my $error = $cust_main->order_pkg( 'cust_pkg' => $cust_pkg ); - errorpage("payment processed successfully, but error ordering fee: $error") - if $error; - - #and generate an invoice for it now too - $error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] ); - errorpage("payment processed and fee ordered sucessfully, but error billing fee: $error") - if $error; - - } - - $cust_main->apply_payments; - -} - -if ( $cgi->param('save') ) { - my $new = new FS::cust_main { $cust_main->hash }; - if ( $payby eq 'CARD' ) { - $new->set( 'payby' => ( $cgi->param('auto') ? 'CARD' : 'DCRD' ) ); - } elsif ( $payby eq 'CHEK' ) { - $new->set( 'payby' => ( $cgi->param('auto') ? 'CHEK' : 'DCHK' ) ); - } else { - die "unknown payby $payby"; - } - $new->set( 'payinfo' => $cust_main->card_token || $payinfo ); - $new->set( 'paydate' => "$year-$month-01" ); - $new->set( 'payname' => $payname ); - - #false laziness w/FS:;cust_main::realtime_bop - check both to make sure - # working correctly - my $conf = new FS::Conf; - if ( $payby eq 'CARD' && - grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) { - $new->set( 'paycvv' => $paycvv ); - } else { - $new->set( 'paycvv' => ''); - } - - $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}}; - - my $error = $new->replace($cust_main); - errorpage("payment processed successfully, but error saving info: $error") - if $error; - $cust_main = $new; -} - -#success! - -</%init> diff --git a/httemplate/misc/process/phone_avail-import.html b/httemplate/misc/process/phone_avail-import.html deleted file mode 100644 index f1a2f2493..000000000 --- a/httemplate/misc/process/phone_avail-import.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::phone_avail::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/rate-import.html b/httemplate/misc/process/rate-import.html deleted file mode 100644 index 2c641642c..000000000 --- a/httemplate/misc/process/rate-import.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::rate::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/rate_edit_excel.html b/httemplate/misc/process/rate_edit_excel.html deleted file mode 100644 index acd5f4995..000000000 --- a/httemplate/misc/process/rate_edit_excel.html +++ /dev/null @@ -1,10 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $server = new FS::UI::Web::JSRPC 'FS::rate_detail::process_edit_import', $cgi; - -</%init> - diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html deleted file mode 100755 index b56f8a282..000000000 --- a/httemplate/misc/process/recharge_svc.html +++ /dev/null @@ -1,92 +0,0 @@ -%if ($error) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ) %> -%} else { -<% header("Package recharged") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> -%} -<%init> - -my $conf = new FS::Conf; - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Recharge customer service'); - -#untaint svcnum -my $svcnum = $cgi->param('svcnum'); -$svcnum =~ /^(\d+)$/ || die "Illegal svcnum"; -$svcnum = $1; - -#untaint prepaid -my $prepaid = $cgi->param('prepaid'); -$prepaid =~ /^(\w*)$/; -$prepaid = $1; - -#untaint payby -my $payby = $cgi->param('payby'); -$payby =~ /^([A-Z]*)$/; -$payby = $1; - -my $error = ''; -my $svc_acct = qsearchs( 'svc_acct', {'svcnum'=>$svcnum} ); -$error = "Can't recharge service $svcnum. " unless $svc_acct; - -my $cust_main = $svc_acct->cust_svc->cust_pkg->cust_main; - -my $oldAutoCommit = $FS::UID::AutoCommit; -local $FS::UID::AutoCommit = 0; -my $dbh = dbh; - -unless ($error) { - - #should probably use payby.pm but whatever - if ($payby eq 'PREP') { - $error = $cust_main->recharge_prepay( $prepaid ); - } elsif ( $payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP)$/ ) { - my $part_pkg = $svc_acct->cust_svc->cust_pkg->part_pkg; - my $amount = $part_pkg->option('recharge_amount', 1); - my %rhash = map { $_ =~ /^recharge_(.*)$/; $1, $part_pkg->option($_) } - grep { $part_pkg->option($_, 1) } - qw ( recharge_seconds recharge_upbytes recharge_downbytes - recharge_totalbytes ); - - my $description = "Recharge"; - $description .= " $rhash{seconds}s" if $rhash{seconds}; - $description .= " $rhash{upbytes} up" if $rhash{upbytes}; - $description .= " $rhash{downbytes} down" if $rhash{downbytes}; - $description .= " $rhash{totalbytes} total" if $rhash{totalbytes}; - - $error = $cust_main->charge($amount, "Recharge " . $svc_acct->label, - $description, $part_pkg->taxclass); - - $error ||= "invalid $_" foreach grep { $rhash{$_} !~ /^\d*$/ } keys %rhash; - if ($part_pkg->option('recharge_reset', 1)) { - $error ||= $svc_acct->set_usage(\%rhash, 'null' => 1); - }else{ - $error ||= $svc_acct->recharge(\%rhash); - } - - my $old_balance = $cust_main->balance; - $error ||= $cust_main->bill; - $error ||= $cust_main->apply_payments_and_credits; - my $bill_error = $cust_main->collect('realtime' => 1) unless $error; - $error ||= "Failed to collect - $bill_error" - if $cust_main->balance > $old_balance && $cust_main->balance > 0 - && $payby ne 'BILL'; - - } else { - $error = "fatal error - unknown payby: $payby"; - } - -} - -if ($error) { - $dbh->rollback if $oldAutoCommit; -} else { - $dbh->commit or die $dbh->errstr if $oldAutoCommit; -} - -</%init> diff --git a/httemplate/misc/process/recharge_svc.new b/httemplate/misc/process/recharge_svc.new deleted file mode 100755 index bc916e5da..000000000 --- a/httemplate/misc/process/recharge_svc.new +++ /dev/null @@ -1,85 +0,0 @@ -% -% -%#untaint svcnum -%my $svcnum = $cgi->param('svcnum'); -%$svcnum =~ /^(\d+)$/ || die "Illegal svcnum"; -%$svcnum = $1; -% -%#untaint prepaid -%my $prepaid = $cgi->param('prepaid'); -%$prepaid =~ /^(\w*)$/; -%$prepaid = $1; - -%#untaint payby -%my $payby = $cgi->param('payby'); -%$payby =~ /^([A-Z]*)$/; -%$payby = $1; -% -%my $error = ''; -%my $svc_acct = qsearchs( 'svc_acct', {'svcnum'=>$svcnum} ); -%$error = "Can't recharge service $svcnum. " unless $svc_acct; -% -%my $cust_main = $svc_acct->cust_svc->cust_pkg->cust_main; -% -%my $oldAutoCommit = $FS::UID::AutoCommit; -%local $FS::UID::AutoCommit = 0; -%my $dbh = dbh; -% -% -%unless ($error) { -% -% my ($amount, $seconds, $up, $down, $total) = (0, 0, 0, 0, 0); -% #should probably use payby.pm but whatever -% if ($payby eq 'PREP') { -% $error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down, \$total) -% || $svc_acct->increment_seconds($seconds) -% || $svc_acct->increment_upbytes($up) -% || $svc_acct->increment_downbytes($down) -% || $svc_acct->increment_totalbytes($total) -% || $cust_main->insert_cust_pay_prepay( $amount, $prepaid ); -% } elsif ( $payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP)$/ ) { -% my $part_pkg = $svc_acct->cust_svc->cust_pkg->part_pkg; -% $amount = $part_pkg->option('recharge_amount', 1); -% my %rhash = map { $_ =~ /^recharge_(.*)$/; $1, $part_pkg->option($_, 1) } -% qw ( recharge_seconds recharge_upbytes recharge_downbytes -% recharge_totalbytes ); -% -% my $description = "Recharge"; -% $description .= " $rhash{seconds}s" if $rhash{seconds}; -% $description .= " $rhash{upbytes} up" if $rhash{upbytes}; -% $description .= " $rhash{downbytes} down" if $rhash{downbytes}; -% $description .= " $rhash{totalbytes} total" if $rhash{totalbytes}; -% -% $error = $cust_main->charge($amount, "Recharge " . $svc_acct->label, -% $description, $part_pkg->taxclass); -% -% $error ||= $svc_acct->recharge(\%rhash); -% -% my $old_balance = $cust_main->balance; -% $error ||= $cust_main->bill; -% $error ||= $cust_main->apply_payments_and_credits; -% my $bill_error = $cust_main->collect('realtime' => 1) unless $error; -% $error ||= "Failed to collect - $bill_error" -% if $cust_main->balance > $old_balance && $cust_main->balance > 0 -% && $payby ne 'BILL'; -% -% } else { -% $error = "fatal error - unknown payby: $payby"; -% } -%} -% -%if ($error) { -% $cgi->param('error', $error); -% $dbh->rollback if $oldAutoCommit; -% print $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ); -%} -%$dbh->commit or die $dbh->errstr if $oldAutoCommit; -% -<% header("Package recharged") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> -<%init> -my $conf = new FS::Conf; -</%init> diff --git a/httemplate/misc/process/tax-fetch_and_import.cgi b/httemplate/misc/process/tax-fetch_and_import.cgi deleted file mode 100644 index 553c7551a..000000000 --- a/httemplate/misc/process/tax-fetch_and_import.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_download_and_update', $cgi; - -</%init> diff --git a/httemplate/misc/process/tax-fetch_and_replace.cgi b/httemplate/misc/process/tax-fetch_and_replace.cgi deleted file mode 100644 index 1a9b62628..000000000 --- a/httemplate/misc/process/tax-fetch_and_replace.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_download_and_reload', $cgi; - -</%init> diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi deleted file mode 100644 index b9e9daad5..000000000 --- a/httemplate/misc/process/tax-import.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_batch_import', $cgi; - -</%init> diff --git a/httemplate/misc/process/tax-upgrade.cgi b/httemplate/misc/process/tax-upgrade.cgi deleted file mode 100644 index 8782282bd..000000000 --- a/httemplate/misc/process/tax-upgrade.cgi +++ /dev/null @@ -1,147 +0,0 @@ -% if ( $error ) { -% warn $error; -% errorpage($error); -% } else { - <% include('/elements/header.html','Import successful') %> - <% include('/elements/footer.html') %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $cfh = $cgi->upload('codefile'); -my $zfh = $cgi->upload('plus4file'); -my $tfh = $cgi->upload('txmatrix'); -my $dfh = $cgi->upload('detail'); -#warn $cgi; -#warn $fh; - -my $oldAutoCommit = $FS::UID::AutoCommit; -local $FS::UID::AutoCommit = 0; -my $dbh = dbh; - -my $error = ''; - -my ($cifh, $cdfh, $zifh, $zdfh, $tifh, $tdfh); - -if (defined($cfh)) { - $cifh = new File::Temp( TEMPLATE => 'code.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - $cdfh = new File::Temp( TEMPLATE => 'code.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - while(<$cfh>) { - my $fh = ''; - $fh = $cifh if $_ =~ /"I"\s*$/; - $fh = $cdfh if $_ =~ /"D"\s*$/; - die "bad input line: $_" unless $fh; - print $fh $_; - } - seek $cifh, 0, 0; - seek $cdfh, 0, 0; - -}else{ - $error = 'No code file'; -} - -$error ||= FS::tax_class::batch_import( { - filehandle => $cifh, - 'format' => scalar($cgi->param('format')), - } ); - -close $cifh if $cifh; - -if (defined($zfh)) { - $zifh = new File::Temp( TEMPLATE => 'plus4.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - $zdfh = new File::Temp( TEMPLATE => 'plus4.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - while(<$zfh>) { - my $fh = ''; - $fh = $zifh if $_ =~ /"I"\s*$/; - $fh = $zdfh if $_ =~ /"D"\s*$/; - die "bad input line: $_" unless $fh; - print $fh $_; - } - seek $zifh, 0, 0; - seek $zdfh, 0, 0; - -}else{ - $error = 'No plus4 file'; -} - -$error ||= FS::cust_tax_location::batch_import( { - filehandle => $zifh, - 'format' => scalar($cgi->param('format')), - } ); -close $zifh if $zifh; - -if (defined($tfh)) { - $tifh = new File::Temp( TEMPLATE => 'txmatrix.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - $tdfh = new File::Temp( TEMPLATE => 'txmatrix.insert.XXXXXXXX', - DIR => $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc, - ) or die "can't open temp file: $!\n"; - - while(<$tfh>) { - my $fh = ''; - $fh = $tifh if $_ =~ /"I"\s*$/; - $fh = $tdfh if $_ =~ /"D"\s*$/; - die "bad input line: $_" unless $fh; - print $fh $_; - } - seek $tifh, 0, 0; - seek $tdfh, 0, 0; - -}else{ - $error = 'No tax matrix file'; -} - -$error ||= FS::part_pkg_taxrate::batch_import( { - filehandle => $tifh, - 'format' => scalar($cgi->param('format')), - } ); -close $tifh if $tifh; - -$error ||= defined($dfh) - ? FS::tax_rate::batch_update( { - filehandle => $dfh, - 'format' => scalar($cgi->param('format')), - } ) - : 'No tax detail file'; - -$error ||= FS::part_pkg_taxrate::batch_import( { - filehandle => $tdfh, - 'format' => scalar($cgi->param('format')), - } ); -close $tdfh if $tdfh; - -$error ||= FS::cust_tax_location::batch_import( { - filehandle => $zdfh, - 'format' => scalar($cgi->param('format')), - } ); -close $zdfh if $zdfh; - -$error ||= FS::tax_class::batch_import( { - filehandle => $cdfh, - 'format' => scalar($cgi->param('format')), - } ); -close $cdfh if $cdfh; - -if ($error) { - $dbh->rollback or die $dbh->errstr if $oldAutoCommit; -}else{ - $dbh->commit or die $dbh->errstr if $oldAutoCommit; -} - -</%init> diff --git a/httemplate/misc/process/timeworked.html b/httemplate/misc/process/timeworked.html deleted file mode 100644 index 200a7511d..000000000 --- a/httemplate/misc/process/timeworked.html +++ /dev/null @@ -1,59 +0,0 @@ -% if ($error) { -<% $cgi->redirect(popurl(2). "timeworked.html?". $cgi->query_string) %> -% } else { -<% $cgi->redirect(popurl(3). "search/timeworked.html?begin=$begin;end=$end") %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Time queue'); - -my($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi); - -my @acct_rt_transaction; -foreach my $transaction ( - map { /^transactionid(\d+)$/; $1; } grep /^transactionid\d+$/, $cgi->param -) { - my $s = "multiplier${transaction}_"; - my %multipliers = map { /^$s(\d+)$/; $1 => $cgi->param("$s$1"); } - grep /^$s\d+$/, $cgi->param; - my $msum = 0; - foreach(values %multipliers) {$msum += $_}; - - my $seconds = $cgi->param("seconds$transaction"); - my %seconds = - map { $_ => sprintf("%.0f", $seconds * $multipliers{$_} / $msum) } - (keys %multipliers); - my $sum = 0; - my $count = 0; - foreach (values %seconds) { - $sum += $_; - $count++; - } - - #fudge in some time if we're close - if (abs($seconds-$sum) <= $count) { - my $adjustment = $seconds-$sum; - foreach (keys %seconds) { # explicitly choose one? - $seconds{$_} += $adjustment; - last; - } - } else { - die "unexpectedly cannot apportion time"; - } - - foreach my $customer ( grep {$seconds{$_}} keys %seconds ) { - push @acct_rt_transaction, new FS::acct_rt_transaction { - 'custnum' => $customer, - 'transaction_id' => $transaction, - 'seconds' => $seconds{$customer}, - 'support' => int( $seconds{$customer} * $msum ), - }; - } - -} - -my $error = FS::acct_rt_transaction->batch_insert(@acct_rt_transaction); -$cgi->param('error', $error) if $error; - -</%init> |