X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=c3d3cb98e5308f860b89f92015183e20a49c76b0;hb=51fa32c6d1d22d4b78afd4bf12e307fbdacc6062;hp=2ed25a06c5341daf58c32b14efa98c5a8b1f0e07;hpb=fc0d0fe616e4bc5dc8137ad1af1cc7072d25f19f;p=freeside.git diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 2ed25a06c..c3d3cb98e 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -125,6 +125,10 @@ Billing item definition (see L) Optional link to package location (see L) +=item order_date + +date package was ordered (also remains same on changes) + =item start_date date @@ -271,6 +275,8 @@ sub insert { } } + $self->order_date(time); + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -487,7 +493,10 @@ sub replace { #trigger export of new RADIUS Expiration attribute when cust_pkg.bill changes foreach my $old_svc_acct ( @svc_acct ) { my $new_svc_acct = new FS::svc_acct { $old_svc_acct->hash }; - my $s_error = $new_svc_acct->replace($old_svc_acct); + my $s_error = + $new_svc_acct->replace( $old_svc_acct, + 'depend_jobnum' => $options->{depend_jobnum}, + ); if ( $s_error ) { $dbh->rollback if $oldAutoCommit; return $s_error; @@ -2500,7 +2509,6 @@ sub insert_discount { 'discountnum' => $self->discountnum, 'months_used' => 0, 'end_date' => '', #XXX - 'otaker' => $self->otaker, #for the create a new discount case '_type' => $self->discountnum__type, 'amount' => $self->discountnum_amount, @@ -3396,6 +3404,10 @@ sub _upgrade_data { # class method 'UPDATE cust_pkg SET bill = bill + (365*24*60*60) WHERE bill < last_bill AND bill > 1259654400 AND bill < 1262332800 AND (SELECT plan FROM part_pkg WHERE part_pkg.pkgpart = cust_pkg.pkgpart) = \'prorate\'', + # RT6628, add order_date to cust_pkg + 'update cust_pkg set order_date = (select history_date from h_cust_pkg + where h_cust_pkg.pkgnum = cust_pkg.pkgnum and + history_action = \'insert\') where order_date is null', ); foreach my $sql (@statements) { my $sth = dbh->prepare($sql);