[freeside-commits] branch FREESIDE_3_BRANCH updated. 17b113019aee969742c3b6de47f36d785931bc91

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


The branch, FREESIDE_3_BRANCH has been updated
       via  17b113019aee969742c3b6de47f36d785931bc91 (commit)
       via  5bc19ba554e29029e7963e40012e43432892306b (commit)
       via  d69b5b413b9da6087a37d45aa06f4ea74f1fba35 (commit)
      from  2e1e59ea99e9672310b59f57cfade4626c33190f (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 17b113019aee969742c3b6de47f36d785931bc91
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 19:44:54 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 dfe62fb..26f62f2 100644
--- a/FS/FS/cust_pkg/Import.pm
+++ b/FS/FS/cust_pkg/Import.pm
@@ -214,6 +214,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 5bc19ba554e29029e7963e40012e43432892306b
Merge: d69b5b4 2e1e59e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 19:44:43 2015 -0800

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


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

    remove old cruft

diff --git a/bin/pod2x b/bin/pod2x
index 1ec998f..91f2fba 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:3: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