projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update Makefile.PL dependancies (PREREQ_PM) for self-service module and
[freeside.git]
/
FS
/
FS
/
part_pkg.pm
diff --git
a/FS/FS/part_pkg.pm
b/FS/FS/part_pkg.pm
index
99d88d5
..
12ee804
100644
(file)
--- a/
FS/FS/part_pkg.pm
+++ b/
FS/FS/part_pkg.pm
@@
-180,6
+180,8
@@
insert and replace methods.
sub check {
my $self = shift;
sub check {
my $self = shift;
+ for (qw(setup recur)) { $self->set($_=>0) if $self->get($_) =~ /^\s*$/; }
+
my $conf = new FS::Conf;
if ( $conf->exists('safe-part_pkg') ) {
my $conf = new FS::Conf;
if ( $conf->exists('safe-part_pkg') ) {
@@
-239,6
+241,7
@@
sub check {
|| $self->ut_enum('recurtax', [ '', 'Y' ] )
|| $self->ut_textn('taxclass')
|| $self->ut_enum('disabled', [ '', 'Y' ] )
|| $self->ut_enum('recurtax', [ '', 'Y' ] )
|| $self->ut_textn('taxclass')
|| $self->ut_enum('disabled', [ '', 'Y' ] )
+ || $self->SUPER::check
;
}
;
}
@@
-265,11
+268,12
@@
SVCDB is specified and does not match the svcdb of the service definition,
sub svcpart {
my $self = shift;
sub svcpart {
my $self = shift;
- my $svcdb = shift;
- my @pkg_svc = $self->pkg_svc;
- return '' if scalar(@pkg_svc) != 1
- || $pkg_svc[0]->quantity != 1
- || ( $svcdb && $pkg_svc[0]->part_svc->svcdb ne $svcdb );
+ my $svcdb = scalar(@_) ? shift : '';
+ my @pkg_svc = grep {
+ $_->quantity == 1
+ && ( $svcdb eq $_->part_svc->svcdb || !$svcdb )
+ } $self->pkg_svc;
+ return '' if scalar(@pkg_svc) != 1;
$pkg_svc[0]->svcpart;
}
$pkg_svc[0]->svcpart;
}