summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-06-26 08:12:52 +0000
committerivan <ivan>2002-06-26 08:12:52 +0000
commit4329b50ca24073d39e16ce808ee49286309150e9 (patch)
tree5b6e5a321aa1a5520d6b9e77299b2e13abb3a4fd
parent24df069082d9cf57ed6788c5e864f65f4170a83f (diff)
add type_pkgs record if necessary for one-time charges
-rw-r--r--FS/FS/cust_main.pm14
1 files changed, 13 insertions, 1 deletions
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;