X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=site_perl%2Fpart_pkg.pm;h=556146e38eb1210bdf6a1e4b1f12de36cbc4aff5;hb=1e3eae905b861761f93643aa5fce14a8be5d9ed2;hp=82c7aec28b821d36405ad3913dd9837f841334c4;hpb=1f2d8690193476319d61b20b78461eb1a3ff106e;p=freeside.git diff --git a/site_perl/part_pkg.pm b/site_perl/part_pkg.pm index 82c7aec28..556146e38 100644 --- a/site_perl/part_pkg.pm +++ b/site_perl/part_pkg.pm @@ -2,7 +2,8 @@ package FS::part_pkg; use strict; use vars qw( @ISA ); -use FS::Record; +use FS::Record qw( qsearch ); +use FS::pkg_svc; @ISA = qw( FS::Record ); @@ -27,10 +28,15 @@ FS::part_pkg - Object methods for part_pkg objects $error = $record->check; + @pkg_svc = $record->pkg_svc; + + $svcnum = $record->svcpart; + $svcnum = $record->svcpart( 'svc_acct' ); + =head1 DESCRIPTION -An FS::part_pkg represents a billing item definition. FS::part_pkg inherits -from FS::Record. The following fields are currently supported: +An FS::part_pkg object represents a billing item definition. FS::part_pkg +inherits from FS::Record. The following fields are currently supported: =over 4 @@ -125,11 +131,42 @@ sub check { ; } +=item pkg_svc + +Returns all FS::pkg_svc objects (see L) for this package +definition. + +=cut + +sub pkg_svc { + my $self = shift; + qsearch( 'pkg_svc', { 'pkgpart' => $self->pkgpart } ); +} + +=item svcpart [ SVCDB ] + +Returns the svcpart of a single service definition (see L) +associated with this billing item definition (see L). Returns +false if there not exactly one service definition with quantity 1, or if +SVCDB is specified and does not match the svcdb of the service definition, + +=cut + +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 ); + $pkg_svc[0]->svcpart; +} + =back =head1 VERSION -$Id: part_pkg.pm,v 1.4 1998-12-29 11:59:48 ivan Exp $ +$Id: part_pkg.pm,v 1.6 1999-07-20 10:37:05 ivan Exp $ =head1 BUGS @@ -150,8 +187,12 @@ ivan@sisd.com 97-dec-5 pod ivan@sisd.com 98-sep-21 $Log: part_pkg.pm,v $ -Revision 1.4 1998-12-29 11:59:48 ivan -mostly properly OO, some work still to be done with svc_ stuff +Revision 1.6 1999-07-20 10:37:05 ivan +cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to +prepare for a signup server + +Revision 1.5 1998/12/31 01:04:16 ivan +doc Revision 1.3 1998/11/15 13:00:15 ivan bugfix in clone method, clone method doc clarification