[freeside-commits] branch master updated. 7a8ff6a0a75e0a50b6fde0bff3d49e8372853e94

Jonathan Prykop jonathan at 420.am
Tue Feb 17 11:48:02 PST 2015


The branch, master has been updated
       via  7a8ff6a0a75e0a50b6fde0bff3d49e8372853e94 (commit)
      from  ce9a9630a2232dafc952bdaadb627fcc3a5558f9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7a8ff6a0a75e0a50b6fde0bff3d49e8372853e94
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Feb 17 13:47:18 2015 -0600

    RT#32089: Ignore services when using packages based on active services

diff --git a/FS/FS/part_pkg/bulk.pm b/FS/FS/part_pkg/bulk.pm
index 4a55858..bc42e20 100644
--- a/FS/FS/part_pkg/bulk.pm
+++ b/FS/FS/part_pkg/bulk.pm
@@ -27,7 +27,7 @@ $me = '[FS::part_pkg::bulk]';
 sub _bulk_cust_svc {
   my( $self, $cust_pkg, $sdate ) = @_;
                        #   END      START
-  $cust_pkg->h_cust_svc( $$sdate, $cust_pkg->last_bill );
+  return $self->_only_svcs_filter($cust_pkg->h_cust_svc( $$sdate, $cust_pkg->last_bill ));
 }
 
 sub _bulk_setup {
diff --git a/FS/FS/part_pkg/bulk_Common.pm b/FS/FS/part_pkg/bulk_Common.pm
index 67f2caf..a9231bc 100644
--- a/FS/FS/part_pkg/bulk_Common.pm
+++ b/FS/FS/part_pkg/bulk_Common.pm
@@ -5,6 +5,7 @@ use strict;
 use vars qw($DEBUG $me %info);
 use Date::Format;
 use FS::Conf;
+use FS::Record qw(qsearchs);
 
 $DEBUG = 0;
 $me = '[FS::part_pkg::bulk_Common]';
@@ -23,8 +24,17 @@ $me = '[FS::part_pkg::bulk_Common]';
                                    'instead of a detailed list',
                          'type' => 'checkbox',
                        },
+    'only_svcs' => {
+      'name' => 'Only charge fees for these services',
+      'type' => 'select_multiple',
+      'select_table'  => 'part_svc',
+      'select_key'    => 'svcpart',
+      'select_label'  => 'svc',
+      'disable_empty' => 1,
+      'parse'         => sub { @_ }, #should this be the default in /edit/process/part_pkg.cgi?
+    },
   },
-  'fieldorder' => [ 'svc_setup_fee', 'svc_recur_fee',
+  'fieldorder' => [ 'svc_setup_fee', 'svc_recur_fee', 'only_svcs',
                     'summarize_svcs', 'no_prorate' ],
   'weight' => 51,
 );
@@ -123,5 +133,17 @@ sub is_free_options {
 
 sub can_usageprice { 0; }
 
+sub _only_svcs_filter {
+  my ($self, @cust_svc) = @_;
+  my @only_svcs = split(', ',$self->option('only_svcs',1));
+  if (@only_svcs) {
+    @cust_svc = grep { 
+      my $svcpart = $_->svcpart;
+      grep(/^$svcpart$/, at only_svcs);
+    } @cust_svc;
+  }
+  return @cust_svc;
+}
+
 1;
 
diff --git a/FS/FS/part_pkg/bulk_simple.pm b/FS/FS/part_pkg/bulk_simple.pm
index 93944cc..6ed1250 100644
--- a/FS/FS/part_pkg/bulk_simple.pm
+++ b/FS/FS/part_pkg/bulk_simple.pm
@@ -18,7 +18,7 @@ $me = '[FS::part_pkg::bulk]';
 
 sub _bulk_cust_svc {
   my( $self, $cust_pkg, $sdate ) = @_;
-  $cust_pkg->cust_svc;
+  return $self->_only_svcs_filter($cust_pkg->cust_svc);
 }
 
 sub _bulk_setup {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/bulk.pm        |    2 +-
 FS/FS/part_pkg/bulk_Common.pm |   24 +++++++++++++++++++++++-
 FS/FS/part_pkg/bulk_simple.pm |    2 +-
 3 files changed, 25 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list