projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
various DID inventory changes, RT12754
[freeside.git]
/
FS
/
FS
/
cust_pkg.pm
diff --git
a/FS/FS/cust_pkg.pm
b/FS/FS/cust_pkg.pm
index
f3c7b71
..
872a644
100644
(file)
--- a/
FS/FS/cust_pkg.pm
+++ b/
FS/FS/cust_pkg.pm
@@
-30,6
+30,7
@@
use FS::reason;
use FS::cust_pkg_discount;
use FS::discount;
use FS::UI::Web;
use FS::cust_pkg_discount;
use FS::discount;
use FS::UI::Web;
+use Data::Dumper;
# need to 'use' these instead of 'require' in sub { cancel, suspend, unsuspend,
# setup }
# need to 'use' these instead of 'require' in sub { cancel, suspend, unsuspend,
# setup }
@@
-194,6
+195,8
@@
Previous pkgpart
Previous locationnum
Previous locationnum
+=item waive_setup
+
=back
Note: setup, last_bill, bill, adjourn, susp, expire, cancel and change_date
=back
Note: setup, last_bill, bill, adjourn, susp, expire, cancel and change_date
@@
-593,10
+596,16
@@
sub check {
|| $self->ut_numbern('cancel')
|| $self->ut_numbern('adjourn')
|| $self->ut_numbern('expire')
|| $self->ut_numbern('cancel')
|| $self->ut_numbern('adjourn')
|| $self->ut_numbern('expire')
+ || $self->ut_numbern('dundate')
|| $self->ut_enum('no_auto', [ '', 'Y' ])
|| $self->ut_enum('no_auto', [ '', 'Y' ])
+ || $self->ut_enum('waive_setup', [ '', 'Y' ])
+ || $self->ut_numbern('agent_pkgid')
;
return $error if $error;
;
return $error if $error;
+ return "A package with both start date (future start) and setup date (already started) will never bill"
+ if $self->start_date && $self->setup;
+
$self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
if ( $self->dbdef_table->column('manual_flag') ) {
$self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
if ( $self->dbdef_table->column('manual_flag') ) {
@@
-757,6
+766,8
@@
sub cancel {
map { [ $_, $_->svc_x->table_info->{'cancel_weight'} ]; }
qsearch( 'cust_svc', { 'pkgnum' => $self->pkgnum } )
) {
map { [ $_, $_->svc_x->table_info->{'cancel_weight'} ]; }
qsearch( 'cust_svc', { 'pkgnum' => $self->pkgnum } )
) {
+ my $part_svc = $cust_svc->part_svc;
+ next if ( defined($part_svc) and $part_svc->preserve );
my $error = $cust_svc->cancel( %svc_cancel_opt );
if ( $error ) {
my $error = $cust_svc->cancel( %svc_cancel_opt );
if ( $error ) {
@@
-1407,7
+1418,6
@@
sub change {
}
}
-use Data::Dumper;
use Storable 'thaw';
use MIME::Base64;
sub process_bulk_cust_pkg {
use Storable 'thaw';
use MIME::Base64;
sub process_bulk_cust_pkg {
@@
-1769,6
+1779,9
@@
I<pkg_svc.hidden> flag will be omitted.
sub h_cust_svc {
my $self = shift;
sub h_cust_svc {
my $self = shift;
+ warn "$me _h_cust_svc called on $self\n"
+ if $DEBUG;
+
my ($end, $start, $mode) = @_;
my @cust_svc = $self->_sort_cust_svc(
[ qsearch( 'h_cust_svc',
my ($end, $start, $mode) = @_;
my @cust_svc = $self->_sort_cust_svc(
[ qsearch( 'h_cust_svc',
@@
-1779,8
+1792,7
@@
sub h_cust_svc {
if ( $mode eq 'I' ) {
my %hidden_svcpart = map { $_->svcpart => $_->hidden } $self->part_svc;
return grep { !$hidden_svcpart{$_->svcpart} } @cust_svc;
if ( $mode eq 'I' ) {
my %hidden_svcpart = map { $_->svcpart => $_->hidden } $self->part_svc;
return grep { !$hidden_svcpart{$_->svcpart} } @cust_svc;
- }
- else {
+ } else {
return @cust_svc;
}
}
return @cust_svc;
}
}
@@
-2122,6
+2134,8
@@
Returns a list of lists, calling the label method for all (historical) services
sub h_labels {
my $self = shift;
sub h_labels {
my $self = shift;
+ warn "$me _h_labels called on $self\n"
+ if $DEBUG;
map { [ $_->label(@_) ] } $self->h_cust_svc(@_);
}
map { [ $_->label(@_) ] } $self->h_cust_svc(@_);
}
@@
-2154,31
+2168,53
@@
sub h_labels_short {
sub _labels_short {
my( $self, $method ) = ( shift, shift );
sub _labels_short {
my( $self, $method ) = ( shift, shift );
+ warn "$me _labels_short called on $self with $method method\n"
+ if $DEBUG;
+
my $conf = new FS::Conf;
my $max_same_services = $conf->config('cust_bill-max_same_services') || 5;
my $conf = new FS::Conf;
my $max_same_services = $conf->config('cust_bill-max_same_services') || 5;
+ warn "$me _labels_short populating \%labels\n"
+ if $DEBUG;
+
my %labels;
#tie %labels, 'Tie::IxHash';
push @{ $labels{$_->[0]} }, $_->[1]
foreach $self->$method(@_);
my %labels;
#tie %labels, 'Tie::IxHash';
push @{ $labels{$_->[0]} }, $_->[1]
foreach $self->$method(@_);
+
+ warn "$me _labels_short populating \@labels\n"
+ if $DEBUG;
+
my @labels;
foreach my $label ( keys %labels ) {
my %seen = ();
my @values = grep { ! $seen{$_}++ } @{ $labels{$label} };
my $num = scalar(@values);
my @labels;
foreach my $label ( keys %labels ) {
my %seen = ();
my @values = grep { ! $seen{$_}++ } @{ $labels{$label} };
my $num = scalar(@values);
+ warn "$me _labels_short $num items for $label\n"
+ if $DEBUG;
+
if ( $num > $max_same_services ) {
if ( $num > $max_same_services ) {
+ warn "$me _labels_short more than $max_same_services, so summarizing\n"
+ if $DEBUG;
push @labels, "$label ($num)";
} else {
if ( $conf->exists('cust_bill-consolidate_services') ) {
push @labels, "$label ($num)";
} else {
if ( $conf->exists('cust_bill-consolidate_services') ) {
+ warn "$me _labels_short consolidating services\n"
+ if $DEBUG;
# push @labels, "$label: ". join(', ', @values);
while ( @values ) {
my $detail = "$label: ";
$detail .= shift(@values). ', '
# push @labels, "$label: ". join(', ', @values);
while ( @values ) {
my $detail = "$label: ";
$detail .= shift(@values). ', '
- while @values && length($detail.$values[0]) < 78;
+ while @values
+ && ( length($detail.$values[0]) < 78 || $detail eq "$label: " );
$detail =~ s/, $//;
push @labels, $detail;
}
$detail =~ s/, $//;
push @labels, $detail;
}
+ warn "$me _labels_short done consolidating services\n"
+ if $DEBUG;
} else {
} else {
+ warn "$me _labels_short adding service data\n"
+ if $DEBUG;
push @labels, map { "$label: $_" } @values;
}
}
push @labels, map { "$label: $_" } @values;
}
}
@@
-2573,6
+2609,7
@@
sub insert_discount {
'amount' => $self->discountnum_amount,
'percent' => $self->discountnum_percent,
'months' => $self->discountnum_months,
'amount' => $self->discountnum_amount,
'percent' => $self->discountnum_percent,
'months' => $self->discountnum_months,
+ 'setup' => $self->discountnum_setup,
#'disabled' => $self->discountnum_disabled,
};
#'disabled' => $self->discountnum_disabled,
};