[freeside-commits] branch FREESIDE_3_BRANCH updated. 40f2c04772472b966eb9bbc7ea4ebc20269698b7
Ivan
ivan at 420.am
Fri Dec 12 20:58:16 PST 2014
The branch, FREESIDE_3_BRANCH has been updated
via 40f2c04772472b966eb9bbc7ea4ebc20269698b7 (commit)
from 52bea6aecfcc8274fd852f626a0f751e1b5bd6a8 (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 40f2c04772472b966eb9bbc7ea4ebc20269698b7
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Dec 12 20:56:22 2014 -0800
simple bulk provisioning of phone number ranges, RT#29800
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4b6b4b2..9f00184 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4957,8 +4957,15 @@ and customer address. Include units.',
},
{
+ 'key' => 'svc_phone-bulk_provision_simple',
+ 'section' => 'telephony',
+ 'description' => 'Bulk provision phone numbers with a simple number range instead of from DID vendor orders',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'default_phone_countrycode',
- 'section' => '',
+ 'section' => 'telephony',
'description' => 'Default countrycode',
'type' => 'text',
},
diff --git a/httemplate/edit/bulk-svc_phone.html b/httemplate/edit/bulk-svc_phone.html
new file mode 100644
index 0000000..fb71836
--- /dev/null
+++ b/httemplate/edit/bulk-svc_phone.html
@@ -0,0 +1,52 @@
+<& /elements/header.html, mt('Bulk add [_1]',$svc) &>
+
+<& /elements/error.html &>
+
+% if ( $cust_main ) {
+
+ <& /elements/small_custview.html, $cust_main, '', 1,
+ popurl(2) . "view/cust_main.cgi" &>
+ <BR>
+% }
+
+<FORM NAME="OneTrueForm" ACTION="<% popurl(1) %>process/bulk-svc_phone.html" METHOD=POST>
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
+<INPUT TYPE="hidden" NAME="num_avail" VALUE="<% scalar($cgi->param('num_avail')) |h %>">
+
+<% ntable("#cccccc",2) %>
+
+<TR>
+ <TD ALIGN="right"><% mt('Phone number range') |h %></TD>
+ <TD><INPUT TYPE="text" NAME="phonenum" VALUE=""></TD>
+</TR>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Submit">
+
+</FORM>
+
+<& /elements/footer.html &>
+
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Bulk provision customer service');
+
+$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
+my $pkgnum = $1;
+my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum })
+ or die 'unknown pkgnum';
+my $cust_main = $cust_pkg->cust_main;
+
+$cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
+my $svcpart = $1;
+
+my $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
+die "No part_svc entry!" unless $part_svc;
+
+my $svc = $part_svc->getfield('svc');
+
+</%init>
diff --git a/httemplate/edit/process/bulk-svc_phone.html b/httemplate/edit/process/bulk-svc_phone.html
new file mode 100644
index 0000000..5a1fbc6
--- /dev/null
+++ b/httemplate/edit/process/bulk-svc_phone.html
@@ -0,0 +1,41 @@
+<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum;show=packages#cust_pkg$pkgnum") %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Bulk provision customer service');
+
+$cgi->param('phonenum') =~ /^\s*(\d+)\s*\-\s*(\d+)\s*$/
+ or errorpage('Enter a phone number range, with dash as the separator');
+my($start, $end) = ($1, $2);
+
+$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
+my $pkgnum = $1;
+my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum })
+ or die 'unknown pkgnum';
+my $custnum = $cust_pkg->custnum;
+
+if ( length($end) < length($start) ) {
+ $end = substr($start, 0, length($start) - length($end) ). $end;
+}
+
+errorpage("$end is smaller than $start") if $end < $start;
+
+$cgi->param('num_avail') =~ /^(\d+)$/ or die 'illegal num_avail';
+my $num_avail = $1;
+errorpage("There are only $num_avail available")
+ if $end - $start + 1 > $num_avail;
+
+foreach my $phonenum ( $start .. $end ) {
+
+ my $svc_phone = new FS::svc_phone {
+ 'phonenum' => $phonenum,
+ 'pkgnum' => $pkgnum,
+ 'svcpart' => scalar($cgi->param('svcpart')),
+ };
+ $svc_phone->set_default_and_fixed;
+
+ my $error = $svc_phone->insert;
+ errorpage($error) if $error;
+}
+
+</%init>
diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html
index 217e8c5..e888c94 100755
--- a/httemplate/view/cust_main/packages/section.html
+++ b/httemplate/view/cust_main/packages/section.html
@@ -128,6 +128,7 @@ my %conf_opt = (
#for services.html
'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'),
+ 'svc_phone-bulk_provision_simple' => $conf->exists('svc_phone-bulk_provision_simple'),
'legacy_link' => $conf->exists('legacy_link'),
'manage_link' => scalar($conf->config('svc_broadband-manage_link')),
'manage_link_text' => scalar($conf->config('svc_broadband-manage_link_text')),
diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html
index bb676e8..5fe41a3 100644
--- a/httemplate/view/cust_main/packages/services.html
+++ b/httemplate/view/cust_main/packages/services.html
@@ -93,6 +93,8 @@ function clearhint_search_cust_svc(obj, str) {
% {
% if ( $part_svc->num_avail > 5 ) {
% local $opt{'bulk'} = 1;
+% local $opt{'svc_phone_bulk_provision_simple'} = $svc_phone_bulk_provision_simple;
+% local $opt{'num_avail'} = $part_svc->num_avail;
<BR><% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
% }
% #XXX if there's orders for this customer {
@@ -116,6 +118,8 @@ my %opt = @_;
my $bgcolor = $opt{'bgcolor'};
my $cust_pkg = $opt{'cust_pkg'};
my $part_pkg = $opt{'part_pkg'};
+my $svc_phone_bulk_provision_simple = $opt{'svc_phone-bulk_provision_simple'};
+
my $curuser = $FS::CurrentUser::CurrentUser;
sub svc_provision_link {
@@ -133,6 +137,12 @@ sub svc_provision_link {
&& $opt->{'svc_external-skip_manual'}
) {
$url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$query";
+ } elsif ( $part_svc->svcdb eq 'svc_phone' && $opt->{bulk}
+ && $opt->{svc_phone_bulk_provision_simple}
+ )
+ {
+ $query .= ';num_avail='. $opt->{num_avail};
+ $url = "${p}edit/bulk-svc_phone.html?$query";
} else {
$url = svc_url(
'm' => $m,
@@ -146,14 +156,17 @@ sub svc_provision_link {
my $link = qq!<A CLASS="provision" HREF="$url">!.
emt("$action [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
+
if ( $opt->{'legacy_link'}
&& $curuser->access_right('View/link unlinked services')
+ && ! $opt{bulk}
)
{
$link .= '<BR>'.
qq!<A CLASS="provision" HREF="${p}misc/link.cgi?$query">!.
emt("Link to legacy [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
}
+
$link;
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 9 +++-
httemplate/edit/bulk-svc_phone.html | 52 ++++++++++++++++++++++
httemplate/edit/process/bulk-svc_phone.html | 41 +++++++++++++++++
httemplate/view/cust_main/packages/section.html | 1 +
httemplate/view/cust_main/packages/services.html | 13 ++++++
5 files changed, 115 insertions(+), 1 deletion(-)
create mode 100644 httemplate/edit/bulk-svc_phone.html
create mode 100644 httemplate/edit/process/bulk-svc_phone.html
More information about the freeside-commits
mailing list