projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix creation of negative exemption records, #37088, from #13971
[freeside.git]
/
FS
/
FS
/
cust_main.pm
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
46df3ff
..
c636408
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-32,7
+32,7
@@
use Locale::Country;
use FS::UID qw( dbh driver_name );
use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
use FS::Cursor;
use FS::UID qw( dbh driver_name );
use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
use FS::Cursor;
-use FS::Misc qw( generate_email send_email generate_ps do_print );
+use FS::Misc qw( generate_email send_email generate_ps do_print
money_pretty
);
use FS::Msgcat qw(gettext);
use FS::CurrentUser;
use FS::TicketSystem;
use FS::Msgcat qw(gettext);
use FS::CurrentUser;
use FS::TicketSystem;
@@
-4241,8
+4241,7
@@
sub payment_history {
}
$$item{'balance'} = sprintf("%.2f",$balance);
foreach my $key ( qw(amount balance) ) {
}
$$item{'balance'} = sprintf("%.2f",$balance);
foreach my $key ( qw(amount balance) ) {
- $$item{$key.'_pretty'} = $$item{$key};
- $$item{$key.'_pretty'} =~ s/^(-?)/$1$money_char/;
+ $$item{$key.'_pretty'} = money_pretty($$item{$key});
}
push(@out,$item);
}
}
push(@out,$item);
}
@@
-4254,6
+4253,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) ) {
@@
-4680,6
+4681,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.
@@
-4695,11
+4698,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";
@@
-4814,7
+4822,9
@@
sub queueable_print {
my $self = qsearchs('cust_main', { 'custnum' => $opt{custnum} } )
or die "invalid customer number: " . $opt{custnum};
my $self = qsearchs('cust_main', { 'custnum' => $opt{custnum} } )
or die "invalid customer number: " . $opt{custnum};
- my $error = $self->print( { 'template' => $opt{template} } );
+#do not backport this change to 3.x
+# my $error = $self->print( { 'template' => $opt{template} } );
+ my $error = $self->print( $opt{'template'} );
die $error if $error;
}
die $error if $error;
}