Subversion Repositories ORC

Rev

Rev 26 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26 Rev 35
Line 81... Line 81...
81
  
81
  
82
	if ($filter)	{
82
	if ($filter)	{
83
		if ($filter eq "-blank-") {
83
		if ($filter eq "-blank-") {
84
			return "($colName = '' or isNull($colName) = 1)";
84
			return "($colName = '' or isNull($colName) = 1)";
-
 
85
		}
-
 
86
		
-
 
87
		if ($filtered_by_access ne "") {
-
 
88
		  return "$colName like \"%$filter-$filtered_by_access%\"";
85
		}
89
		} else {
-
 
90
		  return "$colName like \"%$filter%\"";
86
		return "$colName like \"%$filter%\"";
91
		}
87
	} else {
92
	} else {
88
    my @options = ("");
93
    my @options = ("");
89
    push @options, "-blank-" unless $LVL < 4;
94
    push @options, "-blank-" unless $LVL < 4;
Line 90... Line 95...
90
    push @options, $LVL < 4 ? grep { $ORCUSER->{department}->{$_} >= 2 } sort keys %{$ORCUSER->{department}} : sort keys %{$DepartmentNames};
95
    push @options, ($LVL < 4 and $ORCUSER->{department}->{VCI} < 2) ? grep { $ORCUSER->{department}->{$_} >= 2 } sort keys %{$ORCUSER->{department}} : sort keys %{$DepartmentNames};
91
    
96
    
92
    @options = map { $FORM{"filter-department"} eq $_ ?
97
    @options = map { $FORM{"filter-department"} eq $_ ?
Line 93... Line 98...
93
                       ( $h->option ({ selected=>[], value=>$_ }, $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) ) :
98
                       ( $h->option ({ selected=>[], value=>$_ }, $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) ) :
94
                       ( $h->option ({ value=>$_ },               $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) )  } @options;
99
                       ( $h->option ({ value=>$_ },               $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) )  } @options;
95
    
100
    
Line -... Line 101...
-
 
101
    return $FORM{autoload} ? $h->select ({ name=>"filter-department", onChange=>"page.value = 1; submit();" }, [@options]) : $h->select ({ name=>"filter-department" }, [$h->option (), @options]);
96
    return $FORM{autoload} ? $h->select ({ name=>"filter-department", onChange=>"page.value = 1; submit();" }, [@options]) : $h->select ({ name=>"filter-department" }, [$h->option (), @options]);
102
  }
97
  }
103
}
98
}
104
 
Line 99... Line 105...
99
 
105
our $filtered_by_access = "";
-
 
106
sub filter_access {
100
sub filter_access {
107
  my $colName = shift;
101
  my $colName = shift;
108
  my $filter = shift // "";
102
  my $filter = shift // "";
109
  
Line 103... Line 110...
103
  
110
	if ($filter ne "")	{
Line 187... Line 194...
187
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
194
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
Line 188... Line 195...
188
 
195
 
189
# Process any filters provided in the form to pass to the database
196
# Process any filters provided in the form to pass to the database
190
my @whereClause = map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
197
my @whereClause = map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
191
#warn @whereClause;
198
#warn @whereClause;
192
if ($LVL < 4) {
199
if ($LVL < 4 and $ORCUSER->{department}->{VCI} < 2) {
193
#  warn keys %{$ORCUSER->{department}};
200
#  warn keys %{$ORCUSER->{department}};
194
  my $string = join " or ", map { 'department like "%'.$_.'%"' } grep { $ORCUSER->{department}->{$_} >= 2 } keys %{$ORCUSER->{department}};
201
  my $string = join " or ", map { 'department like "%'.$_.'%"' } grep { $ORCUSER->{department}->{$_} >= 2 } keys %{$ORCUSER->{department}};
195
  $string = "($string)";
202
  $string = "($string)";
196
#  warn $string;
203
#  warn $string;