[freeside-commits] branch FREESIDE_4_BRANCH updated. 7b8adf960efd4b48d61f49b3331c11b4d3e8c2d9

Ivan ivan at 420.am
Sun Nov 22 19:44:54 PST 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  7b8adf960efd4b48d61f49b3331c11b4d3e8c2d9 (commit)
       via  812bc7c3fab50cefca3cae5b9430350c5a65a077 (commit)
       via  aa0003cb22bbf10b336856fc3b022bf2ad104b6a (commit)
      from  a1a83e3aa44a09cf7c63d5e21b9937e6fa9b4a17 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7b8adf960efd4b48d61f49b3331c11b4d3e8c2d9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 19:44:53 2015 -0800

    package import w/bulk phone number ranges, RT#39127

diff --git a/FS/FS/cust_pkg/Import.pm b/FS/FS/cust_pkg/Import.pm
index e8c4427..63a9909 100644
--- a/FS/FS/cust_pkg/Import.pm
+++ b/FS/FS/cust_pkg/Import.pm
@@ -211,6 +211,52 @@ sub batch_import {
     push @fields, 'locationnum';
   }
 
+  if ( $format =~ /^bulk_(.*)$/ ) {
+
+    $format = $1;
+
+    $opt->{'postinsert_callback'} = sub {
+      my( $record, $param ) = @_;
+
+      my $formatfields = _formatfields;
+      foreach my $svc_x ( grep /^svc/, keys %$formatfields ) {
+
+        my $ff = $formatfields->{$svc_x};
+
+        if ( grep $param->{"$svc_x.$_"}, @$ff ) {
+
+          $param->{'svc_phone.phonenum'} =~ /^\s*(\d+)\s*\-\s*(\d+)\s*$/
+            or return 'Enter a phone number range, with dash as the separator';
+          my($start, $end) = ($1, $2);
+          if ( length($end) < length($start) ) {
+            $end = substr($start, 0, length($start) - length($end) ). $end;
+          }
+
+          foreach my $phonenum ( "$start" .. "$end" ) {
+
+            my $svc = "FS::$svc_x"->new( {
+              'pkgnum'  => $record->pkgnum,
+              'svcpart' => $record->part_pkg->svcpart($svc_x),
+              map { $_ => $param->{"$svc_x.$_"} } @$ff
+            } );
+
+            $svc->phonenum($phonenum);
+            #$svc->set_default_and_fixed;
+            my $error = $svc->insert;
+            return "error inserting service: $error" if $error;
+
+          }
+
+        }
+
+      }
+
+      return ''; #no error
+
+    };
+
+  }
+
   push @fields, ( 'pkgpart', 'discountnum' );
 
   my @date_fields = ();
diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html
index 8784dbb..9769941 100644
--- a/httemplate/misc/cust_pkg-import.html
+++ b/httemplate/misc/cust_pkg-import.html
@@ -39,6 +39,9 @@ Import a file containing customer packages.
         <OPTION VALUE="svc_phone">Phone service
         <OPTION VALUE="svc_phone-agent_custid">Phone service with agent_custid
         <OPTION VALUE="svc_phone-locationnum">Phone service with existing location
+        <OPTION VALUE="bulk_svc_phone">Bulk phone service
+        <OPTION VALUE="bulk_svc_phone-agent_custid">Bulk phone service with agent_custid
+        <OPTION VALUE="bulk_svc_phone-locationnum">Bulk phone service with existing location
         <OPTION VALUE="svc_external">External service
         <OPTION VALUE="svc_external-agent_custid">External service with agent_custid
         <OPTION VALUE="svc_external-locationnum">External service with existing location
@@ -108,6 +111,15 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets.
 <b>Phone sevice with existing location</b> format has the following field order: <i>custnum<%$req%>, locationnum, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, phonenum, sip_password, pin</i>
 <BR><BR>
 
+<b>Bulk phone sevice</b> format has the following field order: <i>custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, start_phonenum-end_phonenum, sip_password, pin</i>
+<BR><BR>
+
+<b>Bulk phone service with 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, countrycode, start_phonenum-end_phonenum, sip_password, pin</i>
+<BR><BR>
+
+<b>Bulk phone sevice with existing location</b> format has the following field order: <i>custnum<%$req%>, locationnum, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, start_phonenum-end_phonenum, sip_password, pin</i>
+<BR><BR>
+
 <b>External sevice</b> format has the following field order: <i>custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, id, title</i>
 <BR><BR>
 

commit 812bc7c3fab50cefca3cae5b9430350c5a65a077
Merge: aa0003c a1a83e3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 18:55:17 2015 -0800

    Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_4_BRANCH


commit aa0003cb22bbf10b336856fc3b022bf2ad104b6a
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Nov 19 11:25:38 2015 -0800

    remove old cruft

diff --git a/bin/pod2x b/bin/pod2x
index 482479e..144614e 100755
--- a/bin/pod2x
+++ b/bin/pod2x
@@ -6,8 +6,6 @@ my $mw_username = 'ivan';
 chomp( my $mw_password = `cat .mw-password` );
 
 my $site_perl = "./FS";
-#my $html = "Freeside:1.7:Documentation:Developer";
-#my $html = "Freeside:1.9:Documentation:Developer";
 my $html = "Freeside:4:Documentation:Developer";
 
 foreach my $dir (

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_pkg/Import.pm             |   46 ++++++++++++++++++++++++++++++++++
 bin/pod2x                            |    2 --
 httemplate/misc/cust_pkg-import.html |   12 +++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list