From d5d1293020ff677240347c6b88e57ee957945750 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 31 Jan 2014 13:37:45 -0800 Subject: [PATCH] preserve order_date across package changes, #25130 --- FS/FS/cust_pkg.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 8aea17d34..8ee11a4ea 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -334,7 +334,9 @@ sub insert { } # set order date unless it was specified as part of an import - $self->order_date(time) unless $import && $self->order_date; + # or this was previously a different package + $self->order_date(time) unless ($import && $self->order_date) + or $self->change_pkgnum; my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -1792,6 +1794,9 @@ sub change { $hash{$date} = $self->getfield($date); } } + # always keep this date, regardless of anything + # (the date of the package change is in a different field) + $hash{'order_date'} = $self->getfield('order_date'); # allow $opt->{'locationnum'} = '' to specifically set it to null # (i.e. customer default location) -- 2.11.0