summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-10-29 19:08:13 +0000
committerivan <ivan>2009-10-29 19:08:13 +0000
commit99eea3e4cc49a10231e3f3bce4b9afb01913ce55 (patch)
tree3e07f25ecfdf5add820622a082af787f82fac9fc
parentfcc3ddbd03b97b88bf04f6984d7fd3c443fb14b5 (diff)
customer classification, RT#6376
-rw-r--r--FS/FS/cust_main.pm15
-rw-r--r--httemplate/elements/select-table.html2
-rwxr-xr-xhttemplate/search/cust_main.html5
-rwxr-xr-xhttemplate/search/report_cust_main.html7
4 files changed, 25 insertions, 4 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index fdcd80178..e192ef98f 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -8328,6 +8328,21 @@ sub search_sql {
}
###
+ # classnum
+ ###
+
+ my @classnum = grep /^(\d*)$/, @{ $params->{'classnum'} };
+ if ( @classnum ) {
+ push @where, '( '. join(' OR ', map {
+ $_ ? "cust_main.classnum = $_"
+ : "cust_main.classnum IS NULL"
+ }
+ @classnum
+ ).
+ ' )';
+ }
+
+ ###
# payby
###
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html
index 10a8b2741..45585a8ff 100644
--- a/httemplate/elements/select-table.html
+++ b/httemplate/elements/select-table.html
@@ -86,7 +86,7 @@ Example:
% {
% my $recvalue = $record->$key();
<OPTION VALUE="<% $recvalue %>"
- <% ref($value) && $value->{$recvalue} || $value == $recvalue
+ <% $opt{'all_selected'} || ref($value) && $value->{$recvalue} || $value == $recvalue
? ' SELECTED' : ''
%>
><% $opt{'label_showkey'} ? "$recvalue: " : '' %>
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index f098fd3a6..186467e00 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -54,9 +54,8 @@ for my $param ( @scalars ) {
}
#lists
-for my $param (qw( payby )) {
- $search_hash{$param} = [ $cgi->param($param) ]
- if $cgi->param($param);
+for my $param (qw( classnum payby )) {
+ $search_hash{$param} = [ $cgi->param($param) ];
}
###
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index f139d4bb5..92df58cfb 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -20,6 +20,13 @@
)
%>
+ <% include( '/elements/tr-select-cust_class.html',
+ 'label' => 'Class',
+ 'multiple' => 1,
+ 'pre_options' => [ '' => '(none)' ],
+ 'all_selected' => 1,
+ )
+ %>
% foreach my $field (qw( signupdate )) {