new status for pending third-party payments, fix for #12808
[freeside.git] / httemplate / view / cust_main / payment_history / pending_payment.html
1 <b><font size="+1" color="#FF0000">Pending payment </font></b> <% "$info $status ($link)" %>
2 <%init>
3
4 my( $cust_pay_pending, %opt ) = @_;
5
6 my $conf = new FS::Conf;
7
8 my $curuser = $FS::CurrentUser::CurrentUser;
9
10 my $payby = $cust_pay_pending->payby;
11
12 my $payinfo;
13 if ( $payby eq 'CARD' ) {
14   $payinfo = $cust_pay_pending->paymask;
15 } elsif ( $payby eq 'CHEK' ) {
16   my( $account, $aba ) = split('@', $cust_pay_pending->paymask );
17   $payinfo = "ABA $aba, Acct #$account";
18 } else {
19   $payinfo = $cust_pay_pending->payinfo;
20 }
21
22 my $target = "$payby$payinfo";
23 $payby =~ s/^BILL$/Check #/ if $payinfo;
24 $payby =~ s/^CHEK$/Electronic check /;
25 $payby =~ s/^PREP$/Prepaid card /;
26 $payby =~ s/^CARD$/Credit card #/; 
27 $payby =~ s/^COMP$/Complimentary by /; 
28 $payby =~ s/^CASH$/Cash/;
29 $payby =~ s/^WEST$/Western Union/;
30 $payby =~ s/^MCRD$/Manual credit card/;
31 $payby =~ s/^BILL$//;
32 my $info = $payby ? "($payby$payinfo)" : '';
33
34 my %statusaction = (
35   'new'        => 'delete',
36   'thirdparty' => 'delete',
37   'pending'    => 'complete',
38   'captured'   => 'capture',
39 );
40
41 my $edit_pending =
42   $FS::CurrentUser::CurrentUser->access_right('Edit customer pending payments');
43
44 my $status = "Status: ".$cust_pay_pending->status;
45
46 my $action = $statusaction{$cust_pay_pending->status};
47
48 my $link = "";
49 if ( $action && $edit_pending ) {
50     $link = include('/elements/popup_link.html',
51                'action' => $p. 'edit/cust_pay_pending.html'.
52                              '?paypendingnum='. $cust_pay_pending->paypendingnum.
53                              ";action=$action",
54                'label'  => $action,
55                'color'  => '#ff0000',
56                'width'  => 655,
57                'height' => ( $action eq 'delete' ? 480 : 575 ),
58                'actionlabel' => ucfirst($action). ' pending payment',
59             );
60 }
61
62 </%init>