[freeside-commits] branch FREESIDE_2_3_BRANCH updated. f38a68a13de191bc9fe41975c9ea8c84cafb6209

Ivan ivan at 420.am
Fri Feb 1 02:53:25 PST 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  f38a68a13de191bc9fe41975c9ea8c84cafb6209 (commit)
       via  4579f948711e183ce94667d2e956032c2e913716 (commit)
      from  b0a937058e0b5834a4413996f482a43ca1a74576 (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 f38a68a13de191bc9fe41975c9ea8c84cafb6209
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Feb 1 02:53:17 2013 -0800

    add advanced phone number search, RT#21054

diff --git a/httemplate/search/report_svc_phone.html b/httemplate/search/report_svc_phone.html
index 9f10426..63ca03e 100644
--- a/httemplate/search/report_svc_phone.html
+++ b/httemplate/search/report_svc_phone.html
@@ -1,32 +1,6 @@
-<% include('/elements/header.html', 'Phone number total usage' ) %>
+<& elements/report_svc_Common.html,
+     'table'   => 'svc_phone',
+     'title'   => 'Phone number report',
 
-<FORM ACTION="svc_phone.cgi" METHOD="GET">
-
-<INPUT TYPE="hidden" NAME="magic"       VALUE="all">
-<INPUT TYPE="hidden" NAME="usage_total" VALUE="1">
-
-<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
-
-%#  <TR>
-%#    <TH CLASS="background" COLSPAN=2 ALIGN="left">
-%#     <FONT SIZE="+1">Search options</FONT>
-%#    </TH>
-%#  </TR>
-
-  <% include ( '/elements/tr-input-beginning_ending.html', prefix=>'usage' ) %>
-
-</TABLE>
-
-<BR>
-<INPUT TYPE="submit" VALUE="Search phone numbers">
-
-</FORM>
-
-<% include('/elements/footer.html') %>
-<%init>
-
-#? 'List services' ?  something new?
-die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
-
-</%init>
+     'action'  => 'svc_phone.cgi',
+&>

commit 4579f948711e183ce94667d2e956032c2e913716
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Feb 1 02:52:19 2013 -0800

    add advanced phone number search, RT#21054

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 9bd3fd3..6967179 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -293,6 +293,7 @@ tie my %rights, 'Tie::IxHash',
     'Services: Hardware',
     'Services: Hardware: Advanced search',
     'Services: Phone numbers',
+    'Services: Phone numbers: Advanced search',
     'Services: PBXs',
     'Services: Ports',
     'Services: Mailing lists',
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 32050a7..3562ae2 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -213,6 +213,7 @@ sub _upgrade_data { # class method
     'Services: Accounts' => 'Services: Accounts: Advanced search',
     'Services: Wireless broadband services' => 'Services: Wireless broadband services: Advanced search',
     'Services: Hardware' => 'Services: Hardware: Advanced search',
+    'Services: Phone numbers' => 'Services: Phone numbers: Advanced search',
 
     'List rating data' => [ 'Usage: RADIUS sessions',
                             'Usage: Call Detail Records (CDRs)',
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index afe52fc..e30c52c 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -189,7 +189,7 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) {
   } elsif ( $svcdb eq 'svc_phone' ) {
 
     $report_svc{"${name}' total usage by time period"} = 
-      [ $fsurl. 'search/report_svc_phone.html',
+      [ $fsurl. 'search/report_svc_phone_usage.html',
         'Total usage (minutes, and amount billed) for the specified time period, per phone number.',
       ];
 
@@ -204,7 +204,7 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) {
 
     $report_svc{"Advanced $lcsname reports"} = 
         [ $fsurl."search/report_$svcdb.html", '' ]
-      if $svcdb =~ /^svc_(acct|broadband|hardware)$/
+      if $svcdb =~ /^svc_(acct|broadband|hardware|phone)$/
       && $curuser->access_right("Services: $name: Advanced search");
 
   if ( $svcdb eq 'svc_phone' ) {
@@ -563,7 +563,7 @@ $config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Whe
   || $curuser->access_right('Edit global advertising sources');
 if ( $curuser->access_right('Configuration') ) {
   $config_misc{'Virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ];
-  $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.html', 'Change error messages and other customizable labels for each locale' ];
+  $config_misc{'Translation strings'} = [ $fsurl.'browse/msgcat.html', 'Translations and other customizable labels for each locale' ];
 }
 $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]
   if $curuser->access_right('Edit inventory')
diff --git a/httemplate/elements/select-part_svc.html b/httemplate/elements/select-part_svc.html
index 72ab7f6..743b285 100644
--- a/httemplate/elements/select-part_svc.html
+++ b/httemplate/elements/select-part_svc.html
@@ -13,6 +13,9 @@ my( %opt ) = @_;
 $opt{'records'} = delete $opt{'part_svc'}
   if $opt{'part_svc'};
 
-$opt{'records'} ||= [ qsearch( 'part_svc', {} ) ]; # { disabled=>'' } )
+my %hash = ();
+$hash{'svcdb'} = $opt{'svcdb'} if $opt{'svcdb'};
+
+$opt{'records'} ||= [ qsearch( 'part_svc', \%hash ) ]; # { disabled=>'' } )
 
 </%init>
diff --git a/httemplate/elements/tr-select-part_svc.html b/httemplate/elements/tr-select-part_svc.html
index af51487..9d45080 100644
--- a/httemplate/elements/tr-select-part_svc.html
+++ b/httemplate/elements/tr-select-part_svc.html
@@ -21,6 +21,9 @@
 
 my( %opt ) = @_;
 
-$opt{'part_svc'} ||= [ qsearch( 'part_svc', {} ) ]; # { disabled=>'' } )
+my %hash = ();
+$hash{'svcdb'} = $opt{'svcdb'} if $opt{'svcdb'};
+
+$opt{'part_svc'} ||= [ qsearch( 'part_svc', \%hash ) ]; # { disabled=>'' } )
 
 </%init>
diff --git a/httemplate/search/elements/report_svc_Common.html b/httemplate/search/elements/report_svc_Common.html
new file mode 100644
index 0000000..04feb9e
--- /dev/null
+++ b/httemplate/search/elements/report_svc_Common.html
@@ -0,0 +1,94 @@
+<%doc>
+
+Example:
+
+  <& elements/report_svc_Common.html,
+
+    #required
+    'table' => 'svc_something',
+    'title'  => 'Page title',
+
+    #optional
+    'action' => 'svc_tablename.html', #defaults to svc_tablename.html
+
+  &>
+
+</%doc>
+<& /elements/header.html, $title &>
+
+<FORM ACTION="<% $opt{'action'} || $opt{'table'}. '.html' %>" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
+
+  <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+    <TR>
+      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Search options') |h %></FONT></TH>
+    </TR>
+
+% unless ( $custnum ) {
+    <& /elements/tr-select-agent.html,
+                   'curr_value'    => scalar( $cgi->param('agentnum') ),
+                   'disable_empty' => 0,
+    &>
+
+%   # just this customer's domains?
+%#    <& /elements/tr-select-domain.html,
+%#                   'element_name'  => 'domsvc',
+%#                   'curr_value'    => scalar( $cgi->param('domsvc') ),
+%#                   'disable_empty' => 0,
+%#    &>
+% }
+
+    <& /elements/tr-selectmultiple-part_pkg.html &> 
+
+    <& /elements/tr-select-part_svc.html, 'svcdb'=>$svcdb &> 
+
+    <TR>
+      <TH CLASS="background" COLSPAN=2> </TH>
+    </TR>
+ 
+    <TR>
+      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
+    </TR>
+
+%   #"package fields" ala advanced svc_acct search?
+%   #move to /elements/tr-select-cust_pkg-fields and use it from there if so...
+
+    <& /elements/tr-select-cust-fields.html &>
+                       
+  </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
+
+</FORM>
+
+<& /elements/footer.html &>
+<%init>
+
+my(%opt) = @_;
+
+my $svcdb = $opt{'table'};
+
+my $name =        "FS::$svcdb"->table_info->{'name_plural'}
+           || PL( "FS::$svcdb"->table_info->{'name'}        );
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right("Services: $name: Advanced search");
+
+my $title = $opt{'title'};
+
+#false laziness w/report_cust_pkg.html
+my $custnum = '';
+if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+  $custnum = $1;
+  my $cust_main = qsearchs({
+    'table'     => 'cust_main', 
+    'hashref'   => { 'custnum' => $custnum },
+    'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+  }) or die "unknown custnum $custnum";
+  $title = mt("$title: [_1]", $cust_main->name);
+}
+
+</%init>
diff --git a/httemplate/search/report_svc_phone_usage.html b/httemplate/search/report_svc_phone_usage.html
new file mode 100644
index 0000000..9f10426
--- /dev/null
+++ b/httemplate/search/report_svc_phone_usage.html
@@ -0,0 +1,32 @@
+<% include('/elements/header.html', 'Phone number total usage' ) %>
+
+<FORM ACTION="svc_phone.cgi" METHOD="GET">
+
+<INPUT TYPE="hidden" NAME="magic"       VALUE="all">
+<INPUT TYPE="hidden" NAME="usage_total" VALUE="1">
+
+<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+%#  <TR>
+%#    <TH CLASS="background" COLSPAN=2 ALIGN="left">
+%#     <FONT SIZE="+1">Search options</FONT>
+%#    </TH>
+%#  </TR>
+
+  <% include ( '/elements/tr-input-beginning_ending.html', prefix=>'usage' ) %>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Search phone numbers">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+#? 'List services' ?  something new?
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
+
+</%init>
diff --git a/httemplate/search/svc_phone.cgi b/httemplate/search/svc_phone.cgi
index 2943408..7fadbbb 100644
--- a/httemplate/search/svc_phone.cgi
+++ b/httemplate/search/svc_phone.cgi
@@ -9,7 +9,7 @@
                                           'Country code',
                                           'Phone number',
                                           @header,
-                                          FS::UI::Web::cust_header(),
+                                          FS::UI::Web::cust_header($cgi->param('cust_fields')),
                                         ],
                  'fields'            => [ 'svcnum',
                                           'svc',
@@ -24,7 +24,7 @@
                                           $link,
                                           ( map '', @header ),
                                           ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
-                                                FS::UI::Web::cust_header()
+                                                FS::UI::Web::cust_header($cgi->param('cust_fields'))
                                           ),
                                         ],
                  'align' => 'rlrr'.
@@ -119,6 +119,24 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
 
   }
 
+} elsif ( $cgi->param('magic') =~ /^advanced$/ ) {
+
+  if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+    push @extra_sql, "agentnum = $1";
+  }
+
+  my $pkgpart = [ grep /^(\d+)$/, $cgi->param('pkgpart') ];
+  if ( @$pkgpart ) {
+    push @extra_sql,
+      'cust_pkg.pkgpart IN ('. join(',', @$pkgpart ). ')';
+  }
+  
+  my $svcpart = [ grep /^(\d+)$/, $cgi->param('svcpart') ];
+  if ( @$svcpart ) {
+    push @extra_sql,
+      'svcpart IN ('. join(',', @$svcpart ). ')';
+  }
+
 } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
   push @extra_sql, "svcpart = $1";
 } else {

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

Summary of changes:
 FS/FS/AccessRight.pm                               |    1 +
 FS/FS/access_right.pm                              |    1 +
 httemplate/elements/menu.html                      |    6 +-
 httemplate/elements/select-part_svc.html           |    5 +-
 httemplate/elements/tr-select-part_svc.html        |    5 +-
 httemplate/search/elements/report_svc_Common.html  |   94 ++++++++++++++++++++
 httemplate/search/report_svc_phone.html            |   36 +-------
 ..._svc_phone.html => report_svc_phone_usage.html} |    0
 httemplate/search/svc_phone.cgi                    |   22 ++++-
 9 files changed, 132 insertions(+), 38 deletions(-)
 create mode 100644 httemplate/search/elements/report_svc_Common.html
 copy httemplate/search/{report_svc_phone.html => report_svc_phone_usage.html} (100%)




More information about the freeside-commits mailing list