+=cut
+
+sub insert {
+ my $self = shift;
+ $self->_rebless;
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+
+ my $error = $self->SUPER::insert;
+ # calling _extension at this point makes it copy the msgnum, so links work
+ if ( $self->extension_table ) {
+ local $FS::Record::nowarn_classload = 1;
+ my $extension = FS::Record->new($self->extension_table, { $self->hash });
+ $error ||= $extension->insert;
+ }
+
+ if ( $error ) {
+ dbh->rollback if $oldAutoCommit;
+ } else {
+ dbh->commit if $oldAutoCommit;
+ }
+ $error;
+}