show refund reason on report and make it searchable, #39398
[freeside.git] / httemplate / search / cust_pay_pending.html
1 <& elements/cust_pay_or_refund.html,
2                 'thing'         => 'pay_pending',
3                 'amount_field'  => 'paid',
4                 'name_singular' => 'pending payment',
5                 'name_verb'     => 'pending',
6                 'disable_link'  => 1,
7                 'disable_by'    => 1, #add otaker to cust_pay_pending?
8                 'addl_header'   => [ 'Time', 'Payment Status', ],
9                 'addl_fields'   => [ sub { time2str('%r', shift->_date ) },
10                                      $status_sub,
11                                    ],
12                 'addl_sort_fields' => [ 'status' ],
13                 'redirect_empty' => $redirect_empty,
14 &>
15 <%init>
16
17 my %statusaction = (
18   'new'        => 'delete',
19   'pending'    => 'complete',
20   #'authorized' => '',
21   'captured'   => 'capture',
22   #'declined'   => '',
23   #wouldn't need to take action on a done state#'done'
24 );
25
26 my $edit_pending =
27   $FS::CurrentUser::CurrentUser->access_right('Edit customer pending payments');
28
29 my $status_sub = sub {
30   my $pending = shift;
31   my $return = $pending->status;
32   my $action = $statusaction{$pending->status};
33   return $return unless $action && $edit_pending;
34   my $link = include('/elements/popup_link.html',
35                        'action' => $p. 'edit/cust_pay_pending.html'.
36                                      '?paypendingnum='. $pending->paypendingnum.
37                                      ";action=$action",
38                        'label'  => $action,
39                        'color'  => '#ff0000',
40                        'width'  => 655,
41                        'height' => ( $action eq 'delete' ? 480 : 575 ),
42                        'actionlabel' => ucfirst($action). ' pending payment',
43                     );
44   $return. qq! <FONT SIZE="-1">($link)</FONT>!;
45 };
46
47 my $redirect_empty = sub {
48   my $cgi = shift;
49   if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
50     $p. "view/cust_main.cgi?$1";
51   } else {
52     '';
53   }
54 };
55
56 </%init>