summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2010-03-10 06:52:59 +0000
committerivan <ivan>2010-03-10 06:52:59 +0000
commit8f83fe5dedcd703c469a001a6916eff709733c6a (patch)
tree4f39ea652dc703ec05d01769409273cab20847b6 /FS
parent6cd9fe564289a9a7b6c985e683cbe0f783820634 (diff)
oops, move start_1st and expire_months handling from check to insert, so it doesn't get triggered on edit, RT#7347
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pkg.pm40
1 files changed, 20 insertions, 20 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index e553aa3..e11e82f 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -251,6 +251,26 @@ an optional queue name for ticket additions
sub insert {
my( $self, %options ) = @_;
+ if ( $self->part_pkg->option('start_1st') && !$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');
+ if ( $expire_months && !$self->expire ) {
+ my $start = $self->start_date || $self->setup || time;
+
+ #false laziness w/part_pkg::add_freq
+ my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($start) )[0,1,2,3,4,5];
+ $mon += $expire_months;
+ until ( $mon < 12 ) { $mon -= 12; $year++; }
+
+ #$self->expire( timelocal_nocheck($sec,$min,$hour,$mday,$mon,$year) );
+ $self->expire( timelocal_nocheck(0,0,0,$mday,$mon,$year) );
+ }
+
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
@@ -530,26 +550,6 @@ sub check {
}
- if ( $self->part_pkg->option('start_1st') && !$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');
- if ( $expire_months && !$self->expire ) {
- my $start = $self->start_date || $self->setup || time;
-
- #false laziness w/part_pkg::add_freq
- my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($start) )[0,1,2,3,4,5];
- $mon += $expire_months;
- until ( $mon < 12 ) { $mon -= 12; $year++; }
-
- #$self->expire( timelocal_nocheck($sec,$min,$hour,$mday,$mon,$year) );
- $self->expire( timelocal_nocheck(0,0,0,$mday,$mon,$year) );
- }
-
$self->otaker(getotaker) unless $self->otaker;
$self->otaker =~ /^(\w{1,32})$/ or return "Illegal otaker";
$self->otaker($1);