X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FPackages.pm;h=f83bce915d94e4ec2b51a4a527fa862c676cc82e;hb=ded0ab5cac02f099b387de360fb6dd6bd8cbb6b4;hp=29e3bec13dc1aab409e98bcc52dc86496729164f;hpb=72980e7f1077ba3fc8573a095fa77e505f101a82;p=freeside.git diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index 29e3bec13..f83bce915 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -100,6 +100,28 @@ sub order_pkg { local $FS::UID::AutoCommit = 0; my $dbh = dbh; + if ( $opt->{'contactnum'} and $opt->{'contactnum'} != -1 ) { + + $cust_pkg->contactnum($opt->{'contactnum'}); + + } elsif ( $opt->{'contact'} ) { + + if ( ! $opt->{'contact'}->contactnum ) { + # not inserted yet + my $error = $opt->{'contact'}->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "inserting contact (transaction rolled back): $error"; + } + } + $cust_pkg->contactnum($opt->{'contact'}->contactnum); + + #} else { + # + # $cust_pkg->contactnum(); + + } + if ( $opt->{'locationnum'} and $opt->{'locationnum'} != -1 ) { $cust_pkg->locationnum($opt->{'locationnum'});