RT#37038 Add Card Type Name to Payment Report
authorJonathan Prykop <jonathan@freeside.biz>
Tue, 6 Oct 2015 06:46:31 +0000 (01:46 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Tue, 6 Oct 2015 06:46:31 +0000 (01:46 -0500)
FS/FS/payinfo_Mixin.pm
httemplate/search/cust_pay.html
httemplate/search/elements/cust_pay_or_refund.html

index c66e3bc..6b96bbe 100644 (file)
@@ -239,7 +239,11 @@ sub payby_payinfo_pretty {
   my $locale = shift;
   my $lh = FS::L10N->get_handle($locale);
   if ( $self->payby eq 'CARD' ) {
-    $lh->maketext('Card #') . $self->paymask;
+    if ($self->paymask =~ /tokenized/) {
+      $lh->maketext('Tokenized Card');
+    } else {
+      $lh->maketext('Card #') . $self->paymask;
+    }
   } elsif ( $self->payby eq 'CHEK' ) {
 
     #false laziness w/view/cust_main/payment_history.html::translate_payinfo
index 03474c1..e466f6a 100755 (executable)
@@ -3,4 +3,5 @@
                 'amount_field'  => 'paid',
                 'name_singular' => emt('payment'),
                 'name_verb'     => emt('paid'),
+                'show_card_type' => 1,
 &>
index 5808e5f..1fea67c 100755 (executable)
@@ -184,6 +184,16 @@ push @fields, 'payby_payinfo_pretty',
 push @link_onclicks, $sub_receipt, '';
 push @sort_fields, 'paysort', $amount_field;
 
+if ($opt{'show_card_type'}) {
+  push @header, emt('Card Type');
+  $align .= 'r';
+  push @links, '';
+  push @fields, sub { 
+    (($_[0]->payby eq 'CARD') && ($_[0]->paymask !~ /N\/A/)) ? cardtype($_[0]->paymask) : ''
+  };
+  push @sort_fields, '';
+}
+
 if ( $unapplied ) {
   push @header, emt('Unapplied');
   $align .= 'r';