summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/process/payment.cgi9
-rw-r--r--httemplate/misc/sector_coverage-json.cgi40
2 files changed, 46 insertions, 3 deletions
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 852becb9d..74ca7348f 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -72,7 +72,7 @@ $cgi->param('discount_term') =~ /^(\d*)$/
or errorpage("illegal discount_term");
my $discount_term = $1;
-my( $payinfo, $paycvv, $month, $year, $payname );
+my( $cust_payby, $payinfo, $paycvv, $month, $year, $payname );
my $paymask = '';
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
@@ -80,10 +80,11 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
# use stored cust_payby info
##
- my $cust_payby = qsearchs('cust_payby', { custnum => $custnum,
+ $cust_payby = qsearchs('cust_payby', { custnum => $custnum,
custpaybynum => $custpaybynum, } )
or die "unknown custpaybynum $custpaybynum";
+ # not needed for realtime_bop, but still needed for batch_card
$payinfo = $cust_payby->payinfo;
$paymask = $cust_payby->paymask;
$paycvv = $cust_payby->paycvv; # pass it if we got it, running a transaction will clear it
@@ -164,7 +165,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
die "unknown payby $payby";
}
- # save first, for proper tokenization later
+ # save first, for proper tokenization
if ( $cgi->param('save') ) {
my %saveopt;
@@ -181,6 +182,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
}
my $error = $cust_main->save_cust_payby(
+ 'saved_cust_payby' => \$cust_payby,
'payment_payby' => $payby,
'auto' => scalar($cgi->param('auto')),
'weight' => scalar($cgi->param('weight')),
@@ -220,6 +222,7 @@ if ( $cgi->param('batch') ) {
} else {
$error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount,
+ 'cust_payby' => $cust_payby, # if defined, will override passed payinfo, etc
'quiet' => 1,
'manual' => 1,
'balance' => $balance,
diff --git a/httemplate/misc/sector_coverage-json.cgi b/httemplate/misc/sector_coverage-json.cgi
new file mode 100644
index 000000000..37595f5e2
--- /dev/null
+++ b/httemplate/misc/sector_coverage-json.cgi
@@ -0,0 +1,40 @@
+<% encode_json($collection) %>
+<%init>
+my @sectors;
+if ( my $towernum = $cgi->param('towernum') ) {
+ @sectors = qsearch('tower_sector', { towernum => $towernum });
+} elsif ( my $sectornum = $cgi->param('sectornum') ) {
+ @sectors = FS::tower_sector->by_key($sectornum);
+} else {
+ die "towernum or sectornum required";
+}
+my @features;
+my $collection = {
+ type => 'FeatureCollection',
+ features => \@features,
+};
+foreach my $sector (@sectors) {
+ my $sectornum = $sector->sectornum;
+ my $low = $sector->db_low;
+ my $high = $sector->db_high;
+ my $color = '#' . ($sector->tower->color || 'ffffff');
+ foreach my $coverage ( $sector->sector_coverage ) {
+ #note $coverage->geometry is already JSON
+ my $level = $coverage->db_loss;
+ push @features, {
+ type => 'Feature',
+ id => "sector/$sectornum/$level",
+ properties => {
+ level => $level,
+ low => ($level == $low ? 1 : 0),
+ high => ($level == $high ? 1 : 0),
+ style => {
+ strokeColor => $color,
+ fillColor => $color,
+ },
+ },
+ geometry => decode_json($coverage->geometry),
+ };
+ }
+}
+</%init>