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

Ivan,,, ivan at wavetail.420.am
Sat Feb 7 00:23:12 PST 2009


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

Modified Files:
	payment.html refund.html 
Log Message:
optimize customer view: avoid looking up config values inside loops, RT#4728

Index: refund.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history/refund.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- refund.html	3 Sep 2008 01:46:14 -0000	1.2
+++ refund.html	7 Feb 2009 08:23:10 -0000	1.3
@@ -5,7 +5,6 @@
 
 my( $cust_refund, %opt ) = @_;
 
-my $conf = new FS::Conf;
 my $curuser = $FS::CurrentUser::CurrentUser;
 
 my $payby = $cust_refund->payby;
@@ -36,7 +35,7 @@
 
 my $delete = '';
 if ( $cust_refund->closed !~ /^Y/i
-     && $conf->exists('deleterefunds')
+     && $opt{'deleterefunds'}
      && $curuser->access_right('Delete refund')
    )
 {

Index: payment.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history/payment.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- payment.html	5 Oct 2008 06:07:36 -0000	1.3
+++ payment.html	7 Feb 2009 08:23:10 -0000	1.4
@@ -4,7 +4,6 @@
 
 my( $cust_pay, %opt ) = @_;
 
-my $conf = new FS::Conf;
 my $curuser = $FS::CurrentUser::CurrentUser;
 
 my $payby = $cust_pay->payby;
@@ -139,7 +138,7 @@
    ')';
 
 my $refund = '';
-my $refund_days = $conf->config('card_refund-days') || 120;
+my $refund_days = $opt{'card_refund-days'} || 120;
 if (    $cust_pay->closed !~ /^Y/i
      && $cust_pay->payby =~ /^(CARD|CHEK)$/
      && time-$cust_pay->_date < $refund_days*86400
@@ -179,7 +178,7 @@
 
 my $delete = '';
 if ( $cust_pay->closed !~ /^Y/i
-     && $conf->exists('deletepayments')
+     && $opt{'deletepayments'}
      && $curuser->access_right('Delete payment')
    )
 {



More information about the freeside-commits mailing list