[freeside-commits] freeside/httemplate/view/cust_main/payment_history credit.html, 1.2, 1.3 payment.html, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Sat Oct 4 23:07:38 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history
In directory wavetail.420.am:/tmp/cvs-serv3681/httemplate/view/cust_main/payment_history

Modified Files:
	credit.html payment.html 
Log Message:
finish UI improvements wrt refunds: now you have to post a check or cash refund explicitly, no more implicit creation by 'applying' credits.  don't show useless application links.  don't enable apply button until you pick an invoice/refund.  RT#3812

Index: payment.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history/payment.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- payment.html	5 Jun 2008 05:06:35 -0000	1.2
+++ payment.html	5 Oct 2008 06:07:36 -0000	1.3
@@ -40,25 +40,30 @@
   $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
   $post = '</FONT></B>';
   if ( $curuser->access_right('Apply payment') ) {
-    $apply = ' ('. include( '/elements/popup_link.html',
-                              'label'       => 'apply',
-                              'action'      => "${p}edit/cust_bill_pay.cgi?".
-                                               $cust_pay->paynum,
-                              'actionlabel' => 'Apply payment',
-                              '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_pay_refund.cgi?".
-                                               $cust_pay->paynum,
-                              'actionlabel' => 'Apply payment to refund',
-                              'width'       => 392,
-                              #default# 'height' => 336,
-                          ).
-              ')';
+    if ( $cust_pay->cust_main->total_owed > 0 ) {
+      $apply = ' ('.
+               include( '/elements/popup_link.html',
+                          'label'       => 'apply',
+                          'action'      => "${p}edit/cust_bill_pay.cgi?".
+                                           $cust_pay->paynum,
+                          'actionlabel' => 'Apply payment',
+                          'width'       => 392,
+                          #default# 'height' => 336,
+                      ).
+                ')';
+    }
+    if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) {
+      $apply.= ' ('.
+               include( '/elements/popup_link.html',
+                          'label'       => 'apply to refund',
+                          'action'      => "${p}edit/cust_pay_refund.cgi?".
+                                           $cust_pay->paynum,
+                          'actionlabel' => 'Apply payment to refund',
+                          'width'       => 392,
+                          #default# 'height' => 336,
+                      ).
+               ')';
+    }
   }
 } elsif (    scalar(@cust_bill_pay)   == 1
           && scalar(@cust_pay_refund) == 0
@@ -95,25 +100,30 @@
              '<B><FONT COLOR="#FF0000">$'.
              $cust_pay->unapplied. ' unapplied</FONT></B>';
     if ( $curuser->access_right('Apply payment') ) {
-      $apply = ' ('. include( '/elements/popup_link.html',
-                                'label'      => 'apply',
-                                'action'     => "${p}edit/cust_bill_pay.cgi?".
-                                                $cust_pay->paynum,
-                                'actionlabel' => 'Apply payment',
-                                '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_pay_refund.cgi?".
-                                                $cust_pay->paynum,
-                                'actionlabel' => 'Apply payment to refund',
-                                'width'      => 392,
-                                #default# 'height' => 336,
-                           ).
-               ')';
+      if ( $cust_pay->cust_main->total_owed > 0 ) {
+        $apply = ' ('.
+                 include( '/elements/popup_link.html',
+                            'label'      => 'apply',
+                            'action'     => "${p}edit/cust_bill_pay.cgi?".
+                                            $cust_pay->paynum,
+                            'actionlabel' => 'Apply payment',
+                            'width'      => 392,
+                            #default# 'height' => 336,
+                        ).
+                 ')';
+      }
+      if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) {
+        $apply.= ' ('.
+                 include( '/elements/popup_link.html',
+                            'label'      => 'apply to refund',
+                            'action'     => "${p}edit/cust_pay_refund.cgi?".
+                                            $cust_pay->paynum,
+                            'actionlabel' => 'Apply payment to refund',
+                            'width'      => 392,
+                            #default# 'height' => 336,
+                        ).
+                 ')';
+      }
     }
     $desc .= '<BR>';
   }

Index: credit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history/credit.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- credit.html	5 Jun 2008 05:06:35 -0000	1.2
+++ credit.html	5 Oct 2008 06:07:36 -0000	1.3
@@ -16,25 +16,30 @@
   $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
   $post = '</FONT></B>';
   if ( $curuser->access_right('Apply credit') ) {
-    $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,
-                          ).
-              ')';
+    if ( $cust_credit->cust_main->total_owed > 0 ) {
+      $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_unapplied_refunds > 0 ) {
+      $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
@@ -70,25 +75,30 @@
     $desc .= '&nbsp;&nbsp;<B><FONT COLOR="#FF0000">$'.
              $cust_credit->credited. ' unapplied</FONT></B>';
     if ( $curuser->access_right('Apply credit') ) {
-      $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,
-                            ).
-               ')';
+      if ( $cust_credit->cust_main->total_owed > 0 ) {
+        $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_unapplied_refunds > 0 ) {
+        $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>';
   }



More information about the freeside-commits mailing list