[freeside-commits] freeside/FS/FS cust_pkg.pm, 1.139.2.10, 1.139.2.11
Ivan,,,
ivan at wavetail.420.am
Mon Mar 8 18:43:43 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv2110/FS/FS
Modified Files:
Tag: FREESIDE_1_9_BRANCH
cust_pkg.pm
Log Message:
a package that starts on the 1st and expires after N months, RT#7738
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.139.2.10
retrieving revision 1.139.2.11
diff -u -w -d -r1.139.2.10 -r1.139.2.11
--- cust_pkg.pm 17 Jan 2010 01:05:55 -0000 1.139.2.10
+++ cust_pkg.pm 9 Mar 2010 02:43:40 -0000 1.139.2.11
@@ -6,6 +6,7 @@
use Scalar::Util qw( blessed );
use List::Util qw(max);
use Tie::IxHash;
+use Time::Local qw( timelocal_nocheck );
use MIME::Entity;
use FS::UID qw( getotaker dbh );
use FS::Misc qw( send_email );
@@ -529,6 +530,26 @@
}
+ 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);
More information about the freeside-commits
mailing list