X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=f9f99de7e0d47f7f209fd3fcdf5d5c7bcb8146aa;hp=e7734c1fc111d094366392fc5003495d09fafbcb;hb=11bbf29de447fe39e9d7155fe280a0df70fa8c3c;hpb=8e3dfb380406e145494a5fffa7a0e4aab7b38253 diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index e7734c1fc..f9f99de7e 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,22 +1,139 @@ -<% +% if ( $link eq 'popup' ) { + <& /elements/header-popup.html, $title &> +% } else { + <& /elements/header-cust_main.html, view=>'payment_history', custnum=>$custnum &> +

<% $title |h %>

+% } + +<& /elements/init_calendar.html &> + +<& /elements/error.html &> + +
+ + + + + + + +% my %date_args = ( +% 'name' => '_date', +% 'label' => emt('Date'), +% 'value' => $_date, +% 'format' => $date_format. ' %r', +% 'colspan' => 2, +% ); +% if ( $FS::CurrentUser::CurrentUser->access_right('Backdate payment') ) { + + <& /elements/tr-input-date-field.html, \%date_args &> + +% } else { + + <& /elements/tr-fixed-date.html, \%date_args &> + +% } + + + + + + +% if ( $conf->exists('part_pkg-term_discounts') ) { + <& /elements/tr-select-discount_term.html, + 'custnum' => $custnum, + 'amount_id' => 'paid', + &> +% } + +% if ( $payby eq 'BILL' ) { + + + + +% } +% elsif ( $payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) { + + + + + + + + + + + + + + + + + + + + +% } + + +% if ( $link eq 'custnum' || $link eq 'popup' ) { + + + + +% } elsif ( $link eq 'invnum' ) { + + + + + +% } + + +% if ( $conf->exists('pkg-balances') ) { + <& /elements/tr-select-cust_pkg-balances.html, + 'custnum' => $custnum, + 'cgi' => $cgi + &> +% } else { + +% } + +
<% mt('Amount') |h %><% $money_char |h %> <% mt('by') |h %> <% mt(FS::payby->payname($payby)) |h %>
<% mt('Check #') |h %>
<% mt('Bank') |h %>
<% mt('Check #') |h %>
<% mt('Teller #') |h %>
<% mt('Depositor') |h %>
<% mt('Account #') |h %>
<% mt('Auto-apply to invoices') |h %> + + <% mt('Apply to') |h %>Invoice #<% $linknum %> only
+ +
+ + +
+ +% if ( $link eq 'popup' ) { + + +% } else { + <& /elements/footer-cust_main.html &> +% } + +<%init> my $conf = new FS::Conf; -my %payby = ( - 'BILL' => 'Check', - 'CASH' => 'Cash', - 'WEST' => 'Western Union', - 'MCRD' => 'Manual credit card', -); +my $money_char = $conf->config('money_char') || '$'; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -my($link, $linknum, $paid, $payby, $payinfo, $_date); +my($link, $linknum, $paid, $payby, $payinfo, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); - $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; + $_date = $cgi->param('_date') ? parse_datetime($cgi->param('_date')) : time; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $link = $cgi->param('popup') ? 'popup' : 'custnum'; $linknum = $1; @@ -35,103 +152,25 @@ if ( $cgi->param('error') ) { die "illegal query ". $cgi->keywords; } -my $paybatch = "webui-$_date-$$-". rand() * 2**32; - -my $title = 'Post '. $payby{$payby}. ' payment'; -$title .= " against Invoice #$linknum" if $link eq 'invnum'; +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $payby eq 'BILL'; +push @rights, 'Post cash payment' if $payby eq 'CASH'; -if ( $link eq 'popup' ) { +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); -%><%= include('/elements/header-popup.html', $title ) %> - -<% } else { %> - -<%= include("/elements/header.html", $title, '') %> - -<% } %> - -<% if ( $cgi->param('error') ) { %> -Error: <%= $cgi->param('error') %> -

-<% } %> - - - - - +my $paybatch = "webui-$_date-$$-". rand() * 2**32; -
- - +my $title = mt('Post '. FS::payby->payname($payby). ' payment'); +$title .= mt(" against Invoice #[_1]",$linknum) if $link eq 'invnum'; -<% -my $money_char = $conf->config('money_char') || '$'; my $custnum; if ( $link eq 'invnum' ) { my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) or die "unknown invnum $linknum"; $custnum = $cust_bill->custnum; -} elsif ( $link eq 'custnum' ) { +} elsif ( $link eq 'custnum' || $link eq 'popup' ) { $custnum = $linknum; } -%> - -<% unless ( $link eq 'popup' ) { %> -<%= small_custview($custnum, $conf->config('countrydefault')) %> -<% } %> - - - -

-Payment -<%= ntable("#cccccc", 2) %> - - Date - - "> - - - - - - Amount - <%= $money_char %> - by <%= $payby{$payby} %> - - -<% if ( $payby eq 'BILL' ) { %> - - - Check # - - - -<% } %> - - -<% if ( $link eq 'custnum' ) { %> - Auto-apply
to invoices - -<% } elsif ( $link eq 'invnum' ) { %> - Apply to - Invoice #<%= $linknum %> only - -<% } %> - - - - - -
- -
- - +