summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
committerIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
commit2b2dd969f3c18751afc583ad1e836ab8e6f73b5d (patch)
tree72ad19092f9d3a5118add9a55067b8a97c168f46 /httemplate/misc/process
parentd31d59c63c8f4dfd52ca19a02ffcf32fcf49f497 (diff)
parentcd468ecb9a321ca96254b7204f6dc193b11cd903 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r--httemplate/misc/process/deploy_zone-block_lookup.cgi13
-rw-r--r--httemplate/misc/process/payment.cgi82
-rw-r--r--httemplate/misc/process/send-report.html7
-rw-r--r--httemplate/misc/process/template_image-delete.cgi28
-rw-r--r--httemplate/misc/process/template_image-upload.cgi26
-rwxr-xr-xhttemplate/misc/process/void-cust_bill.html2
6 files changed, 119 insertions, 39 deletions
diff --git a/httemplate/misc/process/deploy_zone-block_lookup.cgi b/httemplate/misc/process/deploy_zone-block_lookup.cgi
new file mode 100644
index 000000000..8f4eac7e9
--- /dev/null
+++ b/httemplate/misc/process/deploy_zone-block_lookup.cgi
@@ -0,0 +1,13 @@
+<% $server->process %>
+<%init>
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied"
+ unless $curuser->access_right([
+ 'Edit FCC report configuration',
+ 'Edit FCC report configuration for all agents',
+ ]);
+
+my $server = FS::UI::Web::JSRPC->new(
+ 'FS::deploy_zone::process_block_lookup', $cgi
+);
+</%init>
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 27b818660..efba9ed9a 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -74,11 +74,13 @@ $cgi->param('balance') =~ /^\s*(\-?\s*\d*(\.\d\d)?)\s*$/
my $balance = $1;
my $payinfo;
+my $paymask; # override only used by loaded cust payinfo, only implemented for realtime processing
my $paycvv = '';
if ( $payby eq 'CHEK' ) {
if ($cgi->param('payinfo1') =~ /xx/i || $cgi->param('payinfo2') =~ /xx/i ) {
$payinfo = $cust_main->payinfo;
+ $paymask = $cust_main->paymask;
} else {
$cgi->param('payinfo1') =~ /^(\d+)$/
or errorpage("Illegal account number ". $cgi->param('payinfo1'));
@@ -99,6 +101,7 @@ if ( $payby eq 'CHEK' ) {
$payinfo = $cgi->param('payinfo');
if ($payinfo eq $cust_main->paymask) {
$payinfo = $cust_main->payinfo;
+ $paymask = $cust_main->paymask;
}
$payinfo =~ s/\D//g;
$payinfo =~ /^(\d{13,16}|\d{8,9})$/
@@ -135,6 +138,46 @@ $cgi->param('discount_term') =~ /^(\d*)$/
or errorpage("illegal discount_term");
my $discount_term = $1;
+# save first, for proper tokenization later
+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->payinfo($payinfo); # sets default paymask, but not if it's already tokenized
+ $new->paymask($paymask) if $paymask; # in case it's been tokenized, override with loaded paymask
+ $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
+ if ( $payby eq 'CARD' &&
+ grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
+ $new->set( 'paycvv' => $paycvv );
+ } else {
+ $new->set( 'paycvv' => '');
+ }
+
+ if ( $payby eq 'CARD' ) {
+ my $bill_location = FS::cust_location->new;
+ $bill_location->set( $_ => $cgi->param($_) )
+ foreach @{$payby2fields{$payby}};
+ $new->set('bill_location' => $bill_location);
+ # will do nothing if the fields are all unchanged
+ } else {
+ $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}};
+ }
+
+ my $error = $new->replace($cust_main);
+ errorpage("error saving info, payment not processed: $error")
+ if $error;
+ $cust_main = $new;
+}
+
my $error = '';
my $paynum = '';
if ( $cgi->param('batch') ) {
@@ -160,6 +203,7 @@ if ( $cgi->param('batch') ) {
'manual' => 1,
'balance' => $balance,
'payinfo' => $payinfo,
+ 'paymask' => $paymask,
'paydate' => "$year-$month-01",
'payname' => $payname,
'payunique' => $payunique,
@@ -190,44 +234,6 @@ if ( $cgi->param('batch') ) {
}
-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
- if ( $payby eq 'CARD' &&
- grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
- $new->set( 'paycvv' => $paycvv );
- } else {
- $new->set( 'paycvv' => '');
- }
-
- if ( $payby eq 'CARD' ) {
- my $bill_location = FS::cust_location->new;
- $bill_location->set( $_ => $cgi->param($_) )
- foreach @{$payby2fields{$payby}};
- $new->set('bill_location' => $bill_location);
- # will do nothing if the fields are all unchanged
- } else {
- $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/send-report.html b/httemplate/misc/process/send-report.html
new file mode 100644
index 000000000..3bceebc0c
--- /dev/null
+++ b/httemplate/misc/process/send-report.html
@@ -0,0 +1,7 @@
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Send reports to customers');
+
+my $server = FS::UI::Web::JSRPC->new('FS::report_batch::process_send_report', $cgi);
+</%init>
+<% $server->process %>
diff --git a/httemplate/misc/process/template_image-delete.cgi b/httemplate/misc/process/template_image-delete.cgi
new file mode 100644
index 000000000..58c3f2c68
--- /dev/null
+++ b/httemplate/misc/process/template_image-delete.cgi
@@ -0,0 +1,28 @@
+<% $server->process %>
+
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+# make sure user can generally edit
+die "access denied"
+ unless $curuser->access_right([ 'Edit templates', 'Edit global templates' ]);
+
+# make sure user can edit this particular image
+my %arg = $cgi->param('arg');
+my $imgnum = $arg{'imgnum'};
+die "bad imgnum" unless $imgnum =~ /^\d+$/;
+die "access denied" unless qsearchs({
+ 'table' => 'template_image',
+ 'select' => 'imgnum',
+ 'hashref' => { 'imgnum' => $imgnum },
+ 'extra_sql' => ' AND ' .
+ $curuser->agentnums_sql(
+ 'null_right' => ['Edit global templates']
+ ),
+ });
+
+my $server =
+ new FS::UI::Web::JSRPC 'FS::template_image::process_image_delete', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/template_image-upload.cgi b/httemplate/misc/process/template_image-upload.cgi
new file mode 100644
index 000000000..c3c905981
--- /dev/null
+++ b/httemplate/misc/process/template_image-upload.cgi
@@ -0,0 +1,26 @@
+<% $server->process %>
+
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right([ 'Edit templates', 'Edit global templates' ]);
+
+my %arg = $cgi->param('arg');
+my $agentnum = $arg{'agentnum'};
+
+if (!$agentnum) {
+ die "access denied"
+ unless $curuser->access_right([ 'Edit global templates' ]);
+} else {
+ die "bad agentnum"
+ unless $agentnum =~ /^\d+$/;
+ die "access denied"
+ unless $curuser->agentnum($agentnum);
+}
+
+my $server =
+ new FS::UI::Web::JSRPC 'FS::template_image::process_image_upload', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html
index accee27fd..7773b0ba9 100755
--- a/httemplate/misc/process/void-cust_bill.html
+++ b/httemplate/misc/process/void-cust_bill.html
@@ -21,6 +21,6 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
my $custnum = $cust_bill->custnum;
-my $error = $cust_bill->void( $cgi->param('reason') );
+my $error = $cust_bill->void( scalar($cgi->param('reason')) );
</%init>