diff options
Diffstat (limited to 'httemplate/search')
-rw-r--r-- | httemplate/search/cdr.html | 33 | ||||
-rw-r--r-- | httemplate/search/cust_bill_pkg.cgi | 21 | ||||
-rwxr-xr-x | httemplate/search/cust_main.cgi | 4 | ||||
-rwxr-xr-x | httemplate/search/cust_main.html | 8 | ||||
-rwxr-xr-x | httemplate/search/cust_pay_pending.html | 2 | ||||
-rwxr-xr-x | httemplate/search/cust_pkg.cgi | 5 | ||||
-rw-r--r-- | httemplate/search/cust_pkg_svc.html | 117 | ||||
-rw-r--r-- | httemplate/search/report_cdr.html | 84 | ||||
-rwxr-xr-x | httemplate/search/report_cust_main.html | 22 | ||||
-rwxr-xr-x | httemplate/search/report_cust_pkg.html | 3 | ||||
-rwxr-xr-x | httemplate/search/svc_acct.cgi | 6 |
11 files changed, 37 insertions, 268 deletions
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index 5544ff58c..702dc1bcc 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -147,7 +147,7 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) { } ### -# src/dest/charged_party/svcnum +# src/dest/charged_party ### my $phonenum = qr/^\s*([\d\-\+\ ]+)\s*$/; @@ -175,32 +175,27 @@ if ( $cgi->param('dcontext') =~ /^\s*(.+)\s*$/ ) { push @search, "dcontext = '$dcontext'"; } -if ( $cgi->param('charged_party') ) { +if ( $cgi->param('charged_party') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; + #$hashref->{'charged_party'} = $charged_party; + #push @search, "charged_party = '$charged_party'"; + #XXX countrycode - my @cp = map { $_, "1$_" } - split(/\s*,\s*/, $cgi->param('charged_party') ); - - my $search = 'charged_party IN ('. join(',', map dbh->quote($_), @cp). ')'; + my $search = " ( charged_party IN ('$charged_party', '1$charged_party') )"; push @search, $search; push @qsearch, $search; } -if ( $cgi->param('charged_party_or_src') ) { +if ( $cgi->param('charged_party_or_src') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; + #$hashref->{'charged_party'} = $charged_party; + #push @search, "charged_party = '$charged_party'"; + #XXX countrycode - my @cp = map { $_, "1$_" } - split(/\s*,\s*/, $cgi->param('charged_party_or_src') ); - my $in = join(',', map dbh->quote($_), @cp); + my $search = " ( charged_party IN ('$charged_party', '1$charged_party') + OR src IN ('$charged_party', '1$charged_party') )"; - my $search = "( charged_party IN ($in) OR src IN ($in) )"; - - push @search, $search; - push @qsearch, $search; -} - -if ( $cgi->param('svcnum') =~ /^([\d, ]+)$/ ) { - my $svcnum = $1; - my $search = "svcnum IN ($svcnum)"; push @search, $search; push @qsearch, $search; } diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index f2a5ccd4f..98a1da9d9 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -502,29 +502,26 @@ if ( $cgi->param('nottax') ) { } elsif ( $cgi->param('istax') ) { #false laziness w/report_tax.cgi $taxfromwhere - if ( scalar( grep( /locationtaxid/, $cgi->param ) ) || - $cgi->param('iscredit') eq 'rate') { - - $join_pkg .= - ' LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum ) '. - ' LEFT JOIN tax_rate_location USING ( taxratelocationnum ) '; - - } elsif ( $conf->exists('tax-pkg_address') ) { - + if ( $conf->exists('tax-pkg_address') ) { $join_pkg .= ' LEFT JOIN cust_bill_pkg_tax_location USING ( billpkgnum ) LEFT JOIN cust_location USING ( locationnum ) '; #quelle kludge, somewhat false laziness w/report_tax.cgi s/cust_pkg\.locationnum/cust_bill_pkg_tax_location.locationnum/g for @where; + } elsif ( scalar( grep( /locationtaxid/, $cgi->param ) ) || + $cgi->param('iscredit') eq 'rate') { + $join_pkg .= + ' LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum ) '. + ' LEFT JOIN tax_rate_location USING ( taxratelocationnum ) '; } if ( $cgi->param('iscredit') ) { $join_pkg .= ' JOIN cust_credit_bill_pkg USING ( billpkgnum'; - if ( $cgi->param('iscredit') eq 'rate' ) { - $join_pkg .= ', billpkgtaxratelocationnum )'; - } elsif ( $conf->exists('tax-pkg_address') ) { + if ( $conf->exists('tax-pkg_address') ) { $join_pkg .= ', billpkgtaxlocationnum )'; push @where, "billpkgtaxratelocationnum IS NULL"; + } elsif ( $cgi->param('iscredit') eq 'rate' ) { + $join_pkg .= ', billpkgtaxratelocationnum )'; } else { $join_pkg .= ' )'; push @where, "billpkgtaxratelocationnum IS NULL"; diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 8fbf6364c..93f960f5c 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -204,9 +204,7 @@ % if ( $cgi->param('search_cust') ) { % $sortby = \*company_sort; % $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; -% push @cust_main, smart_search( 'search' => $cgi->param('search_cust'), -% 'no_fuzzy_on_exact' => 1, #pref? -% ); +% push @cust_main, smart_search( 'search' => $cgi->param('search_cust') ); % } % % @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 04ecf894a..b6db4e434 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -44,10 +44,8 @@ my %search_hash = (); #scalars my @scalars = qw ( - agentnum status address paydate_year paydate_month invoice_terms - no_censustract with_geocode custbatch usernum - cancelled_pkgs - cust_fields flattened_pkgs + agentnum status cancelled_pkgs cust_fields flattened_pkgs custbatch usernum + no_censustract paydate_year paydate_month invoice_terms ); for my $param ( @scalars ) { @@ -56,7 +54,7 @@ for my $param ( @scalars ) { } #lists -for my $param (qw( classnum payby tagnum )) { +for my $param (qw( classnum payby )) { $search_hash{$param} = [ $cgi->param($param) ]; } diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html index 8b7350853..f46e08ab1 100755 --- a/httemplate/search/cust_pay_pending.html +++ b/httemplate/search/cust_pay_pending.html @@ -19,7 +19,7 @@ my %statusaction = ( 'new' => 'delete', 'pending' => 'complete', #'authorized' => '', - 'captured' => 'capture', + #'captured' => '', #'declined' => '', #wouldn't need to take action on a done state#'done' ); diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 207e4f611..da4371f5e 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -19,7 +19,6 @@ 'Adjourn', 'Susp.', 'Expire', - 'Contract end', 'Cancel', 'Reason', FS::UI::Web::cust_header( @@ -60,7 +59,7 @@ #sub { time2str('%b %d %Y', shift->expire); }, #sub { time2str('%b %d %Y', shift->get('cancel')); }, ( map { time_or_blank($_) } - qw( setup last_bill bill adjourn susp expire contract_end cancel ) ), + qw( setup last_bill bill adjourn susp expire cancel ) ), sub { my $self = shift; my $return = ''; @@ -207,7 +206,7 @@ my %disable = ( '' => {}, ); -foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel active )) { +foreach my $field (qw( setup last_bill bill adjourn susp expire cancel active )) { my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field); diff --git a/httemplate/search/cust_pkg_svc.html b/httemplate/search/cust_pkg_svc.html deleted file mode 100644 index 4f27d6617..000000000 --- a/httemplate/search/cust_pkg_svc.html +++ /dev/null @@ -1,117 +0,0 @@ -<% include( 'elements/search.html', - 'title' => $part_svc->svc.' services in package #'.$pkgnum, - 'name' => 'services', - 'html_form' => $html_form, - 'query' => $sql_query, - 'count_query' => $count_query, - 'redirect' => $link, - 'header' => [ '#', - 'Service', - '', #checkboxes - ], - 'fields' => [ 'svcnum', - sub { - ($_[0]->label)[1] - }, - sub { - $areboxes = 1; - '<INPUT TYPE="checkbox" NAME="svcnum" VALUE='.$_[0]->svcnum.'>' - }, - ], - 'links' => [ $link, - $link, - '', - ], - 'align' => 'rrlc', - 'color' => [ - ('')x4, - ], - 'style' => [ - ('')x4, - ], - 'html_foot' => sub { $areboxes ? $html_foot : '' } - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('List services'); - -my $pkgnum = $cgi->param('pkgnum'); -$pkgnum =~ /^(\d+)$/ or die "invalid pkgnum: $pkgnum"; -my @extra_sql = ( "cust_svc.pkgnum = $pkgnum" ); - -my $svcpart = $cgi->param('svcpart'); -$svcpart =~ /^(\d+)$/ or die "invalid svcpart: $svcpart"; -push @extra_sql, "cust_svc.svcpart = $svcpart"; -my $part_svc = qsearchs('part_svc', {svcpart => $svcpart}); -my $svcdb = $part_svc->svcdb; - -my $orderby = 'ORDER BY svcnum'; #others? - -my $addl_from = " LEFT JOIN part_svc USING (svcpart) -LEFT JOIN cust_pkg USING (pkgnum) -LEFT JOIN cust_main USING (custnum) -INNER JOIN $svcdb USING (svcnum)"; - -my $search_string; -if ( length( $cgi->param('search_svc') ) ) { - - $search_string = $cgi->param('search_svc'); - $search_string =~ s/(^\s+|\s+$)//; - push @extra_sql, "FS::$svcdb"->search_sql($search_string); - -} - -#here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'View/link unlinked services' - ); - -my $extra_sql = ' WHERE '. join(' AND ', @extra_sql ); - -my $sql_query = { - 'select' => join(', ', - 'cust_svc.*', - 'part_svc.svc', - ), - 'table' => 'cust_svc', - 'addl_from' => $addl_from, - 'hashref' => {}, - 'extra_sql' => "$extra_sql $orderby", -}; - -#warn Dumper($sql_query)."\n"; - -my $count_query = "SELECT COUNT(*) FROM cust_svc $addl_from $extra_sql"; - -my $link = sub { - my $cust_svc = shift; - my $url = svc_url( - 'm' => $m, - 'action' => 'view', - 'svcdb' => $svcdb, - 'query' => '', - ); - [ $url, 'svcnum' ]; -}; - -my $html_form = qq! -<SCRIPT TYPE="text/javascript"> -function areyousure(obj) { - return confirm('Permanently delete the selected services?'); -} -</SCRIPT> -<FORM METHOD="POST" ACTION="${p}misc/unprovision.cgi" onsubmit="return areyousure()">!; - -my $areboxes = 0; - -my $html_foot = qq! -<BR> -<INPUT TYPE="submit" NAME="submit" VALUE="Unprovision selected"> -<INPUT TYPE="hidden" NAME="pkgnum" VALUE=$pkgnum> -<INPUT TYPE="hidden" NAME="svcpart" VALUE=$svcpart> -</FORM>!; - - -</%init> diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html index 866606cc1..a50e4db4c 100644 --- a/httemplate/search/report_cdr.html +++ b/httemplate/search/report_cdr.html @@ -65,21 +65,7 @@ <TR> <TD ALIGN="right">Charged Party #: </TD> <TD> - <INPUT TYPE="text" NAME="charged_party" VALUE="<% join(',', @charged_party) |h %>"> - </TD> - </TR> - - <TR> - <TD ALIGN="right">Charged Party or Source #: </TD> - <TD> - <INPUT TYPE="text" NAME="charged_party_or_src" VALUE="<% join(',', @charged_party_or_src ) |h %>" > - </TD> - </TR> - - <TR> - <TD ALIGN="right">Freeside service #: </TD> - <TD> - <INPUT TYPE="text" NAME="svcnum" VALUE="<% join(',', @svcnum ) %>" > + <INPUT TYPE="text" NAME="charged_party"> </TD> </TR> @@ -159,72 +145,4 @@ my $names_list = [ map { @fields ]; -my @charged_party = (); -my @charged_party_or_src = (); -my @svcnum = (); -if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - my $custnum = $1; - - my $cust_main = qsearchs( { - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $custnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, - }); - die "Customer not found!" unless $cust_main; - - #historical? - foreach my $cust_pkg ( $cust_main->ncancelled_pkgs ) { - - my @voip_pkgs = - grep { $_->plan eq 'voip_cdr' } $cust_pkg->part_pkg->self_and_bill_linked; - if ( scalar(@voip_pkgs) > 1 ) { - die "multiple voip_cdr packages bundled\n"; - } elsif ( !@voip_pkgs ) { - next; - } - my $voip_pkg = @voip_pkgs[0]; - - my $cdr_svc_method = $voip_pkg->option('cdr_svc_method') - || 'svc_phone.phonenum'; - - my @cust_svc = $cust_pkg->cust_svc; #historical? - - if ( $cdr_svc_method eq 'svc_phone.phonenum' ) { - - my @svc_phone = map $_->svc_x, - grep { $_->part_svc->svcdb eq 'svc_phone' } @cust_svc; - - my @numbers = map { - my $number = $_->phonenum; - $number = $_->countrycode. $number - unless $_->countrycode eq '1'; - $number; - } - @svc_phone; - - if ( $voip_pkg->option('disable_src') ) { - push @charged_party, @numbers; - } else { - push @charged_party_or_src, @numbers; - } - - } elsif ( $cdr_svc_method eq 'svc_pbx.title' ) { - my @svc_pbx = map $_->svc_x, - grep { $_->part_svc->svcdb eq 'svc_pbx' } @cust_svc; - push @charged_party, map $_->title, @svc_pbx; - } elsif ( $cdr_svc_method eq 'svc_pbx.svcnum' ) { - my @cust_svc_pbx = grep { $_->part_svc->svcdb eq 'svc_pbx' } @cust_svc; - push @svcnum, map $_->svcnum, @cust_svc_pbx; - } - - } - - die "No CDR packages for customer $custnum\n" - unless @charged_party || @charged_party_or_src || @svcnum; - - #die "Multiple matching metods for customer $custnum\n" - # if #there's more than one - -} - </%init> diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index d6be4fbc6..eb1a66273 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -28,11 +28,6 @@ ) %> - <TR> - <TD ALIGN="right" VALIGN="center">Address</TD> - <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD> - </TR> - % foreach my $field (qw( signupdate )) { <TR> @@ -50,14 +45,6 @@ % } - <% include( '/elements/tr-select-cust_tag.html', - 'cgi' => $cgi, - 'is_report' => 1, - 'multiple' => 1, - 'all_selected' => 1, - ) - %> - <% include( '/elements/tr-select-payby.html', 'payby_type' => 'cust', 'multiple' => 1, @@ -118,18 +105,13 @@ <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD> </TR> +% if ( $conf->exists('cust_main-require_censustract') ) { + <TR> <TD ALIGN="right" VALIGN="center">Without census tract</TD> <TD><INPUT TYPE="checkbox" NAME="no_censustract"></TD> </TR> -% if ( $conf->exists('enable_taxproducts') ) { - - <TR> - <TD ALIGN="right" VALIGN="center">With hardcoded tax location</TD> - <TD><INPUT TYPE="checkbox" NAME="with_geocode"></TD> - </TR> - % } <TR> diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html index 289fec458..58fcf619e 100755 --- a/httemplate/search/report_cust_pkg.html +++ b/httemplate/search/report_cust_pkg.html @@ -89,7 +89,7 @@ % } -% foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel )) { +% foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { <TR> <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD> @@ -181,7 +181,6 @@ my %label = ( 'adjourn' => 'Adjourns', 'susp' => 'Suspended', 'expire' => 'Expires', - 'contract_end' => 'Contract ends', 'cancel' => 'Cancelled', ); diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index c3ddd660b..1407d9e30 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -262,13 +262,13 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { } $cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text - my $username = lc($1); + my $username = $1; - push @username_sql, "LOWER(username) LIKE '$username'" + push @username_sql, "username ILIKE '$username'" if $username_type{'Exact'} || $username_type{'Fuzzy'}; - push @username_sql, "LOWER(username) LIKE '\%$username\%'" + push @username_sql, "username ILIKE '\%$username\%'" if $username_type{'Substring'} || $username_type{'All'}; |