payment and credit applications have separate "apply to refund" choices now, and...
[freeside.git] / httemplate / view / cust_main / payment_history / credit.html
index bf76945..fd43c1a 100644 (file)
@@ -25,6 +25,16 @@ if (    scalar(@cust_credit_bill)   == 0
                               #default# 'height' => 336,
                           ).
               ')';
+    #XXX if there are any open refunds
+    $apply.= ' ('. include( '/elements/popup_link.html',
+                              'label'    => 'apply to refund',
+                              'action'   => "${p}edit/cust_credit_refund.cgi?".
+                                            $cust_credit->crednum,
+                              'actionlabel' => 'Apply credit to refund',
+                              'width'    => 392,
+                              #default# 'height' => 336,
+                          ).
+              ')';
   }
 } elsif (    scalar(@cust_credit_bill)   == 1
           && scalar(@cust_credit_refund) == 0
@@ -60,15 +70,25 @@ if (    scalar(@cust_credit_bill)   == 0
     $desc .= '&nbsp;&nbsp;<B><FONT COLOR="#FF0000">$'.
              $cust_credit->credited. ' unapplied</FONT></B>';
     if ( $curuser->access_right('Apply credit') ) {
-      $desc = ' ('. 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,
-                          ).
-              ')';
+      $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,
+                            ).
+               ')';
+      #XXX if there are any open refunds
+      $apply.= ' ('. include( '/elements/popup_link.html',
+                                'label'       => 'apply to refund',
+                                'action'      => "${p}edit/cust_credit_refund.cgi?".
+                                                 $cust_credit->crednum,
+                                'actionlabel' => 'Apply credit to refund',
+                                'width'       => 392,
+                                #default# 'height' => 336,
+                            ).
+               ')';
     }
     $desc .= '<BR>';
   }