projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9dfb97b
)
RT# 34134 - updated select invoice to actually pay the invoice being selected not...
author
Christopher Burger
<burgerc@freeside.biz>
Wed, 8 Aug 2018 23:35:34 +0000
(19:35 -0400)
committer
Christopher Burger
<burgerc@freeside.biz>
Fri, 10 Aug 2018 10:38:44 +0000
(06:38 -0400)
FS/FS/cust_main/Billing_Batch.pm
patch
|
blob
|
history
FS/FS/cust_pay_batch.pm
patch
|
blob
|
history
httemplate/elements/tr-select-invoice.html
patch
|
blob
|
history
httemplate/elements/tr-select-payment_options.html
patch
|
blob
|
history
httemplate/misc/process/payment.cgi
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main/Billing_Batch.pm
b/FS/FS/cust_main/Billing_Batch.pm
index
35e2714
..
0774781
100644
(file)
--- a/
FS/FS/cust_main/Billing_Batch.pm
+++ b/
FS/FS/cust_main/Billing_Batch.pm
@@
-55,7
+55,8
@@
sub batch_card {
return;
}
return;
}
- my $invnum = delete $options{invnum};
+ #my $invnum = delete $options{invnum};
+ my $invnum = $options{invnum};
#pay fields should all come from either cust_payby or options, not both
# in theory, could just pass payby, and use it to select cust_payby,
#pay fields should all come from either cust_payby or options, not both
# in theory, could just pass payby, and use it to select cust_payby,
diff --git
a/FS/FS/cust_pay_batch.pm
b/FS/FS/cust_pay_batch.pm
index
d29c6d0
..
614c117
100644
(file)
--- a/
FS/FS/cust_pay_batch.pm
+++ b/
FS/FS/cust_pay_batch.pm
@@
-302,6
+302,7
@@
sub approve {
'_date' => $new->_date,
'usernum' => $new->usernum,
'batchnum' => $new->batchnum,
'_date' => $new->_date,
'usernum' => $new->usernum,
'batchnum' => $new->batchnum,
+ 'invnum' => $old->invnum,
'gatewaynum' => $opt{'gatewaynum'},
'processor' => $opt{'processor'},
'auth' => $opt{'auth'},
'gatewaynum' => $opt{'gatewaynum'},
'processor' => $opt{'processor'},
'auth' => $opt{'auth'},
diff --git
a/httemplate/elements/tr-select-invoice.html
b/httemplate/elements/tr-select-invoice.html
index
434042c
..
d35813f
100644
(file)
--- a/
httemplate/elements/tr-select-invoice.html
+++ b/
httemplate/elements/tr-select-invoice.html
@@
-26,10
+26,14
@@
Example:
<OPTION VALUE="select">Select an invoice to pay</OPTION>
% foreach my $record (@invoices) {
% my $read_date = time2str("%b %o, %Y", $record->_date);
<OPTION VALUE="select">Select an invoice to pay</OPTION>
% foreach my $record (@invoices) {
% my $read_date = time2str("%b %o, %Y", $record->_date);
- <OPTION VALUE="<% $record->charged %>"><% $record->invnum %> (<% $read_date %>) - <% $record->charged %></OPTION>
+% $hidden .= '<INPUT TYPE="hidden" ID="inv'.$record->invnum.'" NAME="inv'.$record->invnum.'" VALUE="'.$record->owed.'">';
+ <OPTION VALUE="<% $record->invnum %>"><% $record->invnum %> (<% $read_date %>) - <% $record->owed %></OPTION>
% }
% }
- </SELECT>
+ </SELECT>
+
+ <% $hidden %>
+
</TD>
</TR>
</TD>
</TR>
@@
-37,6
+41,7
@@
Example:
my %opt = @_;
my $status = $opt{'status'} ? $opt{'status'} : 'all';
my %opt = @_;
my $status = $opt{'status'} ? $opt{'status'} : 'all';
+my $hidden;
my @invoices;
if ($status eq "all") { @invoices = $opt{'cust_main'}->cust_bill; }
my @invoices;
if ($status eq "all") { @invoices = $opt{'cust_main'}->cust_bill; }
diff --git
a/httemplate/elements/tr-select-payment_options.html
b/httemplate/elements/tr-select-payment_options.html
index
35e6def
..
f86f3ed
100644
(file)
--- a/
httemplate/elements/tr-select-payment_options.html
+++ b/
httemplate/elements/tr-select-payment_options.html
@@
-131,11
+131,12
@@
Example:
function <% $opt{prefix} %>invoice_select_changed(what) {
var surcharge;
function <% $opt{prefix} %>invoice_select_changed(what) {
var surcharge;
+ var invdue = document.getElementById("<% $opt{prefix} %>inv" + what.value);
if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_flatfee')) {
if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_flatfee')) {
- surcharge = (+
what
.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
+ surcharge = (+
invdue
.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
}
else { surcharge = 0; }
}
else { surcharge = 0; }
- var amount = +
what
.value + +surcharge;
+ var amount = +
invdue
.value + +surcharge;
if ( what.value == 'select' ) {
$('#payment_amount_row').hide();
if ( what.value == 'select' ) {
$('#payment_amount_row').hide();
diff --git
a/httemplate/misc/process/payment.cgi
b/httemplate/misc/process/payment.cgi
index
5620b5b
..
939fc38
100644
(file)
--- a/
httemplate/misc/process/payment.cgi
+++ b/
httemplate/misc/process/payment.cgi
@@
-39,6
+39,8
@@
my $cust_main = qsearchs({
'extra_sql' => ' AND '. $curuser->agentnums_sql,
}) or die "unknown custnum $custnum";
'extra_sql' => ' AND '. $curuser->agentnums_sql,
}) or die "unknown custnum $custnum";
+my $invoice = ($cgi->param('invoice') =~ /^(\d+)$/) ? $cgi->param('invoice') : '';
+
$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/
or errorpage("illegal amount ". $cgi->param('amount'));
my $amount = $1;
$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/
or errorpage("illegal amount ". $cgi->param('amount'));
my $amount = $1;
@@
-224,6
+226,7
@@
if ( $cgi->param('batch') ) {
'payinfo' => $payinfo,
'paydate' => $paydate,
'payname' => $payname,
'payinfo' => $payinfo,
'paydate' => $paydate,
'payname' => $payname,
+ 'invnum' => $invoice,
map { $_ => scalar($cgi->param($_)) }
@{$payby2fields{$payby}}
);
map { $_ => scalar($cgi->param($_)) }
@{$payby2fields{$payby}}
);
@@
-246,6
+249,7
@@
if ( $cgi->param('batch') ) {
'discount_term' => $discount_term,
'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '',
'no_invnum' => 1,
'discount_term' => $discount_term,
'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '',
'no_invnum' => 1,
+ 'invnum' => $invoice,
map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}
);
errorpage($error) if $error;
map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}
);
errorpage($error) if $error;