X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpayment_history%2Fcredit.html;h=6dd8970c80c5096505b660a8d73737514a696247;hb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;hp=058c6f536e9a47b260abe07dc8ca64d2931f63ec;hpb=4396080ed2829ae0595f1fd777f39d090c9bcd7c;p=freeside.git diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 058c6f536..6dd8970c8 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -1,9 +1,13 @@ -<% $pre %>Credit<% $post %> -by <% $cust_credit->otaker %><% "$reason$desc$apply$delete$unapply" %> +<% $credit %> +<% "$reason$desc$apply$delete$unapply" %> <%init> 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; @@ -15,34 +19,42 @@ if ( $opt{'pkg-balances'} && $cust_credit->pkgnum ) { $desc .= ' for '. $cust_pkg->pkg_label_long; } -my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); +my %cust_credit_bill_width = ('width' => 392); +my %cust_credit_bill_height = (); +if ($conf->exists('cust_credit_bill_pkg-manual')) { + %cust_credit_bill_width = ('width' => 592); + %cust_credit_bill_height = ('height' => 436); +} + +my( $apply, $ext ) = ( '', '', '', '' ); +my $credit = emt("Credit by [_1]", $cust_credit->otaker ); if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 0 ) { #completely unapplied - $pre = 'Unapplied '; - $post = ''; + $credit = '' + . emt("Unapplied Credit by [_1]", $cust_credit->otaker ) + . ''; if ( $curuser->access_right('Apply credit') ) { if ( $cust_credit->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => emt('apply'), 'action' => "${p}edit/cust_credit_bill.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - 'width' => 392, - #default# 'height' => 336, + 'actionlabel' => emt('Apply credit'), + %cust_credit_bill_width, + %cust_credit_bill_height, ). ')'; } if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => emt('apply to refund'), 'action' => "${p}edit/cust_credit_refund.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', + 'actionlabel' => emt('Apply credit to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } @@ -56,52 +68,48 @@ if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 1 && $cust_credit->credited == 0 ) { #applied to one refund - $desc .= ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); + $desc .= emt(" refunded on [_1]", time2str($date_format, $cust_credit_refund[0]->_date) ); } else { #complicated $desc .= '
'; foreach my $app ( sort { $a->_date <=> $b->_date } ( @cust_credit_bill, @cust_credit_refund ) ) { if ( $app->isa('FS::cust_credit_bill') ) { - $desc .= '  '. - '$'. $app->amount. - ' '. $app->applied_to_invoice. - '
'; - #' on '. time2str("%D", $app->_date). + $desc .= '  ' . $money_char . $app->amount . ' ' + . $app->applied_to_invoice . '
'; } elsif ( $app->isa('FS::cust_credit_refund') ) { - $desc .= '  '. - '$'. $app->amount. - ' refunded on '. time2str("%D", $app->_date). - '
'; + $desc .= '  ' . + emt("[_1][_2] refunded on [_3]", $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 .= '  $'. - $cust_credit->credited. ' unapplied'; + $desc .= '  ' . + emt("[_1][_2] unapplied", $money_char, $cust_credit->credited) . + ''; if ( $curuser->access_right('Apply credit') ) { if ( $cust_credit->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => emt('apply'), 'action' => "${p}edit/cust_credit_bill.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - 'width' => 392, - #default# 'height' => 336, + 'actionlabel' => emt('Apply credit'), + %cust_credit_bill_width, + %cust_credit_bill_height, ). ')'; } if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => emt('apply to refund'), 'action' => "${p}edit/cust_credit_refund.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', + 'actionlabel' => emt('Apply credit to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } @@ -111,32 +119,21 @@ if ( scalar(@cust_credit_bill) == 0 } # my $delete = ''; -if ( $cust_credit->closed !~ /^Y/i - - #s'pose deleting a credit isn't bad like deleting a payment - # and this needs to be generally available until we have credit voiding.. - #&& $conf->exists('deletecredits') - - && $curuser->access_right('Delete credit') - ) -{ - $delete = qq! (!. - qq!delete)!; -} +$delete = areyousure_link("${p}misc/delete-cust_credit.cgi?".$cust_credit->crednum, + emt('Are you sure you want to delete this credit?'), + '', + emt('delete') + ) +if ( $cust_credit->closed !~ /^Y/i && $curuser->access_right('Delete credit') ); my $unapply = ''; -if ( $cust_credit->closed !~ /^Y/i - && scalar(@cust_credit_bill) - && $curuser->access_right('Unapply credit') - ) -{ - $unapply = qq! (!. - qq!unapply)!; -} +$unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum, + emt('Are you sure you want to unapply this credit?'), + '', + emt('unapply') + ) +if ( $cust_credit->closed !~ /^Y/i && scalar(@cust_credit_bill) + && $curuser->access_right('Unapply credit') ); my $reason = $cust_credit->reason ? ' ('. $cust_credit->reason. ')'