X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fquick-cust_pkg.cgi;h=c3ab6fec36e1d095f145b216ca37b6dc5895c1bb;hb=5985b40c4d8c5cd7b956589edf07b6fa0a4a3dd6;hp=0cc17d36b0554ecae3a40522802f9f5b0f7af671;hpb=f3e0ac2b009c4edd5692cb587ff709dac2223ebe;p=freeside.git diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 0cc17d36b..c3ab6fec3 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -70,6 +70,9 @@ my $quantity = $1 || 1; $cgi->param('refnum') =~ /^(\d*)$/ or die 'illegal refnum '. $cgi->param('refnum'); my $refnum = $1; +$cgi->param('salesnum') =~ /^(\d*)$/ + or die 'illegal salesnum '. $cgi->param('salesnum'); +my $salesnum = $1; $cgi->param('contactnum') =~ /^(\-?\d*)$/ or die 'illegal contactnum '. $cgi->param('contactnum'); my $contactnum = $1; @@ -111,6 +114,7 @@ my %hash = ( ? parse_datetime($cgi->param('start_date')) : '' ), + 'salesnum' => $salesnum, 'refnum' => $refnum, 'contactnum' => $contactnum, 'locationnum' => $locationnum, @@ -129,6 +133,21 @@ my %hash = ( ); $hash{'custnum'} = $cust_main->custnum if $cust_main; +my @cust_pkg_usageprice = (); +foreach my $quantity_param ( grep { $cgi->param($_) && $cgi->param($_) > 0 } + grep /^usagepricenum(\d+)_quantity$/, + $cgi->param + ) +{ + $quantity_param =~ /^usagepricenum(\d+)_quantity$/ or die 'unpossible'; + my $num = $1; + push @cust_pkg_usageprice, new FS::cust_pkg_usageprice { + usagepricepart => scalar($cgi->param("usagepricenum${num}_usagepricepart")), + quantity => scalar($cgi->param($quantity_param)), + }; +} +$hash{cust_pkg_usageprice} = \@cust_pkg_usageprice; + if ( $quotationnum ) { $quotation_pkg = new FS::quotation_pkg \%hash; @@ -155,11 +174,13 @@ if ( $quotationnum ) { } if ( $locationnum == -1 ) { - my $cust_location = FS::cust_location->new_or_existing({ + my $cust_location = FS::cust_location->new({ map { $_ => scalar($cgi->param($_)) } ('custnum', FS::cust_main->location_fields) }); $opt{'cust_location'} = $cust_location; + } else { + $opt{'locationnum'} = $locationnum; } $error = $cust_main->order_pkg( \%opt );