+ my %opt = @{ $details->{'quotation_detail'} }
+ ? (
+ quotation_details => $details->{'quotation_detail'},
+ copy_on_order => scalar($cgi->param('copy_on_order')) ? 'Y' : '',
+ )
+ : ();
+
+ if ( $locationnum == -1 ) {
+ my $cust_location = FS::cust_location->new({
+ 'custnum' => $custnum,
+ 'prospectnum' => $prospectnum,
+ map { $_ => scalar($cgi->param($_)) }
+ FS::cust_main->location_fields
+ });
+ $opt{'cust_location'} = $cust_location;
+ } else {
+ $opt{'locationnum'} = $locationnum;
+ }
+
+ $error = $quotation_pkg->insert(%opt);