X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fview%2Fcust_main%2Fpayment_history%2Fcredit.html;h=ec5041b55ec0ff4448498472ae71ce459d70d42c;hb=359004f4f4091e9789cb6e23a97c8eb89256d0b2;hp=6dd8970c80c5096505b660a8d73737514a696247;hpb=430b2c784d2ee9ea5be00b821d2dbd27279ef132;p=freeside.git diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 6dd8970c8..ec5041b55 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -6,10 +6,6 @@ my( $cust_credit, %opt ) = @_; my $date_format = $opt{'date_format'} || '%m/%d/%Y'; -my $conf = new FS::Conf; -my $money_char = $conf->config('money_char') || '$'; -my $curuser = $FS::CurrentUser::CurrentUser; - my @cust_credit_bill = $cust_credit->cust_credit_bill; my @cust_credit_refund = $cust_credit->cust_credit_refund; @@ -21,7 +17,7 @@ if ( $opt{'pkg-balances'} && $cust_credit->pkgnum ) { my %cust_credit_bill_width = ('width' => 392); my %cust_credit_bill_height = (); -if ($conf->exists('cust_credit_bill_pkg-manual')) { +if ( $opt{'cust_credit_bill_pkg-manual'} ) { %cust_credit_bill_width = ('width' => 592); %cust_credit_bill_height = ('height' => 436); } @@ -34,8 +30,8 @@ if ( scalar(@cust_credit_bill) == 0 $credit = '' . emt("Unapplied Credit by [_1]", $cust_credit->otaker ) . ''; - if ( $curuser->access_right('Apply credit') ) { - if ( $cust_credit->cust_main->total_owed > 0 ) { + if ( $opt{'Apply credit'} ) { + if ( $opt{total_owed} > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', 'label' => emt('apply'), @@ -47,7 +43,7 @@ if ( scalar(@cust_credit_bill) == 0 ). ')'; } - if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { + if ( $opt{total_unapplied_refunds} > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', 'label' => emt('apply to refund'), @@ -75,22 +71,22 @@ if ( scalar(@cust_credit_bill) == 0 foreach my $app ( sort { $a->_date <=> $b->_date } ( @cust_credit_bill, @cust_credit_refund ) ) { if ( $app->isa('FS::cust_credit_bill') ) { - $desc .= '  ' . $money_char . $app->amount . ' ' + $desc .= '  ' . $opt{money_char} . $app->amount . ' ' . $app->applied_to_invoice . '
'; } elsif ( $app->isa('FS::cust_credit_refund') ) { $desc .= '  ' . - emt("[_1][_2] refunded on [_3]", $money_char, $app->amount, + emt("[_1][_2] refunded on [_3]", $opt{money_char}, $app->amount, time2str($date_format, $app->_date) ) . '
'; } else { die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; } } if ( $cust_credit->credited > 0 ) { - $desc .= '  ' . - emt("[_1][_2] unapplied", $money_char, $cust_credit->credited) . + $desc .= '  '. + emt("[_1][_2] unapplied",$opt{money_char},$cust_credit->credited). ''; - if ( $curuser->access_right('Apply credit') ) { - if ( $cust_credit->cust_main->total_owed > 0 ) { + if ( $opt{'Apply credit'} ) { + if ( $opt{total_owed} > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', 'label' => emt('apply'), @@ -102,7 +98,7 @@ if ( scalar(@cust_credit_bill) == 0 ). ')'; } - if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { + if ( $opt{total_unapplied_refunds} > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', 'label' => emt('apply to refund'), @@ -124,7 +120,8 @@ $delete = areyousure_link("${p}misc/delete-cust_credit.cgi?".$cust_credit->credn '', emt('delete') ) -if ( $cust_credit->closed !~ /^Y/i && $curuser->access_right('Delete credit') ); + if $cust_credit->closed !~ /^Y/i + && $opt{'Delete credit'}; my $unapply = ''; $unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum, @@ -132,12 +129,12 @@ $unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->cre '', emt('unapply') ) -if ( $cust_credit->closed !~ /^Y/i && scalar(@cust_credit_bill) - && $curuser->access_right('Unapply credit') ); + if $cust_credit->closed !~ /^Y/i + && scalar(@cust_credit_bill) + && $opt{'Unapply credit'}; -my $reason = $cust_credit->reason - ? ' ('. $cust_credit->reason. ')' - : ''; +my $reason = $cust_credit->reason; +$reason = $reason ? " ($reason)" : '';