projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#34960: Quotations [billpkgnum removal--missed a spot]
[freeside.git]
/
FS
/
FS
/
cust_main.pm
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
1afacea
..
5691d83
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-2564,7
+2564,13
@@
sub batch_card {
}else{
$amount = sprintf("%.2f", $self->balance - $self->in_transit_payments);
}
}else{
$amount = sprintf("%.2f", $self->balance - $self->in_transit_payments);
}
- return '' unless $amount > 0;
+ if ($amount <= 0) {
+ warn(sprintf("Customer balance %.2f - in transit amount %.2f is <= 0.\n",
+ $self->balance,
+ $self->in_transit_payments
+ ));
+ return;
+ }
my $invnum = delete $options{invnum};
my $payby = $options{payby} || $self->payby; #still dubious
my $invnum = delete $options{invnum};
my $payby = $options{payby} || $self->payby; #still dubious
@@
-2974,6
+2980,7
@@
sub in_transit_payments {
foreach my $cust_pay_batch ( qsearch('cust_pay_batch', {
'batchnum' => $pay_batch->batchnum,
'custnum' => $self->custnum,
foreach my $cust_pay_batch ( qsearch('cust_pay_batch', {
'batchnum' => $pay_batch->batchnum,
'custnum' => $self->custnum,
+ 'status' => '',
} ) ) {
$in_transit_payments += $cust_pay_batch->amount;
}
} ) ) {
$in_transit_payments += $cust_pay_batch->amount;
}
@@
-4595,6
+4602,8
@@
sub payment_history {
'description' => 'Previous balance',
'amount' => sprintf("%.2f",$previous),
'balance' => sprintf("%.2f",$previous),
'description' => 'Previous balance',
'amount' => sprintf("%.2f",$previous),
'balance' => sprintf("%.2f",$previous),
+ 'date' => $$opt{'start_date'},
+ 'date_pretty' => $self->time2str_local('short', $$opt{'start_date'} ),
};
#false laziness with above
foreach my $key ( qw(amount balance) ) {
};
#false laziness with above
foreach my $key ( qw(amount balance) ) {
@@
-5136,6
+5145,8
@@
I<extra_fields> - a hashref of name/value pairs which will be substituted
into the template. These values may override values mentioned below
and those from the customer record.
into the template. These values may override values mentioned below
and those from the customer record.
+I<template_text> - if present, ignores TEMPLATE_NAME and uses the provided text
+
The following variables are available in the template instead of or in addition
to the fields of the customer record.
The following variables are available in the template instead of or in addition
to the fields of the customer record.
@@
-5151,11
+5162,16
@@
I<$returnaddress> - the return address defaults to invoice_latexreturnaddress or
sub generate_letter {
my ($self, $template, %options) = @_;
sub generate_letter {
my ($self, $template, %options) = @_;
- return unless $conf->exists($template);
+ warn "Template $template does not exist" && return
+ unless $conf->exists($template) || $options{'template_text'};
+
+ my $template_source = $options{'template_text'}
+ ? [ $options{'template_text'} ]
+ : [ map "$_\n", $conf->config($template) ];
my $letter_template = new Text::Template
( TYPE => 'ARRAY',
my $letter_template = new Text::Template
( TYPE => 'ARRAY',
- SOURCE =>
[ map "$_\n", $conf->config($template)]
,
+ SOURCE =>
$template_source
,
DELIMITERS => [ '[@--', '--@]' ],
)
or die "can't create new Text::Template object: Text::Template::ERROR";
DELIMITERS => [ '[@--', '--@]' ],
)
or die "can't create new Text::Template object: Text::Template::ERROR";