X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=efe94027dcbec702cde1e7fc0c2d40e14f9cb82d;hp=b68bf9e8f526ed4d0704d9c3bb0db54d36fccfca;hb=4329b50ca24073d39e16ce808ee49286309150e9;hpb=24df069082d9cf57ed6788c5e864f65f4170a83f diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b68bf9e8f..efe94027d 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -27,6 +27,7 @@ use FS::part_pkg; use FS::part_bill_event; use FS::cust_bill_event; use FS::cust_tax_exempt; +use FS::type_pkgs; use FS::Msgcat qw(gettext); @ISA = qw( FS::Record ); @@ -1769,9 +1770,20 @@ sub charge { return $error; } + my $pkgpart = $part_pkg->pkgpart; + my %type_pkgs = ( 'typenum' => $self->agent->typenum, 'pkgpart' => $pkgpart ); + unless ( qsearchs('type_pkgs', \%type_pkgs ) ) { + my $type_pkgs = new FS::type_pkgs \%type_pkgs; + $error = $type_pkgs->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + my $cust_pkg = new FS::cust_pkg ( { 'custnum' => $self->custnum, - 'pkgpart' => $part_pkg->pkgpart, + 'pkgpart' => $pkgpart, } ); $error = $cust_pkg->insert;