use strict;
use vars qw( @ISA $DEBUG $me
- $money_char $date_format $rdate_format $date_format_long );
+ $money_char );
# but NOT $conf
use vars qw( $invoice_lines @buf ); #yuck
use Fcntl qw(:flock); #for spool_csv
FS::UID->install_callback( sub {
my $conf = new FS::Conf; #global
$money_char = $conf->config('money_char') || '$';
- $date_format = $conf->config('date_format') || '%x'; #/YY
- $rdate_format = $conf->config('date_format') || '%m/%d/%Y'; #/YYYY
- $date_format_long = $conf->config('date_format_long') || '%b %o, %Y';
} );
=head1 NAME
my $taxtotal = 0;
$taxtotal += $_->{'amount'} foreach $self->_items_tax;
- my $duedate = $self->due_date2str('%m/%d/%Y'); #date_format?
+ my $duedate = $self->due_date2str('%m/%d/%Y'); # hardcoded, NOT date_format
my( $previous_balance, @unused ) = $self->previous; #previous balance
my $escape_function_nonbsp = ($format eq 'html')
? \&_html_escape : $escape_function;
- my %date_formats = ( 'latex' => $date_format_long,
- 'html' => $date_format_long,
- 'template' => '%s',
- );
- $date_formats{'html'} =~ s/ / /g;
-
- my $date_format = $date_formats{$format};
-
my %embolden_functions = ( 'latex' => sub { return '\textbf{'. shift(). '}'
},
'html' => sub { return '<b>'. shift(). '</b>'
#invoice info
'invnum' => $self->invnum,
'_date' => $self->_date,
- 'date' => $self->time2str_local($date_format, $self->_date),
- 'today' => $self->time2str_local($date_format_long, $today),
+ 'date' => $self->time2str_local('long', $self->_date, $format),
+ 'today' => $self->time2str_local('long', $today, $format),
'terms' => $self->terms,
'template' => $template, #params{'template'},
'notice_name' => ($params{'notice_name'} || 'Invoice'),#escape_function?
'current_charges' => sprintf("%.2f", $self->charged),
- 'duedate' => $self->due_date2str($rdate_format), #date_format?
+ 'duedate' => $self->due_date2str('rdate'),
#customer info
'custnum' => $cust_main->display_custnum,
#localization (see FS::cust_main_Mixin)
$invoice_data{'emt'} = sub { &$escape_function($self->mt(@_)) };
# prototype here to silence warnings
- $invoice_data{'time2str'} = sub ($;$$) { $self->time2str_local(@_) };
+ $invoice_data{'time2str'} = sub ($;$$) { $self->time2str_local(@_, $format) };
my $min_sdate = 999999999999;
my $max_edate = 0;
}
$invoice_data{'bill_period'} = '';
- $invoice_data{'bill_period'} = $self->time2str_local('%e %h', $min_sdate)
- . " to " .
- $self->time2str_local('%e %h', $max_edate)
+ $invoice_data{'bill_period'} =
+ $self->time2str_local('%e %h', $min_sdate, $format)
+ . " to " .
+ $self->time2str_local('%e %h', $max_edate, $format)
if ($max_edate != 0 && $min_sdate != 999999999999);
$invoice_data{finance_section} = '';
return $msg unless $self->terms;
if ( $self->due_date ) {
$msg .= ' - ' . $self->mt('Please pay by'). ' '.
- $self->due_date2str($date_format);
+ $self->due_date2str('short');
} elsif ( $self->terms ) {
$msg .= ' - '. $self->terms;
}
my $duedate = '';
if ( $conf->exists('invoice_default_terms')
&& $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) {
- $duedate = $self->time2str_local($rdate_format, $self->_date + ($1*86400) );
+ $duedate = $self->time2str_local('rdate', $self->_date + ($1*86400) );
}
$duedate;
}
sub _date_pretty {
my $self = shift;
- $self->time2str_local($date_format, $self->_date);
+ $self->time2str_local('short', $self->_date);
}
=item _items_sections LATE SUMMARYPAGE ESCAPE EXTRA_SECTIONS FORMAT
my @b = ();
foreach ( @pr_cust_bill ) {
my $date = $conf->exists('invoice_show_prior_due_date')
- ? 'due '. $_->due_date2str($date_format)
- : $self->time2str_local($date_format, $_->_date);
+ ? 'due '. $_->due_date2str('short')
+ : $self->time2str_local('short', $_->_date);
push @b, {
'description' => $self->mt('Previous Balance, Invoice #'). $_->invnum. " ($date)",
#'pkgpart' => 'N/A',
$cust_main->agentnum
);
if ( defined($date_style) && $date_style eq 'month_of' ) {
- $time_period = $self->time2str_local('The month of %B', $cust_bill_pkg->sdate);
+ $time_period = $self->mt('The month of [_1]',
+ $self->time2str_local('%B', $cust_bill_pkg->sdate)
+ );
} elsif ( defined($date_style) && $date_style eq 'X_month' ) {
my $desc = $conf->config( 'cust_bill-line_item-date_description',
$cust_main->agentnum
$desc .= ' ' unless $desc =~ /\s$/;
$time_period = $desc. $self->time2str_local('%B', $cust_bill_pkg->sdate);
} else {
- $time_period = $self->time2str_local($date_format, $cust_bill_pkg->sdate).
- " - ". $self->time2str_local($date_format, $cust_bill_pkg->edate);
+ $time_period = $self->time2str_local('short', $cust_bill_pkg->sdate).
+ " - ". $self->time2str_local('short', $cust_bill_pkg->edate);
}
$description .= " ($time_period)";
}
if ( $cust_bill_pkg->recur != 0 ) {
push @b, {
'description' => "$desc (".
- $self->time2str_local($date_format, $cust_bill_pkg->sdate). ' - '.
- $self->time2str_local($date_format, $cust_bill_pkg->edate). ')',
+ $self->time2str_local('short', $cust_bill_pkg->sdate). ' - '.
+ $self->time2str_local('short', $cust_bill_pkg->edate). ')',
'amount' => sprintf("%.2f", $cust_bill_pkg->recur),
};
}
# " (". time2str("%x",$_->cust_credit->_date) .")".
# $reason,
'description' => $self->mt('Credit applied').' '.
- $self->time2str_local($date_format,$obj->_date). $reason,
+ $self->time2str_local('short', $obj->_date). $reason,
'amount' => sprintf("%.2f",$obj->amount),
};
}
foreach my $obj (@objects) {
my $cust_pay = $obj->isa('FS::cust_pay') ? $obj : $obj->cust_pay;
my $desc = $self->mt('Payment received').' '.
- $self->time2str_local($date_format, $cust_pay->_date );
+ $self->time2str_local('short', $cust_pay->_date );
$desc .= $self->mt(' via ') .
$cust_pay->payby_payinfo_pretty( $self->cust_main->locale )
if $detailed;