diff options
| author | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-11 00:10:13 -0600 | 
|---|---|---|
| committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-11 16:15:46 -0600 | 
| commit | 1ce2f035cac19edbbe1b31a20e954cd97e40da20 (patch) | |
| tree | ee14a952c49ff854d0b089c99f8c575e2f2bb984 /httemplate/edit/process | |
| parent | 92715a9e433226b32150964e7b7fe0cdf3d1bddb (diff) | |
RT#40806: Enter invoice details from order package page
Diffstat (limited to 'httemplate/edit/process')
| -rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 29 | 
1 files changed, 28 insertions, 1 deletions
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 60352154a..5afddde15 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -159,14 +159,38 @@ foreach my $quantity_param ( grep { $cgi->param($_) && $cgi->param($_) > 0 }  }  $hash{cust_pkg_usageprice} = \@cust_pkg_usageprice; +# extract details (false laziness with /misc/order_pkg.html) +my $details = { +  'invoice_detail' => [], +  'package_comment' => [], +  'quotation_detail' => [], +}; +foreach my $field ( $cgi->param ) { +  foreach my $detailtype ( keys %$details ) { +    if ($field =~ /^$detailtype(\d+)$/) { +      $details->{$detailtype}->[$1] = $cgi->param($field); +    } +  } +} +foreach my $detailtype ( keys %$details ) { +  @{ $details->{$detailtype} } = grep { length($_) } @{ $details->{$detailtype} }; +} +  if ( $quotationnum ) {    $quotation_pkg = new FS::quotation_pkg \%hash;    $quotation_pkg->quotationnum($quotationnum);    $quotation_pkg->prospectnum($prospect_main->prospectnum) if $prospect_main; +  my %opt = @{ $details->{'quotation_detail'} } +  ? ( +    quotation_details => $details->{'quotation_detail'}, +    copy_on_order     => scalar($cgi->param('copy_on_order')) ? 'Y' : '', +  ) +  : (); +    #XXX handle new location -  $error = $quotation_pkg->insert; +  $error = $quotation_pkg->insert(%opt);  } else { @@ -194,6 +218,9 @@ if ( $quotationnum ) {      $opt{'locationnum'} = $locationnum;    } +  $opt{'invoice_details'} = $details->{'invoice_detail'} if @{ $details->{'invoice_detail'} }; +  $opt{'package_comments'} = $details->{'package_comment'} if @{ $details->{'package_comment'} }; +    $error = $cust_main->order_pkg( \%opt );  }  | 
