added invoice details to package import, RT#76992
authorIvan Kohler <ivan@freeside.biz>
Mon, 25 Sep 2017 22:17:20 +0000 (15:17 -0700)
committerIvan Kohler <ivan@freeside.biz>
Mon, 25 Sep 2017 22:17:20 +0000 (15:17 -0700)
FS/FS/cust_pkg/Import.pm
httemplate/misc/cust_pkg-import.html

index 2467e6f..3cf38cd 100644 (file)
@@ -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 ) {
 
index 49201c5..0c3d31d 100644 (file)
@@ -156,7 +156,7 @@ address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country<%$
 <b>Location, quantity and price customizations with phone service</b> format has the following field order: <i>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
 </i>
@@ -165,7 +165,7 @@ countrycode, phonenum, sip_password, pin
 <b>Location, quantity and price customizations with phone service and agent_custid</b> format has the following field order: <i>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
 </i>
@@ -174,7 +174,7 @@ countrycode, phonenum, sip_password, pin
 <b>Location, quantity and price customizations with phone service and agent_custid and agent_pkgid</b> format has the following field order: <i>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
 </i>
@@ -213,6 +213,14 @@ Field information:
 
   <li><i>expire</i>: Indicates a future cancellation on this date.
 
+  <li><i>quantity</i>
+
+  <li><i>setup_fee</i>: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing
+
+  <li><i>recur_fee</i>: Including this fee implements per-customer custom pricing for this package, overriding package definition pricing
+
+  <li><i>invoice_details</i>: Package invoice details (optionally, can include multiple lines of details separated by a newline)
+
 <!--
   <li><i>username</i> and <i>_password</i> are required if <i>pkgpart</i> is specified. (Extended and Extended plus company formats)
 -->