summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r--httemplate/edit/process/agent_payment_gateway.html25
-rw-r--r--httemplate/edit/process/bulk-cust_svc.cgi3
-rwxr-xr-xhttemplate/edit/process/cust_credit_bill.cgi5
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi40
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi13
-rwxr-xr-xhttemplate/edit/process/part_svc.cgi3
-rw-r--r--httemplate/edit/process/payment_gateway.html33
-rw-r--r--httemplate/edit/process/prepay_credit.cgi51
-rw-r--r--httemplate/edit/process/quick-charge.cgi27
-rwxr-xr-xhttemplate/edit/process/rate.cgi38
-rw-r--r--httemplate/edit/process/reg_code.cgi44
-rw-r--r--httemplate/edit/process/svc_broadband.cgi9
12 files changed, 67 insertions, 224 deletions
diff --git a/httemplate/edit/process/agent_payment_gateway.html b/httemplate/edit/process/agent_payment_gateway.html
deleted file mode 100644
index c306bfa3f..000000000
--- a/httemplate/edit/process/agent_payment_gateway.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<%
-
-$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum";
-my $agent = qsearchs('agent', { 'agentnum' => $1 } );
-die "agentnum $1 not found" unless $agent;
-
-#my $old
-
-my @new = map {
- my $cardtype = $_;
- new FS::agent_payment_gateway {
- ( map { $_ => scalar($cgi->param($_)) }
- fields('agent_payment_gateway')
- ),
- 'cardtype' => $cardtype,
- };
- }
- $cgi->param('cardtype');
-
-foreach my $new (@new) {
- my $error = $new->insert;
- die $error if $error;
-}
-
-%><%= $cgi->redirect(popurl(3). "browse/agent.cgi") %>
diff --git a/httemplate/edit/process/bulk-cust_svc.cgi b/httemplate/edit/process/bulk-cust_svc.cgi
deleted file mode 100644
index dd9d1dbd2..000000000
--- a/httemplate/edit/process/bulk-cust_svc.cgi
+++ /dev/null
@@ -1,3 +0,0 @@
-<%
- my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process_bulk_cust_svc', $cgi;
-%><%= $server->process %>
diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi
index 28f892f62..23e2e6ce5 100755
--- a/httemplate/edit/process/cust_credit_bill.cgi
+++ b/httemplate/edit/process/cust_credit_bill.cgi
@@ -14,12 +14,11 @@ my $custnum = $cust_main->custnum;
my $new;
if ($cgi->param('invnum') =~ /^Refund$/) {
$new = new FS::cust_refund ( {
- 'reason' => ( $cust_credit->reason || 'refund from credit' ),
+ 'reason' => $cust_credit->reason,
'refund' => $cgi->param('amount'),
'payby' => 'BILL',
#'_date' => $cgi->param('_date'),
- #'payinfo' => 'Cash',
- 'payinfo' => 'Refund',
+ 'payinfo' => 'Cash',
'crednum' => $crednum,
} );
} else {
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 09a42544c..a1d36986d 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -8,30 +8,23 @@ $cgi->param('tax','') unless defined $cgi->param('tax');
$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] );
-#my $payby = $cgi->param('payby');
-my $payby = $cgi->param('select'); # XXX key
-
-my %noauto = (
- 'CARD' => 'DCRD',
- 'CHEK' => 'DCHK',
-);
-$payby = $noauto{$payby}
- if ! $cgi->param('payauto') && exists $noauto{$payby};
-
-$cgi->param('payby', $payby);
-
+my $payby = $cgi->param('payby');
if ( $payby ) {
if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
$cgi->param('payinfo',
- $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') );
+ $cgi->param($payby. '_payinfo1'). '@'. $cgi->param($payby. '_payinfo2') );
+ } else {
+ $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) );
}
$cgi->param('paydate',
- $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) );
+ $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) );
+ $cgi->param('payname', $cgi->param( $payby. '_payname' ) );
+ $cgi->param('paycvv', $cgi->param( $payby. '_paycvv' ) )
+ if defined $cgi->param( $payby. '_paycvv' );
}
my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') );
push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST');
-push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX');
$cgi->param('invoicing_list', join(',', @invoicing_list) );
@@ -53,9 +46,6 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) {
);
}
-$new->setfield('paid', $cgi->param('paid') )
- if $cgi->param('paid');
-
#perhaps this stuff should go to cust_main.pm
my $cust_pkg = '';
my $svc_acct = '';
@@ -121,20 +111,7 @@ if ( $new->custnum eq '' ) {
tie my %hash, 'Tie::RefHash';
%hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg;
$error ||= $new->insert( \%hash, \@invoicing_list );
-
- my $conf = new FS::Conf;
- if ( $conf->exists('backend-realtime') && ! $error ) {
-
- my $berror = $new->bill;
- $new->apply_payments;
- $new->apply_credits;
- $berror ||= $new->collect;
- warn "Warning, error billing during backend-realtime: $berror" if $berror;
-
- }
-
} else { #create old record object
-
my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } );
$error ||= "Old record not found!" unless $old;
if ( defined dbdef->table('cust_main')->column('paycvv')
@@ -143,7 +120,6 @@ if ( $new->custnum eq '' ) {
$new->paycvv($old->paycvv);
}
$error ||= $new->replace($old, \@invoicing_list);
-
}
if ( $error ) {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 0d0a13491..2d6b34432 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -19,28 +19,22 @@ foreach (qw( setuptax recurtax disabled )) {
my $new = new FS::part_pkg ( {
map {
- $_ => scalar($cgi->param($_));
+ $_, scalar($cgi->param($_));
} fields('part_pkg')
} );
-my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) }
+my %pkg_svc = map { $_ => $cgi->param("pkg_svc$_") }
map { $_->svcpart }
qsearch('part_svc', {} );
my $error;
my $custnum = '';
-if ( $cgi->param('taxclass') eq '(select)' ) {
-
- $error = 'Must select a tax class';
-
-} elsif ( $pkgpart ) {
-
+if ( $pkgpart ) {
$error = $new->replace( $old,
pkg_svc => \%pkg_svc,
primary_svc => scalar($cgi->param('pkg_svc_primary')),
);
} else {
-
$error = $new->insert( pkg_svc => \%pkg_svc,
primary_svc => scalar($cgi->param('pkg_svc_primary')),
cust_pkg => $cgi->param('pkgnum'),
@@ -48,7 +42,6 @@ if ( $cgi->param('taxclass') eq '(select)' ) {
);
$pkgpart = $new->pkgpart;
}
-
if ( $error ) {
$cgi->param('error', $error );
print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi
deleted file mode 100755
index b92b62739..000000000
--- a/httemplate/edit/process/part_svc.cgi
+++ /dev/null
@@ -1,3 +0,0 @@
-<%
- my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi;
-%><%= $server->process %>
diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html
deleted file mode 100644
index b9e4d47da..000000000
--- a/httemplate/edit/process/payment_gateway.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<%
-
-my $gatewaynum = $cgi->param('gatewaynum');
-
-my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum;
-
-my $new = new FS::payment_gateway ( {
- map {
- $_, scalar($cgi->param($_));
- } fields('payment_gateway')
-} );
-
-my @options = split(/\r?\n/, $cgi->param('gateway_options') );
-pop @options
- if scalar(@options) % 2 && $options[-1] =~ /^\s*$/;
-my %options = @options;
-
-my $error;
-if ( $gatewaynum ) {
- $error=$new->replace($old);
-} else {
- $error=$new->insert(\%options);
- $gatewaynum=$new->getfield('gatewaynum');
-}
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string );
-} else {
- print $cgi->redirect(popurl(3). "browse/payment_gateway.html");
-}
-
-%>
diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi
deleted file mode 100644
index 25ecbe079..000000000
--- a/httemplate/edit/process/prepay_credit.cgi
+++ /dev/null
@@ -1,51 +0,0 @@
-<%
-my $hashref = {};
-
-my $agent = '';
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } );
-}
-
-my $error = '';
-
-my $num = 0;
-if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
- $num = $1;
-} else {
- $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
-}
-
-$hashref->{amount} = $cgi->param('amount');
-$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
-
-$error ||= FS::prepay_credit::generate( $num,
- scalar($cgi->param('type')),
- $hashref
- );
-
-unless ( ref($error) ) {
- $cgi->param('error', $error );
-%><%=
- $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
-%><% } else { %>
-
-<%= header( "$num prepaid cards generated".
- ( $agent ? ' for '.$agent->agent : '' ),
- menubar( 'Main menu' => popurl(3) )
- )
-%>
-
-<FONT SIZE="+1">
-<% foreach my $card ( @$error ) { %>
- <code><%= $card %></code>
- -
- <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
- <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
- <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
- <br>
-<% } %>
-
-</FONT>
-
-</BODY></HTML>
-<% } %>
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi
index 928e3daad..477f58508 100644
--- a/httemplate/edit/process/quick-charge.cgi
+++ b/httemplate/edit/process/quick-charge.cgi
@@ -9,24 +9,15 @@ $cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/
or die 'illegal amount '. $cgi->param('amount');
my $amount = $1;
-my( $error, $cust_main);
-if ( $cgi->param('taxclass') eq '(select)' ) {
-
-
- $error = 'Must select a tax class';
-} else {
-
- my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
- or die "unknown custnum $custnum";
-
- $error = $cust_main->charge(
- $amount,
- $cgi->param('pkg'),
- '$'. sprintf("%.2f",$amount),
- $cgi->param('taxclass')
- );
-
-}
+my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or die "unknown custnum $custnum";
+
+my $error = $cust_main->charge(
+ $amount,
+ $cgi->param('pkg'),
+ '$'. sprintf("%.2f",$amount),
+ $cgi->param('taxclass')
+);
if ($error) {
%>
diff --git a/httemplate/edit/process/rate.cgi b/httemplate/edit/process/rate.cgi
index 87c082d64..04ff5f8f7 100755
--- a/httemplate/edit/process/rate.cgi
+++ b/httemplate/edit/process/rate.cgi
@@ -1,3 +1,37 @@
<%
- my $server = new FS::UI::Web::JSRPC 'FS::rate::process', $cgi;
-%><%= $server->process %>
+
+my $ratenum = $cgi->param('ratenum');
+
+my $old = qsearchs('rate', { 'ratenum' => $ratenum } ) if $ratenum;
+
+my @rate_detail = map {
+ my $regionnum = $_->regionnum;
+ new FS::rate_detail {
+ 'dest_regionnum' => $regionnum,
+ map { $_ => $cgi->param("$_$regionnum") }
+ qw( min_included min_charge sec_granularity )
+ };
+} qsearch('rate_region', {} );
+
+my $new = new FS::rate ( {
+ map {
+ $_, scalar($cgi->param($_));
+ } fields('rate')
+} );
+
+my $error;
+if ( $ratenum ) {
+ $error = $new->replace($old, 'rate_detail' => \@rate_detail );
+} else {
+ $error = $new->insert( 'rate_detail' => \@rate_detail );
+ $ratenum = $new->getfield('ratenum');
+}
+
+if ( $error ) {
+ $cgi->param('error', $error);
+ print $cgi->redirect(popurl(2). "rate.cgi?". $cgi->query_string );
+} else {
+ print $cgi->redirect(popurl(3). "browse/rate.cgi");
+}
+
+%>
diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi
deleted file mode 100644
index 4658257f3..000000000
--- a/httemplate/edit/process/reg_code.cgi
+++ /dev/null
@@ -1,44 +0,0 @@
-<%
-
-$cgi->param('agentnum') =~ /^(\d+)$/
- or eidiot 'illegal agentnum '. $cgi->param('agentnum');
-my $agentnum = $1;
-my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
-
-my $error = '';
-
-my $num = 0;
-if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
- $num = $1;
-} else {
- $error = 'Illegal number of codes: '. $cgi->param('num');
-}
-
-my @pkgparts =
- map { /^pkgpart(.*)$/; $1 }
- grep { $cgi->param($_) }
- grep { /^pkgpart/ }
- $cgi->param;
-
-$error ||= $agent->generate_reg_codes($num, \@pkgparts);
-
-unless ( ref($error) ) {
- $cgi->param('error'. $error );
-%><%=
- $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string )
-%><% } else { %>
-
-<%= header("$num registration codes generated for ". $agent->agent, menubar(
- 'Main menu' => popurl(3),
- 'View all agents' => popurl(3). 'browse/agent.cgi',
-) ) %>
-
-<PRE><FONT SIZE="+1">
-<% foreach my $code ( @$error ) { %>
- <%= $code %>
-<% } %>
-
-</FONT></PRE>
-
-</BODY></HTML>
-<% } %>
diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi
index a009ba218..4912a3a9f 100644
--- a/httemplate/edit/process/svc_broadband.cgi
+++ b/httemplate/edit/process/svc_broadband.cgi
@@ -1,5 +1,11 @@
<%
+# If it's stupid but it works, it's not stupid.
+# -- U.S. Army
+
+local $FS::UID::AutoCommit = 0;
+my $dbh = FS::UID::dbh;
+
$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
my $svcnum = $1;
@@ -25,11 +31,14 @@ if ( $svcnum ) {
$svcnum = $new->svcnum;
}
+
if ( $error ) {
$cgi->param('error', $error);
$cgi->param('ip_addr', $new->ip_addr);
+ $dbh->rollback;
print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string );
} else {
+ $dbh->commit or die $dbh->errstr;
print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum );
}