[freeside-commits] branch master updated. 155cb2a71481bdcaad6fd66bbe9d804c64d7c29d

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


The branch, master has been updated
       via  155cb2a71481bdcaad6fd66bbe9d804c64d7c29d (commit)
       via  c20f301dd7c437a0d8be414a174dd09721bd8e9a (commit)
       via  76f5eb6da76cf9444a5cfee13d6f5d7fd7e0315f (commit)
       via  0b2ab6dd7c1da1890077a3ebc1a62510112e68a1 (commit)
      from  45d0f6c6325fb8ab5fdc478a7dc278872defa479 (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 155cb2a71481bdcaad6fd66bbe9d804c64d7c29d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 19:44:51 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 c20f301dd7c437a0d8be414a174dd09721bd8e9a
Merge: 76f5eb6 45d0f6c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 19:44:48 2015 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 76f5eb6da76cf9444a5cfee13d6f5d7fd7e0315f
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 22 18:55:35 2015 -0800

    deny remote access to elements/*html, RT#23357

diff --git a/htetc/freeside-base2.4.conf b/htetc/freeside-base2.4.conf
index 3396340..c6b1fd7 100644
--- a/htetc/freeside-base2.4.conf
+++ b/htetc/freeside-base2.4.conf
@@ -63,6 +63,11 @@ PerlSetVar FreesideHttpOnly 1
     <Files "freeside.css">
         Satisfy any
     </Files>
+
+    <Files ~ "(\.html)$">
+        Deny from all
+        SetHandler None
+    </Files>
 </Directory>
 
 <Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/Helpers/>

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

    master is v5

diff --git a/bin/pod2x b/bin/pod2x
index 1ec998f..64ccf88 100755
--- a/bin/pod2x
+++ b/bin/pod2x
@@ -6,9 +6,7 @@ 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";
+my $html = "Freeside:5:Documentation:Developer";
 
 foreach my $dir (
   $html,

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

Summary of changes:
 FS/FS/cust_pkg/Import.pm             |   46 ++++++++++++++++++++++++++++++++++
 bin/pod2x                            |    4 +--
 htetc/freeside-base2.4.conf          |    5 ++++
 httemplate/misc/cust_pkg-import.html |   12 +++++++++
 4 files changed, 64 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list