X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fquotation_pkg.pm;h=b9b37991a6c4c40225b3c6018767a0bdb7f194de;hp=1e5a0da5169b73a7b2284728a2819f6140aede65;hb=9972d7caa7a3e1a29dc4201e0c7256ba093ea705;hpb=f5ba2c8127ef9fcbfda8c25e0eeb32d05e47fd30 diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm index 1e5a0da51..b9b37991a 100644 --- a/FS/FS/quotation_pkg.pm +++ b/FS/FS/quotation_pkg.pm @@ -106,7 +106,11 @@ sub detail_table { 'quotation_pkg_detail'; } =item insert Adds this record to the database. If there is an error, returns the error, -otherwise returns false. +otherwise returns false. Accepts the following options: + +quotation_details - optional arrayref of detail strings to add (creates quotation_pkg_detail records) + +copy_on_order - value for this field when creating quotation_pkg_detail records (same for all details) =cut @@ -128,10 +132,22 @@ sub insert { if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; - } else { - $dbh->commit if $oldAutoCommit; - return ''; } + + if ($options{'quotation_details'}) { + $error = $self->set_details( + details => $options{'quotation_details'}, + copy_on_order => $options{'copy_on_order'} ? 'Y' : '', + ); + if ( $error ) { + $error .= ' (setting details)'; + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + + $dbh->commit if $oldAutoCommit; + return ''; } =item delete