use vars qw( @ISA %plans $DEBUG $setup_hack $skip_pkg_svc_hack );
use Carp qw(carp cluck confess);
use Scalar::Util qw( blessed );
-use Time::Local qw( timelocal_nocheck );
+use Time::Local qw( timelocal timelocal_nocheck );
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
=item fcc_voip_class - Which column of FCC form 477 part II.B this package
belongs in.
+=item delay_start - Number of days to delay package start, by default
+
=back
=head1 METHODS
)
|| $self->ut_numbern('fcc_ds0s')
|| $self->ut_numbern('fcc_voip_class')
+ || $self->ut_numbern('delay_start')
|| $self->SUPER::check
;
return $error if $error;
}
}
+# whether the plan allows discounts to be applied to this package
sub can_discount { 0; }
+# whether the plan allows changing the start date
sub can_start_date { 1; }
+# the delay start date if present
+sub delay_start_date {
+ my $self = shift;
+
+ my $delay = $self->delay_start or return '';
+
+ my ($mday,$mon,$year) = (localtime(time))[3,4,5];
+ timelocal(0,0,0,$mday,$mon,$year) + 86400 * $delay;
+
+}
+
sub freqs_href {
# moved to FS::Misc to make this accessible to other packages
# at initialization
if ( $freq =~ /^\d+$/ ) {
$mon += $freq;
until ( $mon < 12 ) { $mon -= 12; $year++; }
+
+ $mday = 28 if $mday > 28 && FS::Conf->new->exists('anniversary-rollback');
+
} elsif ( $freq =~ /^(\d+)w$/ ) {
my $weeks = $1;
$mday += $weeks * 7;