From: Ivan Kohler Date: Mon, 25 Sep 2017 22:17:20 +0000 (-0700) Subject: added invoice details to package import, RT#76992 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=ac58d397dab0e70684682775036cd73d23c4213e;hp=c6d8896d882b684b1f3c7a2538a90358b27aaf89 added invoice details to package import, RT#76992 --- diff --git a/FS/FS/cust_pkg/Import.pm b/FS/FS/cust_pkg/Import.pm index 2467e6fde..3cf38cd41 100644 --- a/FS/FS/cust_pkg/Import.pm +++ b/FS/FS/cust_pkg/Import.pm @@ -105,7 +105,7 @@ my %formatfields = ( 'svc_phone' => [qw( countrycode phonenum sip_password pin )], 'svc_external' => [qw( id title )], 'location' => [qw( address1 address2 city state zip country )], - 'quan_price' => [qw( quantity setup_fee recur_fee )], + 'quan_price' => [qw( quantity setup_fee recur_fee invoice_details )], ); sub _formatfields { @@ -162,6 +162,25 @@ warn join('-', @location_params); 'postinsert_callback' => sub { my( $record, $param ) = @_; + if ( $param->{'quan_price.invoice_details'} ) { + + my $weight = 0; + foreach my $detail (split(/\|/, $param->{'quan_price.invoice_details'})) { + + my $cust_pkg_detail = new FS::cust_pkg_detail { + 'pkgnum' => $record->pkgnum, + 'detail' => $detail, + 'detailtype' => 'I', + 'weight' => $weight++, + }; + + my $error = $cust_pkg_detail->insert; + return "error inserting invoice detail: $error" if $error; + + } + + } + my $formatfields = _formatfields; foreach my $svc_x ( grep /^svc/, keys %$formatfields ) { diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html index 49201c502..0c3d31d04 100644 --- a/httemplate/misc/cust_pkg-import.html +++ b/httemplate/misc/cust_pkg-import.html @@ -156,7 +156,7 @@ address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country<%$ Location, quantity and price customizations with phone service format has the following field order: custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, -quantity, setup_fee, recur_fee, +quantity, setup_fee, recur_fee, invoice_details, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country<%$req%>, countrycode, phonenum, sip_password, pin @@ -165,7 +165,7 @@ countrycode, phonenum, sip_password, pin Location, quantity and price customizations with phone service and agent_custid format has the following field order: agent_custid<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, -quantity, setup_fee, recur_fee, +quantity, setup_fee, recur_fee, invoice_details, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country<%$req%>, countrycode, phonenum, sip_password, pin @@ -174,7 +174,7 @@ countrycode, phonenum, sip_password, pin Location, quantity and price customizations with phone service and agent_custid and agent_pkgid format has the following field order: agent_custid<%$req%>, agent_pkgid, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, -quantity, setup_fee, recur_fee, +quantity, setup_fee, recur_fee, invoice_details, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country<%$req%>, countrycode, phonenum, sip_password, pin @@ -213,6 +213,14 @@ Field information:
  • expire: Indicates a future cancellation on this date. +
  • quantity + +
  • setup_fee: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing + +
  • recur_fee: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing + +
  • invoice_details: Package invoice details (optionally, can include multiple lines of details separated by a newline) +