summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-10-23 15:13:11 -0700
committerMark Wells <mark@freeside.biz>2013-10-23 15:27:46 -0700
commit49d30c8722afe66013eeca25b7fb2937d2f34307 (patch)
tree71e3a6658e4166a093c394b4e4fddbb5a5917998
parent096a664594b50f9ffcf09147a2369d4448293ced (diff)
localization hook for payinfo descriptions, #24850
-rw-r--r--FS/FS/cust_bill.pm3
-rw-r--r--FS/FS/payinfo_Mixin.pm19
2 files changed, 13 insertions, 9 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index cbf740469..e56ddf72d 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -5393,7 +5393,8 @@ sub _items_payments {
my $cust_pay = $obj->isa('FS::cust_pay') ? $obj : $obj->cust_pay;
my $desc = $self->mt('Payment received').' '.
time2str($date_format, $cust_pay->_date );
- $desc .= $self->mt(' via ' . $cust_pay->payby_payinfo_pretty)
+ $desc .= $self->mt(' via ') .
+ $cust_pay->payby_payinfo_pretty( $self->cust_main->locale )
if $detailed;
push @b, {
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm
index cd682dec8..07367f2fd 100644
--- a/FS/FS/payinfo_Mixin.pm
+++ b/FS/FS/payinfo_Mixin.pm
@@ -234,7 +234,7 @@ sub payinfo_check {
}
-=item payby_payinfo_pretty
+=item payby_payinfo_pretty [ LOCALE ]
Returns payment method and information (suitably masked, if applicable) as
a human-readable string, such as:
@@ -249,20 +249,23 @@ or
sub payby_payinfo_pretty {
my $self = shift;
+ my $locale = shift;
+ my $lh = FS::L10N->get_handle($locale);
if ( $self->payby eq 'CARD' ) {
- 'Card #'. $self->paymask;
+ $lh->maketext('Card #') . $self->paymask;
} elsif ( $self->payby eq 'CHEK' ) {
- 'E-check acct#'. $self->payinfo;
+ $lh->maketext('E-check acct#') . $self->payinfo;
} elsif ( $self->payby eq 'BILL' ) {
- 'Check #'. $self->payinfo;
+ $lh->maketext('Check #') . $self->payinfo;
} elsif ( $self->payby eq 'PREP' ) {
- 'Prepaid card #'. $self->payinfo;
+ $lh->maketext('Prepaid card #') . $self->payinfo;
} elsif ( $self->payby eq 'CASH' ) {
- 'Cash '. $self->payinfo;
+ $lh->maketext('Cash') . ' ' . $self->payinfo;
} elsif ( $self->payby eq 'WEST' ) {
- 'Western Union'; #. $self->payinfo;
+ # does Western Union localize their name?
+ $lh->maketext('Western Union');
} elsif ( $self->payby eq 'MCRD' ) {
- 'Manual credit card'; #. $self->payinfo;
+ $lh->maketext('Manual credit card');
} else {
$self->payby. ' '. $self->payinfo;
}