- $apply = ' ('. include( '/elements/popup_link.html',
- 'label' => 'apply',
- 'action' => "${p}edit/cust_credit_bill.cgi?".
- $cust_credit->crednum,
- 'actionlabel' => 'Apply credit',
- 'width' => 392,
- #default# 'height' => 336,
- ).
- ')';
+ if ( $cust_credit->cust_main->total_owed > 0 ) {
+ $apply = ' ('.
+ include( '/elements/popup_link.html',
+ 'label' => mt('apply'),
+ 'action' => "${p}edit/cust_credit_bill.cgi?".
+ $cust_credit->crednum,
+ 'actionlabel' => mt('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' => mt('apply to refund'),
+ 'action' => "${p}edit/cust_credit_refund.cgi?".
+ $cust_credit->crednum,
+ 'actionlabel' => mt('Apply credit to refund'),
+ 'width' => 392,
+ ).
+ ')';
+ }