X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=b1a4d0303616e2bae12bf1714d1033a22f2144db;hb=140fba9bbf23d8b18ee066229bbabb5286aa9bb4;hp=c1a066d45add9a1fcf87f89bebb51c1f28d07f27;hpb=13ea717f7e605a77c9cd286deb69a41888970e3a;p=freeside.git diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index c1a066d45..b1a4d0303 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -283,7 +283,7 @@ sub insert { } } - my $free_days = $part_pkg->option('free_days'); + my $free_days = $part_pkg->option('free_days',1); if ( $free_days && $part_pkg->option('delay_setup',1) ) { #&& !$self->start_date my ($mday,$mon,$year) = (localtime(time) )[3,4,5]; #my $start_date = ($self->start_date || timelocal(0,0,0,$mday,$mon,$year)) + 86400 * $free_days; @@ -1000,6 +1000,19 @@ sub suspend { } } + my %hash = $self->hash; + if ( $date ) { + $hash{'adjourn'} = $date; + } else { + $hash{'susp'} = $suspend_time; + } + my $new = new FS::cust_pkg ( \%hash ); + $error = $new->replace( $self, options => { $self->options } ); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + unless ( $date ) { my @labels = (); @@ -1055,19 +1068,6 @@ sub suspend { } - my %hash = $self->hash; - if ( $date ) { - $hash{'adjourn'} = $date; - } else { - $hash{'susp'} = $suspend_time; - } - my $new = new FS::cust_pkg ( \%hash ); - $error = $new->replace( $self, options => { $self->options } ); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return $error; - } - $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; #no errors