diff options
-rw-r--r-- | FS/FS/rate.pm | 7 | ||||
-rwxr-xr-x | bin/cust_main-bulk_change | 13 | ||||
-rw-r--r-- | httemplate/edit/process/rate_detail.html | 1 | ||||
-rw-r--r-- | httemplate/elements/select-tower_sector.html | 1 | ||||
-rw-r--r-- | httemplate/view/cust_main/billing.html | 11 |
5 files changed, 27 insertions, 6 deletions
diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm index 8ee9a83be..03dde041b 100644 --- a/FS/FS/rate.pm +++ b/FS/FS/rate.pm @@ -469,8 +469,11 @@ sub process { warn "$rate replacing $old (". $param->{'ratenum'}. ")\n" if $DEBUG; my @param = ( 'job'=>$job ); - push @param, 'rate_detail'=>\@rate_detail - unless $param->{'preserve_rate_detail'}; + if ($param->{'preserve_rate_detail'}) { + $rate->default_detailnum($old->default_detailnum); + } else { + push @param, 'rate_detail'=>\@rate_detail; + } $error = $rate->replace( $old, @param ); diff --git a/bin/cust_main-bulk_change b/bin/cust_main-bulk_change index 32a6d7bd6..e03901272 100755 --- a/bin/cust_main-bulk_change +++ b/bin/cust_main-bulk_change @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; -use vars qw( $opt_a $opt_p $opt_t $opt_k ); +use vars qw( $opt_a $opt_p $opt_t $opt_k $opt_c ); use Getopt::Std; use FS::UID qw(adminsuidsetup); use FS::Record qw(qsearch qsearchs); @@ -9,7 +9,7 @@ use FS::cust_main; use FS::cust_tag; use FS::cust_pkg; -getopts('a:p:t:k:'); +getopts('a:p:t:k:c:'); my $user = shift or &usage; adminsuidsetup $user; @@ -64,6 +64,11 @@ while (<STDIN>) { } } + if ( $opt_c ) { + my @error = $cust_main->cancel( 'reason' => $opt_c ); + die join(' / ', @error). "\n" if @error; + } + } sub usage { @@ -76,7 +81,7 @@ cust_main-bulk_change =head1 SYNOPSIS - cust_main-bulk_change [ -a agentnum ] [ -p NEW_PAYBY ] [ -t tagnum ] [ -k old_pkgpart:new_pkgpart,... ] username <custnums.txt + cust_main-bulk_change [ -a agentnum ] [ -p NEW_PAYBY ] [ -t tagnum ] [ -k old_pkgpart:new_pkgpart,... ] [ -c reasonnum ] username <custnums.txt =head1 DESCRIPTION @@ -90,6 +95,8 @@ Command-line tool to make bulk changes to a group of customers. -k: old_pkgpart:new_pkgpart, for example, I<5:4>. Multiple entries can be comma-separated. +-c: Cancel customer + user: Employee username =head1 BUGS diff --git a/httemplate/edit/process/rate_detail.html b/httemplate/edit/process/rate_detail.html index 0709d5079..f8a744418 100644 --- a/httemplate/edit/process/rate_detail.html +++ b/httemplate/edit/process/rate_detail.html @@ -12,7 +12,6 @@ die "access denied" my $set_default_detail = sub { my ($cgi, $rate_detail) = @_; -warn Dumper $rate_detail; if (!$rate_detail->dest_regionnum) { # then this is a global default rate my $rate = $rate_detail->rate; diff --git a/httemplate/elements/select-tower_sector.html b/httemplate/elements/select-tower_sector.html index 59b016359..458bcddcf 100644 --- a/httemplate/elements/select-tower_sector.html +++ b/httemplate/elements/select-tower_sector.html @@ -11,6 +11,7 @@ <& /elements/select-table.html, table => 'tower', name_col => 'towername', + hashref => { 'disabled' => '', }, id => 'towernum', field => 'towernum', onchange => 'change_towernum(this.value);', diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index c031ce929..f7ea68a65 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -44,11 +44,13 @@ % 'hashref' => { 'custnum' => $cust_main->custnum, }, % 'extra_sql' => 'AND ( cancel IS NULL OR cancel = 0 ) % AND freq = '. dbh->quote($freq), +% 'order_by' => 'ORDER BY pkgnum', # to ensure old pkgs come before change_to_pkg % }) or next; % % my $freq_pretty = $cust_pkg[0]->part_pkg->freq_pretty; % % my $amount = 0; +% my $skip_pkg = {}; % foreach my $cust_pkg (@cust_pkg) { % my $part_pkg = $cust_pkg->part_pkg; % next if $cust_pkg->susp @@ -57,6 +59,15 @@ % || $cust_pkg->option('no_suspend_bill') % ); % +% #pkg change handling +% next if $skip_pkg->{$cust_pkg->pkgnum}; +% if ($cust_pkg->change_to_pkgnum) { +% #if change is on or before next bill date, use new pkg +% next if $cust_pkg->expire <= $cust_pkg->bill; +% #if change is after next bill date, use old (this) pkg +% $skip_pkg->{$cust_pkg->change_to_pkgnum} = 1; +% } +% % my $pkg_amount = 0; % % #add recurring amounts for this package and its billing add-ons |