X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main.cgi;h=a34ddc429ed83c499416d5636f52bfc5230d61ee;hp=125c51aef36fab12facafbe25c35308fd644b1c5;hb=4ae85517a9c3a8a2f61e87bc27a74eb616e396a4;hpb=c0c6e34a0818945d86165b47adcddfea91f3f7e4 diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 125c51aef..a34ddc429 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -36,15 +36,15 @@ print qq!Edit this customer!; %> <% -print qq! | !. +print qq! | !. 'Cancel this customer' if $cust_main->ncancelled_pkgs; @@ -349,21 +349,6 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { } -%> - - - -<% - print qq!Packages !, qq!( Order and cancel packages (preserves services) )!, ; @@ -544,29 +529,6 @@ print ''; #end display packages %> - - <% if ( $conf->config('payby-default') ne 'HIDE' ) { %>

Payment History
@@ -660,31 +622,77 @@ function cust_credit_areyousure(href) { } } + my $refund = ''; + my $refund_days = $conf->config('card_refund-days') || 120; + if ( $cust_pay->closed !~ /^Y/i + && $cust_pay->payby eq 'CARD' + && time-$cust_pay->_date < $refund_days*86400 + && $cust_pay->unrefunded > 0 + ) { + $refund = qq! (refund)!; + } + + my $void = ''; + if ( $cust_pay->closed !~ /^Y/i + && $cust_pay->payby ne 'CARD' + ) { + $void = qq! (!. + qq!void)!; + } + my $delete = ''; if ( $cust_pay->closed !~ /^Y/i && $conf->exists('deletepayments') ) { - $delete = qq! (paynum. - qq!')">delete)!; + qq!', 'Are you sure you want to delete this payment?')">!. + qq!delete)!; } my $unapply = ''; if ( $cust_pay->closed !~ /^Y/i && $conf->exists('unapplypayments') && scalar(@cust_bill_pay) ) { - $unapply = qq! (paynum. - qq!')">unapply)!; + qq!', 'Are you sure you want to unapply this payment?')">!. + qq!unapply)!; } push @history, { 'date' => $cust_pay->_date, 'desc' => $pre. "Payment$post$info$desc". - "$apply$delete$unapply", + "$apply$refund$void$delete$unapply", 'payment' => $cust_pay->paid, 'target' => $target, }; } + #voided payments + foreach my $cust_pay_void ($cust_main->cust_pay_void) { + + my $payby = $cust_pay_void->payby; + my $payinfo = $payby eq 'CARD' + ? $cust_pay_void->payinfo_masked + : $cust_pay_void->payinfo; + + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^BILL$//; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $info = $payby ? " ($payby$payinfo)" : ''; + + push @history, { + 'date' => $cust_pay_void->_date, + 'desc' => "Payment $info voided ". + time2str("%D", $cust_pay_void->void_date). + " by ". $cust_pay_void->otaker. '', + 'void_payment' => $cust_pay_void->paid, + }; + + } + #credits (some false laziness w/payments) foreach my $cust_credit ($cust_main->cust_credit) { @@ -740,18 +748,20 @@ function cust_credit_areyousure(href) { # my $delete = ''; if ( $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits') ) { - $delete = qq! (crednum. - qq!')">delete)!; + qq!', 'Are you sure you want to delete this credit?')">!. + qq!delete)!; } my $unapply = ''; if ( $cust_credit->closed !~ /^Y/i && $conf->exists('unapplycredits') && scalar(@cust_credit_bill) ) { - $unapply = qq! (crednum. - qq!')">unapply)!; + qq!', 'Are you sure you want to unapply this credit?')">!. + qq!unapply)!; } push @history, { @@ -809,6 +819,8 @@ function cust_credit_areyousure(href) { my $payment = exists($item->{'payment'}) ? sprintf('- $%.2f', $item->{'payment'}) : ''; + $payment ||= sprintf('- $%.2f', $item->{'void_payment'}) + if exists($item->{'void_payment'}); my $credit = exists($item->{'credit'}) ? sprintf('- $%.2f', $item->{'credit'}) : ''; @@ -976,7 +988,8 @@ sub svc_provision_link { sub svc_unprovision_link { my $svc = shift or return ''; - return qq!Unprovision!; + qq!Unprovision!; } # This should be generalized to use config options to determine order. @@ -1004,7 +1017,8 @@ sub pkg_datestr { sub pkg_change_link { my $pkg = shift or return ''; - return qq!Change package!; + return qq!!. + qq!Change package!; } sub pkg_suspend_link { @@ -1019,19 +1033,22 @@ sub pkg_unsuspend_link { sub pkg_cancel_link { my $pkg = shift or return ''; - qq!Cancel now | !. + qq!!. + qq!Cancel now | !. qq!Cancel later!; } sub pkg_dates_link { my $pkg = shift or return ''; - return qq!Edit dates!; + qq!Edit dates!; } sub pkg_customize_link { my $pkg = shift or return ''; my $custnum = shift; - return qq!Customize!; + qq!Customize!; } %>