From 9ab5259d95fafee083cd377b03f4ffdc37bd137a Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 9 Nov 2010 02:51:50 +0000 Subject: [PATCH] add phone number search report, RT10464 --- httemplate/elements/menu.html | 4 +- httemplate/search/phone_avail.html | 37 +++++++++++-- httemplate/search/report_phone_avail.html | 92 +++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 6 deletions(-) create mode 100755 httemplate/search/report_phone_avail.html diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1909d909d..19cd2d8d1 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -191,8 +191,8 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) { } if ( $svcdb eq 'svc_phone' ) { - $report_svc{"Avaialble phone numbers (DIDs)"} = - [ $fsurl."search/phone_avail.html", '' ]; + $report_svc{"Phone number (DID) availability"} = + [ $fsurl."search/report_phone_avail.html", '' ]; } $report_services{$name} = [ \%report_svc, $longname ]; diff --git a/httemplate/search/phone_avail.html b/httemplate/search/phone_avail.html index 2388d25ff..2ef3dcd8c 100644 --- a/httemplate/search/phone_avail.html +++ b/httemplate/search/phone_avail.html @@ -16,6 +16,8 @@ 'header' => [ '#', 'State', 'Phone Number', + 'Rate Center', + 'Batch', 'Export', 'Service', FS::UI::Web::cust_header(), @@ -27,15 +29,19 @@ '+'. $pn->countrycode. ' '. $pn->npa. ' '. $pn->nxx. '-'. $pn->station; }, + 'name', + 'availbatch', 'exportnum', #XXX #sub { }, 'svcnum', #XXX \&FS::UI::Web::cust_fields, ], - 'align' => 'rllll'.FS::UI::Web::cust_aligns(), + 'align' => 'rllllll'.FS::UI::Web::cust_aligns(), 'links' => [ '', '', + '', + '', '', '', #XXX #$export_link '', #XXX #$svc_link @@ -46,6 +52,8 @@ 'color' => [ '', '', + '', + '', '', '', '', @@ -54,6 +62,8 @@ 'style' => [ '', '', + '', + '', '', '', '', @@ -68,9 +78,28 @@ die "access denied" my @search = (); -if ( $cgi->param('availbatch') =~ /^([\w\/\:\-\.]+)$/ ) { - push @search, "availbatch = '$1'"; -} +push @search, "availbatch = '$1'" + if ( $cgi->param('availbatch') =~ /^([\w\d \/\:\-\.]+)$/ ); + +push @search, "countrycode = '$1'" + if ( $cgi->param('countrycode') =~ /^(\d{1,3})$/ ); + +push @search, "phone_avail.state = '$1'" + if ( $cgi->param('state') =~ /^(\w{2})$/ ); + +# i know that the regexps match more than NPA/NXX, but this is good enough now +push @search, "npa = '$1'" + if ( $cgi->param('npa') =~ /^(\d{3})$/ ); +push @search, "nxx = '$1'" + if ( $cgi->param('npa') =~ /^\d{3}$/ && $cgi->param('nxx') =~ /^(\d{3})$/ ); + +push @search, "name = '$1'" + if ( $cgi->param('ratecenter') =~ /^([\w \-\.]+)$/ ); + +push @search, "svcnum is null" + if ( $cgi->param('avail_status') eq 'AVAIL' ); +push @search, "svcnum is not null" + if ( $cgi->param('avail_status') eq 'UNAVAIL' ); # #here is the agent virtualization # push @search, $FS::CurrentUser::CurrentUser->agentnums_sql; diff --git a/httemplate/search/report_phone_avail.html b/httemplate/search/report_phone_avail.html new file mode 100755 index 000000000..c81206afc --- /dev/null +++ b/httemplate/search/report_phone_avail.html @@ -0,0 +1,92 @@ +<% include('/elements/header.html', 'Phone number (DID) Availability Report' ) %> + +
+ + + + + + + + <% include( '/elements/tr-input-text.html', + 'id' => 'countrycode', + 'field' => 'countrycode', + 'label' => 'Country Code', + 'maxlength' => 3, + 'size' => 3, + ) + %> + + <% include( '/elements/tr-input-text.html', + 'id' => 'state', + 'field' => 'state', + 'label' => 'State', + 'maxlength' => 2, + 'size' => 2, + ) + %> + + <% include( '/elements/tr-input-text.html', + 'id' => 'npa', + 'field' => 'npa', + 'label' => 'NPA', + 'maxlength' => 3, + 'size' => 3, + ) + %> + + <% include( '/elements/tr-input-text.html', + 'id' => 'nxx', + 'field' => 'nxx', + 'label' => 'NXX', + 'maxlength' => 3, + 'size' => 3, + ) + %> + + <% include( '/elements/tr-input-text.html', + 'id' => 'ratecenter', + 'field' => 'ratecenter', + 'label' => 'Rate Center', + 'size' => 80, + ) + %> + + + <% include( '/elements/tr-input-text.html', + 'id' => 'availbatch', + 'field' => 'availbatch', + 'label' => 'Batch Name', + 'size' => 80, + ) + %> + + + + + + + +
Search options
Status + Available & Unavailable + Numbers + Available Numbers Only + Unavailable Numbers Only +
+ +
+ + +
+ +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless ( $FS::CurrentUser::CurrentUser->access_right('List customers') && + $FS::CurrentUser::CurrentUser->access_right('List packages') + ); + +my $conf = new FS::Conf; + + -- 2.11.0