[freeside-commits] freeside/FS/FS Conf.pm, 1.324.2.11, 1.324.2.12 cust_pkg.pm, 1.139.2.3, 1.139.2.4

Ivan,,, ivan at wavetail.420.am
Sun Nov 29 15:18:11 PST 2009


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Conf.pm cust_pkg.pm 
Log Message:
add cust_pkg-change_pkgpart-bill_now option to bill the new package immediately on package changes.  Useful for prepaid situations with RADIUS where an Expiration attribute base don the package must be present at all times.  RT#6692

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.324.2.11
retrieving revision 1.324.2.12
diff -u -d -r1.324.2.11 -r1.324.2.12
--- Conf.pm	20 Nov 2009 17:39:39 -0000	1.324.2.11
+++ Conf.pm	29 Nov 2009 23:18:09 -0000	1.324.2.12
@@ -1893,6 +1893,13 @@
   },
 
   {
+    'key'         => 'cust_pkg-change_pkgpart-bill_now',
+    'section'     => '',
+    'description' => "When changing packages, bill the new package immediately.  Useful for prepaid situations with RADIUS where an Expiration attribute base don the package must be present at all times.",
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'disable_autoreverse',
     'section'     => 'BIND',
     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.139.2.3
retrieving revision 1.139.2.4
diff -u -d -r1.139.2.3 -r1.139.2.4
--- cust_pkg.pm	4 Nov 2009 00:53:12 -0000	1.139.2.3
+++ cust_pkg.pm	29 Nov 2009 23:18:09 -0000	1.139.2.4
@@ -1207,11 +1207,21 @@
   #Good to go, cancel old package.
   $error = $self->cancel( quiet=>1 );
   if ($error) {
-    $dbh->rollback;
+    $dbh->rollback if $oldAutoCommit;
     return $error;
   }
 
+  if ( $conf->exists('cust_pkg-change_pkgpart-bill_now') ) {
+    #$self->cust_main
+    my $error = $cust_pkg->cust_main->bill( 'pkg_list' => [ $cust_pkg ] );
+    if ( $error ) {
+      $dbh->rollback if $oldAutoCommit;
+      return $error;
+    }
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
   $cust_pkg;
 
 }



More information about the freeside-commits mailing list