optimize customer view: avoid looking up config values inside loops, RT#4728
[freeside.git] / httemplate / view / cust_main / payment_history / payment.html
index 346c0d0..2e24b17 100644 (file)
@@ -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 $view =
    ')';
 
 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 @@ if (    $cust_pay->closed !~ /^Y/i
 
 my $delete = '';
 if ( $cust_pay->closed !~ /^Y/i
-     && $conf->exists('deletepayments')
+     && $opt{'deletepayments'}
      && $curuser->access_right('Delete payment')
    )
 {