X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fbulk_Common.pm;h=a9231bc5ced375e13cab8c7435f4ea60c4673e52;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hp=3477c444c2788b0b1a16562938715a71227b4bb9;hpb=87a59b1bdf236765177c27ab18390ef1317cc34c;p=freeside.git diff --git a/FS/FS/part_pkg/bulk_Common.pm b/FS/FS/part_pkg/bulk_Common.pm index 3477c444c..a9231bc5c 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, ); @@ -70,7 +80,8 @@ sub calc_recur { next if $pkg_svc->bulk_skip; my @label = $cust_svc->label_long( $$sdate, $last_bill ); - die "fatal: no label found, wtf?" unless scalar(@label); #? + die "fatal: no label found for svcnum ". $cust_svc->svcnum + unless scalar(@label); #? my $svc_details = $label[0]. ': '. $label[1]. ': '; $part_svc_label{$cust_svc->svcpart} ||= $label[0]; @@ -122,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$/,@only_svcs); + } @cust_svc; + } + return @cust_svc; +} + 1;