projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2e55db0
)
auto-create package class from string name on import, RT#79383
author
Ivan Kohler
<ivan@freeside.biz>
Tue, 13 Feb 2018 05:04:00 +0000
(21:04 -0800)
committer
Ivan Kohler
<ivan@freeside.biz>
Tue, 13 Feb 2018 05:04:00 +0000
(21:04 -0800)
FS/FS/part_pkg.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_pkg.pm
b/FS/FS/part_pkg.pm
index
956cf79
..
da53715
100644
(file)
--- 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;
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 ) {
warn " inserting part_pkg record" if $DEBUG;
my $error = $self->SUPER::insert( $options{options} );
if ( $error ) {