X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpayment_history%2Fcredit.html;h=85911a03f3969b52e1615cbc7a013cc966e1a48d;hb=9192ae1275e778f890d75c07066ddd2e4cabaa26;hp=3eed833d342366311b68dcc794b4c41d1d7d877d;hpb=251d07aa41b6830a0a2f2a51c14fa94586d843c2;p=freeside.git diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 3eed833d3..85911a03f 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -1,4 +1,4 @@ -<% $credit. ' '. $reason. $desc. $change_pkg. $apply. $delete. $unapply. $void %> +<% $credit. ' '. $reason. $desc. $change_pkg. $apply . $unapply. $void %> <%init> my( $cust_credit, %opt ) = @_; @@ -138,24 +138,24 @@ $void = ' ('. if $cust_credit->closed !~ /^Y/i && $opt{'Void credit'}; -my $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 - && $opt{'Delete credit'}; - my $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) - && $opt{'Unapply credit'}; + +if ($opt{'Unapply credit'} && !$cust_credit->closed) { + my $refund_to_unapply = $cust_credit->refund_to_unapply; + my $usepre = $refund_to_unapply && @cust_credit_bill; + $unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum, + emt('Are you sure you want to unapply this credit from invoices?'), + emt('Keep this credit, but dissociate it from the invoices it is currently applied against'), + emt('unapply') . ($usepre ? ' ' . emt('invoices') : '') + ) + if @cust_credit_bill; + $unapply .= areyousure_link("${p}misc/unapply-cust_credit_refund.cgi?".$cust_credit->crednum, + emt('Are you sure you want to unapply this credit from refunds?'), + emt('Keep this credit, but dissociate it from the refunds it is currently applied to'), + emt('unapply') . ($usepre ? ' ' . emt('refunds') : '') + ) + if $refund_to_unapply; +} my $reason = $cust_credit->reason; $reason = $reason ? " ($reason)" : '';