| Line 78... |
Line 78... |
| 78 |
|
78 |
|
| 79 |
|
79 |
|
| 80 |
sub fetchColEntries {
|
80 |
sub fetchColEntries {
|
| - |
|
81 |
my $colName = shift;
|
| 81 |
my $colName = shift;
|
82 |
my $selection = shift;
|
| 82 |
my $selection = shift;
|
83 |
my $year = shift // "year(now())";
|
| Line 83... |
Line 84... |
| 83 |
my $table = $DBTABLE;
|
84 |
my $table = $DBTABLE;
|
| 84 |
my $optionList = "";
|
85 |
my $optionList = "";
|
| 85 |
|
86 |
|
| 86 |
if ($colName eq "derby_name" and $LVL < 2) {
|
87 |
if ($colName eq "derby_name" and $LVL < 2) {
|
| 87 |
# special case to anonymize assignees...
|
88 |
# special case to anonymize assignees...
|
| 88 |
my @opts = ("-blank-", $ORCUSER->{derby_name});
|
89 |
my @opts = ("-blank-", $ORCUSER->{derby_name});
|
| 89 |
push @opts, map { @{$_} } @{ $internalDBH->selectall_arrayref ("select derby_name from official where showme = 1 and derby_name <> ? order by derby_name", undef, $ORCUSER->{derby_name}) };
|
90 |
push @opts, map { @{$_} } @{ $internalDBH->selectall_arrayref ("select derby_name from official where showme = 1 and derby_name <> ? order by derby_name", undef, $ORCUSER->{derby_name}) };
|
| 90 |
$optionList = join "", map { $selection eq $_ ? "<OPTION selected>$_</OPTION>" : "<OPTION>$_</OPTION>" } @opts;
|
91 |
$optionList = join "", map { $selection eq $_ ? "<OPTION selected>$_</OPTION>" : "<OPTION>$_</OPTION>" } @opts;
|
| 91 |
} else {
|
92 |
} else {
|
| Line 92... |
Line 93... |
| 92 |
my $dept_where = $table eq "v_shift" ? "where dept != 'PER' and year(date) = year(now())" : "";
|
93 |
my $dept_where = $table eq "v_shift" ? "where dept != 'PER' and year(date) = $year" : "";
|
| 93 |
my $orderby = $colName eq "dayofweek" ? "field(dayofweek, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')" : $colName;
|
94 |
my $orderby = $colName eq "dayofweek" ? "field(dayofweek, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')" : $colName;
|
| Line 142... |
Line 143... |
| 142 |
|
143 |
|
| 143 |
|
144 |
|
| 144 |
sub filter {
|
145 |
sub filter {
|
| - |
|
146 |
my $colName = shift;
|
| Line 145... |
Line 147... |
| 145 |
my $colName = shift;
|
147 |
my $filter = shift;
|
| Line 146... |
Line 148... |
| 146 |
my $filter = shift;
|
148 |
my $year = shift;
|
| 147 |
|
149 |
|
| Line 157... |
Line 159... |
| 157 |
return "$colName = \"$filter\"";
|
159 |
return "$colName = \"$filter\"";
|
| 158 |
}
|
160 |
}
|
| 159 |
else
|
161 |
else
|
| 160 |
{
|
162 |
{
|
| 161 |
my $thing = "filter-${colName}";
|
163 |
my $thing = "filter-${colName}";
|
| 162 |
my $categories = fetchColEntries ($colName, $FORM{$thing});
|
164 |
my $categories = $year ? fetchColEntries ($colName, $FORM{$thing}, $year) : fetchColEntries ($colName, $FORM{$thing});
|
| 163 |
my $Options = "<OPTION></OPTION>".$categories;
|
165 |
my $Options = "<OPTION></OPTION>".$categories;
|
| Line 164... |
Line 166... |
| 164 |
|
166 |
|
| 165 |
$Options =~ s/>($FORM{$thing})/ selected>$1/;
|
167 |
$Options =~ s/>($FORM{$thing})/ selected>$1/;
|
| 166 |
return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
|
168 |
return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
|
| Line 261... |
Line 263... |
| 261 |
} else {
|
263 |
} else {
|
| 262 |
$curpage = ($curpage - 1) * $pagelimit;
|
264 |
$curpage = ($curpage - 1) * $pagelimit;
|
| 263 |
$getMe = "select distinct * from $table $whereClause $orderby limit $curpage, $pagelimit";
|
265 |
$getMe = "select distinct * from $table $whereClause $orderby limit $curpage, $pagelimit";
|
| 264 |
}
|
266 |
}
|
| 265 |
my ($totalcount) = @{$internalDBH->selectrow_arrayref ("select distinct count(*) from $table $whereClause")};
|
267 |
my ($totalcount) = @{$internalDBH->selectrow_arrayref ("select distinct count(*) from $table $whereClause")};
|
| 266 |
warn $getMe;
|
268 |
# warn $getMe;
|
| 267 |
my $limhan = $internalDBH->prepare($getMe); # Get the tickets from the DB
|
269 |
my $limhan = $internalDBH->prepare($getMe); # Get the tickets from the DB
|
| 268 |
$limhan->execute();
|
270 |
$limhan->execute();
|
| Line 269... |
Line 271... |
| 269 |
|
271 |
|
| 270 |
my @results = ();
|
272 |
my @results = ();
|
| Line 573... |
Line 575... |
| 573 |
}
|
575 |
}
|
| 574 |
}
|
576 |
}
|
| 575 |
}
|
577 |
}
|
| Line 576... |
Line 578... |
| 576 |
|
578 |
|
| 577 |
# Print the filter boxes...
|
579 |
# Print the filter boxes...
|
| Line 578... |
Line 580... |
| 578 |
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
|
580 |
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_, undef, $YEAR)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
|
| 579 |
|
581 |
|
| 580 |
if ($FORM{shiftinclude}) { # Include all of the user's shifts at the top
|
582 |
if ($FORM{shiftinclude}) { # Include all of the user's shifts at the top
|
| 581 |
foreach my $t (@shifts) {
|
583 |
foreach my $t (@shifts) {
|