[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.111, 1.112

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Sep 22 12:16:21 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv19099/FS/FS/ClientAPI

Modified Files:
	MyAccount.pm 
Log Message:
prepayment discounts rt#5318

Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -w -d -r1.111 -r1.112
--- MyAccount.pm	17 Sep 2010 05:45:48 -0000	1.111
+++ MyAccount.pm	22 Sep 2010 19:16:19 -0000	1.112
@@ -357,6 +357,11 @@
       $return{support_services} = \@support_services;
     }
 
+    if ( $conf->config('prepayment_discounts-credit_type') ) {
+      #need to eval?
+      $return{discount_terms_hash} = { $cust_main->discount_terms_hash };
+    }
+
   } elsif ( $session->{'svcnum'} ) { #no customer record
 
     my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $session->{'svcnum'} } )
@@ -459,10 +464,10 @@
   #generic
   ##
 
+  my $conf = new FS::Conf;
   use vars qw($payment_info); #cache for performance
   unless ( $payment_info ) {
 
-    my $conf = new FS::Conf;
     my %states = map { $_->state => 1 }
                    qsearch('cust_main_county', {
                      'country' => $conf->config('countrydefault') || 'US'
@@ -555,6 +560,11 @@
 
   }
 
+  if ( $conf->config('prepayment_discounts-credit_type') ) {
+    #need to eval?
+    $return{discount_terms_hash} = { $cust_main->discount_terms_hash };
+  }
+
   #doubleclick protection
   my $_date = time;
   $return{paybatch} = "webui-MyAccount-$_date-$$-". rand() * 2**32;
@@ -586,6 +596,10 @@
   my $amount = $1;
   return { error => 'Amount must be greater than 0' } unless $amount > 0;
 
+  $p->{'discount_term'} =~ /^\s*(\d+)\s*$/
+    or return { 'error' => gettext('illegal_discount_term'). ': '. $p->{'discount_term'} };
+  my $discount_term = $1;
+
   $p->{'payname'} =~ /^([\w \,\.\-\']+)$/
     or return { 'error' => gettext('illegal_name'). " payname: ". $p->{'payname'} };
   my $payname = $1;
@@ -664,6 +678,7 @@
     'paybatch' => $paybatch, #this doesn't actually do anything
     'paycvv'   => $paycvv,
     'pkgnum'   => $session->{'pkgnum'},
+    'discount_term' => $discount_term,
     map { $_ => $p->{$_} } @{ $payby2fields{$payby} }
   );
   return { 'error' => $error } if $error;
@@ -1728,6 +1743,7 @@
     $custnum = $p->{'custnum'};
 
   } else {
+    $context = 'error';
     return ( 'error' => "Can't resume session" ); #better error message
   }
 



More information about the freeside-commits mailing list