[freeside-commits] branch master updated. 1f19ac8ae3fda009fede1e3c6f3e1c75b93adfca
Ivan Kohler
ivan at freeside.biz
Mon Feb 12 21:04:03 PST 2018
The branch, master has been updated
via 1f19ac8ae3fda009fede1e3c6f3e1c75b93adfca (commit)
from 2e55db01a7c8990957256d959911312eadc33255 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1f19ac8ae3fda009fede1e3c6f3e1c75b93adfca
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Feb 12 21:04:00 2018 -0800
auto-create package class from string name on import, RT#79383
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 956cf797c..da53715c6 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -232,6 +232,19 @@ sub insert {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
+ if ( length($self->classnum) && $self->classnum !~ /^(\d+)$/ ) {
+ my $pkg_class = qsearchs('pkg_class', { 'classname' => $self->classnum } )
+ || new FS::pkg_class { classname => $self->classnum };
+ unless ( $pkg_class->classnum ) {
+ my $error = $pkg_class->insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+ $self->classnum( $pkg_class->classnum );
+ }
+
warn " inserting part_pkg record" if $DEBUG;
my $error = $self->SUPER::insert( $options{options} );
if ( $error ) {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_pkg.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
More information about the freeside-commits
mailing list