X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=0094135ecf2e86da5b7d46ca949b3bd0aabed832;hb=9a778387bc4bfc97d28b25a9c123700fc6c15062;hp=4d4f1fa4be3d4ea65011a93fc78f10f7e249d579;hpb=5678372f90e81a312d04c615f810cde05c224aca;p=freeside.git diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 4d4f1fa4b..0094135ec 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1,6 +1,9 @@ package FS::cust_pkg; use strict; +use base qw( FS::cust_main_Mixin FS::location_Mixin + FS::m2m_Common FS::option_Common FS::Record + ); use vars qw(@ISA $disable_agentcheck $DEBUG $me); use Carp qw(cluck); use Scalar::Util qw( blessed ); @@ -11,8 +14,6 @@ use MIME::Entity; use FS::UID qw( getotaker dbh ); use FS::Misc qw( send_email ); use FS::Record qw( qsearch qsearchs ); -use FS::m2m_Common; -use FS::cust_main_Mixin; use FS::cust_svc; use FS::part_pkg; use FS::cust_main; @@ -41,8 +42,6 @@ use FS::svc_forward; # for sending cancel emails in sub cancel use FS::Conf; -@ISA = qw( FS::m2m_Common FS::cust_main_Mixin FS::option_Common FS::Record ); - $DEBUG = 0; $me = '[FS::cust_pkg]'; @@ -253,14 +252,14 @@ an optional queue name for ticket additions sub insert { my( $self, %options ) = @_; - if ( $self->part_pkg->option('start_1st') && !$self->start_date ) { + if ( $self->part_pkg->option('start_1st', 1) && !$self->start_date ) { my ($sec,$min,$hour,$mday,$mon,$year) = (localtime(time) )[0,1,2,3,4,5]; $mon += 1 unless $mday == 1; until ( $mon < 12 ) { $mon -= 12; $year++; } $self->start_date( timelocal_nocheck(0,0,0,1,$mon,$year) ); } - my $expire_months = $self->part_pkg->option('expire_months'); + my $expire_months = $self->part_pkg->option('expire_months', 1); if ( $expire_months && !$self->expire ) { my $start = $self->start_date || $self->setup || time; @@ -526,6 +525,7 @@ sub check { || $self->ut_numbern('cancel') || $self->ut_numbern('adjourn') || $self->ut_numbern('expire') + || $self->ut_enum('no_auto', [ '', 'Y' ]) ; return $error if $error; @@ -1960,41 +1960,24 @@ sub cust_main { qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); } +#these subs are in location_Mixin.pm now... unfortunately the POD doesn't mixin + =item cust_location Returns the location object, if any (see L). -=cut - -sub cust_location { - my $self = shift; - return '' unless $self->locationnum; - qsearchs( 'cust_location', { 'locationnum' => $self->locationnum } ); -} - =item cust_location_or_main If this package is associated with a location, returns the locaiton (see L), otherwise returns the customer (see L). -=cut - -sub cust_location_or_main { - my $self = shift; - $self->cust_location || $self->cust_main; -} - =item location_label [ OPTION => VALUE ... ] Returns the label of the location object (see L). =cut -sub location_label { - my $self = shift; - my $object = $self->cust_location_or_main; - $object->location_label(@_); -} +#end of subs in location_Mixin.pm now... unfortunately the POD doesn't mixin =item seconds_since TIMESTAMP