summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/process')
-rwxr-xr-xhttemplate/misc/process/link.cgi10
-rw-r--r--httemplate/misc/process/part_device-import.html9
-rw-r--r--httemplate/misc/process/payment.cgi23
-rw-r--r--httemplate/misc/process/rate_edit_excel.html10
-rwxr-xr-xhttemplate/misc/process/recharge_svc.html103
-rw-r--r--httemplate/misc/process/tax-fetch_and_import.cgi9
-rw-r--r--httemplate/misc/process/tax-fetch_and_replace.cgi9
-rw-r--r--httemplate/misc/process/tax-import.cgi2
8 files changed, 119 insertions, 56 deletions
diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi
index df15dca..77546f3 100755
--- a/httemplate/misc/process/link.cgi
+++ b/httemplate/misc/process/link.cgi
@@ -1,14 +1,20 @@
%unless ($error) {
% #no errors, so let's view this customer.
% my $custnum = $new->cust_pkg->custnum;
-<% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_pkg$pkgnum" ) %>
+% 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 $FS::CurrentUser::CurrentUser->access_right('View/link unlinked services');
+ unless $curuser->access_right('View/link unlinked services');
my $DEBUG = 0;
diff --git a/httemplate/misc/process/part_device-import.html b/httemplate/misc/process/part_device-import.html
new file mode 100644
index 0000000..eac111a
--- /dev/null
+++ b/httemplate/misc/process/part_device-import.html
@@ -0,0 +1,9 @@
+<% $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/payment.cgi b/httemplate/misc/process/payment.cgi
index 2baca1e..1e9501d 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -32,6 +32,11 @@ $cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/
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;
@@ -44,7 +49,7 @@ $cgi->param('payby') =~ /^(CARD|CHEK)$/
or errorpage("illegal payby ". $cgi->param('payby'));
my $payby = $1;
my %payby2fields = (
- 'CARD' => [ qw( address1 address2 city state zip ) ],
+ 'CARD' => [ qw( address1 address2 city county state zip country ) ],
'CHEK' => [ qw( ss paytype paystate stateid stateid_state ) ],
);
my %type = ( 'CARD' => 'credit card',
@@ -143,6 +148,22 @@ if ( $cgi->param('batch') ) {
);
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;
}
diff --git a/httemplate/misc/process/rate_edit_excel.html b/httemplate/misc/process/rate_edit_excel.html
new file mode 100644
index 0000000..acd5f49
--- /dev/null
+++ b/httemplate/misc/process/rate_edit_excel.html
@@ -0,0 +1,10 @@
+<% $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
index 147b953..5f68bf1 100755
--- a/httemplate/misc/process/recharge_svc.html
+++ b/httemplate/misc/process/recharge_svc.html
@@ -1,62 +1,13 @@
-%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($_) }
-% 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);
-%
-% if ($part_pkg->option('recharge_reset', 1)) {
-% $error ||= $svc_acct->set_usage(\%rhash);
-% }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) {
% $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;
-%
+<% $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;
@@ -89,4 +40,52 @@ 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);
+
+ 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/tax-fetch_and_import.cgi b/httemplate/misc/process/tax-fetch_and_import.cgi
new file mode 100644
index 0000000..553c755
--- /dev/null
+++ b/httemplate/misc/process/tax-fetch_and_import.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::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
new file mode 100644
index 0000000..1a9b626
--- /dev/null
+++ b/httemplate/misc/process/tax-fetch_and_replace.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::tax_rate::process_download_and_reload', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi
index 016d4b6..f800dbd 100644
--- a/httemplate/misc/process/tax-import.cgi
+++ b/httemplate/misc/process/tax-import.cgi
@@ -2,7 +2,7 @@
<%init>
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices');
+ unless $FS::CurrentUser::CurrentUser->access_right('Import');
my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_batch_import', $cgi;