summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_bill.pm8
-rw-r--r--FS/FS/cust_bill_event.pm6
-rw-r--r--FS/FS/cust_event.pm8
-rw-r--r--FS/FS/cust_main.pm18
-rw-r--r--FS/FS/cust_pkg.pm8
-rw-r--r--httemplate/misc/email-customers.html2
-rwxr-xr-xhttemplate/misc/process/bulk_change_pkg.cgi2
-rw-r--r--httemplate/misc/process/email-customers.html2
-rwxr-xr-xhttemplate/search/477.html2
-rwxr-xr-xhttemplate/search/cust_bill.html2
-rw-r--r--httemplate/search/cust_bill_event.cgi2
-rw-r--r--httemplate/search/cust_event.html2
-rwxr-xr-xhttemplate/search/cust_main.html2
-rwxr-xr-xhttemplate/search/cust_pkg.cgi2
-rwxr-xr-xhttemplate/search/report_svc_acct.html23
-rwxr-xr-xhttemplate/view/cust_main/packages.html4
16 files changed, 56 insertions, 37 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index af70add..cec7935 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -4223,7 +4223,7 @@ sub re_X {
my $distinct = '';
my $orderby = 'ORDER BY cust_bill._date';
- my $extra_sql = ' WHERE '. FS::cust_bill->search_sql(\%param);
+ my $extra_sql = ' WHERE '. FS::cust_bill->search_sql_where(\%param);
my $addl_from = 'LEFT JOIN cust_main USING ( custnum )';
@@ -4313,7 +4313,7 @@ sub credited_sql {
WHERE cust_bill.invnum = cust_credit_bill.invnum )";
}
-=item search_sql HASHREF
+=item search_sql_where HASHREF
Class method which returns an SQL WHERE fragment to search for parameters
specified in HASHREF. Valid parameters are
@@ -4356,10 +4356,10 @@ Note: validates all passed-in data; i.e. safe to use with unchecked CGI params.
=cut
-sub search_sql {
+sub search_sql_where {
my($class, $param) = @_;
if ( $DEBUG ) {
- warn "$me search_sql called with params: \n".
+ warn "$me search_sql_where called with params: \n".
join("\n", map { " $_: ". $param->{$_} } keys %$param ). "\n";
}
diff --git a/FS/FS/cust_bill_event.pm b/FS/FS/cust_bill_event.pm
index 7c2ad37..36afed0 100644
--- a/FS/FS/cust_bill_event.pm
+++ b/FS/FS/cust_bill_event.pm
@@ -201,7 +201,7 @@ sub retriable {
$self->replace($old);
}
-=item search_sql HASHREF
+=item search_sql_where HASHREF
Class method which returns an SQL WHERE fragment to search for parameters
specified in HASHREF. Valid parameters are
@@ -236,7 +236,7 @@ Specifies the user for agent virtualization
=cut
-sub search_sql {
+sub search_sql_where {
my ($class, $params) = @_;
my @search = ();
@@ -324,7 +324,7 @@ sub process_re_X {
sub re_X {
my($method, $param, $job) = @_;
- my $where = FS::cust_bill_event->search_sql($param);
+ my $where = FS::cust_bill_event->search_sql_where($param);
$where = " WHERE plan LIKE 'send%'". ( $where ? " AND $where" : "" );
my $from = 'LEFT JOIN part_bill_event USING ( eventpart )'.
diff --git a/FS/FS/cust_event.pm b/FS/FS/cust_event.pm
index bf3a5b7..d2fcfc1 100644
--- a/FS/FS/cust_event.pm
+++ b/FS/FS/cust_event.pm
@@ -315,7 +315,7 @@ sub join_sql {
}
-=item search_sql HASHREF
+=item search_sql_where HASHREF
Class method which returns an SQL WHERE fragment to search for parameters
specified in HASHREF. Valid parameters are
@@ -347,10 +347,10 @@ specified in HASHREF. Valid parameters are
#Note: validates all passed-in data; i.e. safe to use with unchecked CGI params.
#sub
-sub search_sql {
+sub search_sql_where {
my($class, $param) = @_;
if ( $DEBUG ) {
- warn "$me search_sql called with params: \n".
+ warn "$me search_sql_where called with params: \n".
join("\n", map { " $_: ". $param->{$_} } keys %$param ). "\n";
}
@@ -448,7 +448,7 @@ sub process_re_X {
sub re_X {
my($method, $param, $job) = @_;
- my $search_sql = FS::cust_event->search_sql($param);
+ my $search_sql = FS::cust_event->search_sql_where($param);
#maybe not...? we do want the "re-" action to match the search more closely
# # yuck! hardcoded *AND* sequential scans!
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 4837730..4973f69 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -8264,7 +8264,7 @@ sub _money_table_where {
}
-=item search_sql HASHREF
+=item search HASHREF
(Class method)
@@ -8307,7 +8307,7 @@ bool
=cut
-sub search_sql {
+sub search {
my ($class, $params) = @_;
my $dbh = dbh;
@@ -8522,13 +8522,13 @@ sub search_sql {
}
-=item email_search_sql HASHREF
+=item email_search_result HASHREF
(Class method)
Emails a notice to the specified customers.
-Valid parameters are those of the L<search_sql> method, plus the following:
+Valid parameters are those of the L<search> method, plus the following:
=over 4
@@ -8562,7 +8562,7 @@ retrying everything.
=cut
-sub email_search_sql {
+sub email_search_result {
my($class, $params) = @_;
my $from = delete $params->{from};
@@ -8575,7 +8575,7 @@ sub email_search_sql {
$params->{'payby'} = [ split(/\0/, $params->{'payby'}) ]
unless ref($params->{'payby'});
- my $sql_query = $class->search_sql($params);
+ my $sql_query = $class->search($params);
my $count_query = delete($sql_query->{'count_query'});
my $count_sth = dbh->prepare($count_query)
@@ -8627,7 +8627,7 @@ sub email_search_sql {
use Storable qw(thaw);
use Data::Dumper;
use MIME::Base64;
-sub process_email_search_sql {
+sub process_email_search_result {
my $job = shift;
#warn "$me process_re_X $method for job $job\n" if $DEBUG;
@@ -8639,7 +8639,7 @@ sub process_email_search_sql {
$param->{'payby'} = [ split(/\0/, $param->{'payby'}) ]
unless ref($param->{'payby'});
- my $error = FS::cust_main->email_search_sql( $param );
+ my $error = FS::cust_main->email_search_result( $param );
die $error if $error;
}
@@ -8918,7 +8918,7 @@ sub smart_search {
#getting complaints searches are not returning enough
unless ( @cust_main && $skip_fuzzy || $conf->exists('disable-fuzzy') ) {
- #still some false laziness w/search_sql (was search/cust_main.cgi)
+ #still some false laziness w/search (was search/cust_main.cgi)
#substring
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index d393e96..d75113f 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2291,7 +2291,7 @@ sub cancel_sql {
"cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0";
}
-=item search_sql HASHREF
+=item search HASHREF
(Class method)
@@ -2364,7 +2364,7 @@ specifies the user for agent virtualization
=cut
-sub search_sql {
+sub search {
my ($class, $params) = @_;
my @where = ();
@@ -2593,10 +2593,10 @@ sub search_sql {
if ($access_user) {
push @where, $access_user->agentnums_sql('table'=>'cust_main');
- }else{
+ } else {
push @where, "1=0";
}
- }else{
+ } else {
push @where, $FS::CurrentUser::CurrentUser->agentnums_sql('table'=>'cust_main');
}
diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html
index 46bf3b4..4e4c15f 100644
--- a/httemplate/misc/email-customers.html
+++ b/httemplate/misc/email-customers.html
@@ -132,7 +132,7 @@ my $title = 'Bulk send customer notices';
my $num_cust;
if ( $cgi->param('magic') eq 'preview' ) {
- my $sql_query = FS::cust_main->search_sql(\%search);
+ my $sql_query = FS::cust_main->search(\%search);
my $count_query = delete($sql_query->{'count_query'});
my $count_sth = dbh->prepare($count_query)
or die "Error preparing $count_query: ". dbh->errstr;
diff --git a/httemplate/misc/process/bulk_change_pkg.cgi b/httemplate/misc/process/bulk_change_pkg.cgi
index d2ab4bf..e22dafe 100755
--- a/httemplate/misc/process/bulk_change_pkg.cgi
+++ b/httemplate/misc/process/bulk_change_pkg.cgi
@@ -41,7 +41,7 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
}
-my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
+my $sql_query = FS::cust_pkg->search(\%search_hash);
$sql_query->{'select'} = 'cust_pkg.pkgnum';
my $error = FS::cust_pkg::bulk_change( [ $cgi->param('new_pkgpart') ],
diff --git a/httemplate/misc/process/email-customers.html b/httemplate/misc/process/email-customers.html
index d254cfe..c54bc6d 100644
--- a/httemplate/misc/process/email-customers.html
+++ b/httemplate/misc/process/email-customers.html
@@ -4,6 +4,6 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices');
-my $server = new FS::UI::Web::JSRPC 'FS::cust_main::process_email_search_sql', $cgi;
+my $server = new FS::UI::Web::JSRPC 'FS::cust_main::process_email_search_result', $cgi;
</%init>
diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index b485161..0f1502f 100755
--- a/httemplate/search/477.html
+++ b/httemplate/search/477.html
@@ -106,7 +106,7 @@ foreach my $row ( sort keys %row_option_name ) {
if $column_option_name{$column};
my $report_option = join(',', @report_option) if @report_option;
- my $sql_query = FS::cust_pkg->search_sql(
+ my $sql_query = FS::cust_pkg->search(
{ %search_hash,
($report_option ? ( 'report_option' => $report_option ) : () ),
}
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 2f6bd9c..6db6006 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -123,7 +123,7 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
$count_query = "SELECT COUNT(DISTINCT cust_bill.custnum), 'N/A', 'N/A'";
}
- my $extra_sql = ' WHERE '. FS::cust_bill->search_sql( \%search );
+ my $extra_sql = ' WHERE '. FS::cust_bill->search_sql_where( \%search );
unless ( $count_query ) {
$count_query = 'SELECT COUNT(*), '. join(', ',
diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi
index ff4168d..16c9acd 100644
--- a/httemplate/search/cust_bill_event.cgi
+++ b/httemplate/search/cust_bill_event.cgi
@@ -96,7 +96,7 @@ if ( $cgi->param('invnum') =~ /^(\d+)$/ ) {
$search{invnum} = $1;
}
-my $where = 'WHERE '. FS::cust_bill_event->search_sql( \%search );
+my $where = 'WHERE '. FS::cust_bill_event->search_sql_where( \%search );
my $join = 'LEFT JOIN part_bill_event USING ( eventpart ) '.
'LEFT JOIN cust_bill USING ( invnum ) '.
diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html
index b22644e..a0429e4 100644
--- a/httemplate/search/cust_event.html
+++ b/httemplate/search/cust_event.html
@@ -173,7 +173,7 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
$search{'beginning'} = $beginning;
$search{'ending'} = $ending;
-my $where = ' WHERE '. FS::cust_event->search_sql( \%search );
+my $where = ' WHERE '. FS::cust_event->search_sql_where( \%search );
my $join = FS::cust_event->join_sql();
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index a1693b8..644e093 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -84,7 +84,7 @@ $search_hash{'current_balance'} =
# etc
###
-my $sql_query = FS::cust_main->search_sql(\%search_hash);
+my $sql_query = FS::cust_main->search(\%search_hash);
my $count_query = delete($sql_query->{'count_query'});
my @extra_headers = @{ delete($sql_query->{'extra_headers'}) };
my @extra_fields = @{ delete($sql_query->{'extra_fields'}) };
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 37e8d6c..ff8ee57 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -204,7 +204,7 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
}
-my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
+my $sql_query = FS::cust_pkg->search(\%search_hash);
my $count_query = delete($sql_query->{'count_query'});
my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
diff --git a/httemplate/search/report_svc_acct.html b/httemplate/search/report_svc_acct.html
index 59fd1f8..ee913c4 100755
--- a/httemplate/search/report_svc_acct.html
+++ b/httemplate/search/report_svc_acct.html
@@ -1,7 +1,8 @@
-<% include('/elements/header.html', 'Account Report' ) %>
+<% include('/elements/header.html', $title ) %>
<FORM ACTION="svc_acct.cgi" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
@@ -9,19 +10,21 @@
<TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
</TR>
+% unless ( $custnum ) {
<% include( '/elements/tr-select-agent.html',
'curr_value' => scalar( $cgi->param('agentnum') ),
'disable_empty' => 0,
)
%>
+% # just this customer's domains?
<% include( '/elements/tr-select-domain.html',
'element_name' => 'domsvc',
'curr_value' => scalar( $cgi->param('domsvc') ),
'disable_empty' => 0,
)
%>
-
+% }
<SCRIPT type="text/javascript">
function toggle(what) {
@@ -92,7 +95,21 @@
<%init>
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+ unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
+
+my $title = 'Account Report';
+
+#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 .= ': '. $cust_main->name;
+}
</%init>
<%once>
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index dbbdf67..bd056a3 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -65,7 +65,9 @@ Current packages
</TD>
<TD ALIGN="right">
- <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A>
+ <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A><BR>
+ Service reports:
+ <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A>
</TD>
</TR>