| Line -... |
Line 1... |
| - |
|
1 |
#package tableViewer;
|
| - |
|
2 |
|
| 1 |
#######################################################################
|
3 |
#######################################################################
|
| 2 |
# A set of functions to assist the scan data display tool.
|
4 |
# A set of functions to assist the scan data display tool.
|
| 3 |
# Kept here to unclutter the main script.
|
5 |
# Kept here to unclutter the main script.
|
| 4 |
#######################################################################
|
6 |
#######################################################################
|
| 5 |
#
|
7 |
#
|
| 6 |
#
|
8 |
#
|
| 7 |
# $Log: scanFunctions.pm,v $
|
9 |
# $Log: scanFunctions.pm,v $
|
| 8 |
#
|
10 |
#
|
| Line -... |
Line 11... |
| - |
|
11 |
|
| - |
|
12 |
#use strict;
|
| 9 |
|
13 |
use Exporter 'import';
|
| 10 |
use cPanelUserConfig;
|
14 |
use cPanelUserConfig;
|
| 11 |
use DBI ();
|
15 |
use DBI ();
|
| Line -... |
Line 16... |
| - |
|
16 |
use WebDB;
|
| - |
|
17 |
|
| 12 |
use WebDB;
|
18 |
our @EXPORT = qw( byfield currentTime exportExcel fetchColEntries fetchDerbyNameWithRCid filter getData getDBConnection inArray notInArray uniq whereInArray );
|
| 13 |
|
19 |
|
| Line 14... |
Line 20... |
| 14 |
#my $internalDBH = &getDBConnection || die "Unable to connect to Database\n\n";
|
20 |
#my $internalDBH = &getDBConnection || die "Unable to connect to Database\n\n";
|
| 15 |
my $internalDBH = WebDB->connect () || die "Unable to connect to Database\n\n";
|
21 |
my $internalDBH = WebDB->connect () || die "Unable to connect to Database\n\n";
|
| Line 108... |
Line 114... |
| 108 |
my $cathan;
|
114 |
my $cathan;
|
| 109 |
if (!$DEPT or $DEPT eq "CMP") {
|
115 |
if (!$DEPT or $DEPT eq "CMP") {
|
| 110 |
$cathan = $internalDBH->prepare("select RCid, derby_name from official where level > 0 order by derby_name");
|
116 |
$cathan = $internalDBH->prepare("select RCid, derby_name from official where level > 0 order by derby_name");
|
| 111 |
$cathan->execute();
|
117 |
$cathan->execute();
|
| 112 |
} else {
|
118 |
} else {
|
| 113 |
$cathan = $internalDBH->prepare("select RCid, derby_name from official where level > 0 and (department like ? and department not like ?) order by derby_name");
|
119 |
$cathan = $internalDBH->prepare("select RCid, derby_name from official where level > 0 and (department like ? and department not like ?) and last_login > CURRENT_DATE - INTERVAL 365 DAY order by derby_name");
|
| 114 |
$cathan->execute("%".$DEPT."%", "%".$DEPT."-0%");
|
120 |
$cathan->execute("%".$DEPT."%", "%".$DEPT."-0%");
|
| 115 |
}
|
121 |
}
|
| Line 116... |
Line 122... |
| 116 |
|
122 |
|
| 117 |
while (my ($id, $cat) = $cathan->fetchrow) {
|
123 |
while (my ($id, $cat) = $cathan->fetchrow) {
|
| Line 147... |
Line 153... |
| 147 |
return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
|
153 |
return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
|
| 148 |
}
|
154 |
}
|
| 149 |
} elsif ($colFilterTypeHash{$colName} eq 'text') {
|
155 |
} elsif ($colFilterTypeHash{$colName} eq 'text') {
|
| 150 |
if (defined $filter)
|
156 |
if (defined $filter)
|
| 151 |
{
|
157 |
{
|
| - |
|
158 |
if ($filter =~ /\d{1,2}:\d{2}/ and $ORCUSER->{timeformat} eq "ampm") {
|
| - |
|
159 |
my ($h, $m) = split /:/, $filter;
|
| - |
|
160 |
my $caret;
|
| - |
|
161 |
if ($h =~ s/^\^\s*//) { $caret = "^"; }
|
| - |
|
162 |
if ($h < 8) { $h += 12; }
|
| - |
|
163 |
$filter = $caret.join ":", $h, $m;
|
| - |
|
164 |
}
|
| - |
|
165 |
|
| 152 |
if ($filter =~ s/^=\s*//) { return "$colName = \"$filter\""; }
|
166 |
if ($filter =~ s/^=\s*//) { return "$colName = \"$filter\""; }
|
| Line 153... |
Line 167... |
| 153 |
|
167 |
|
| 154 |
if ($filter !~ s/^\^\s*//) { $filter = "\%$filter"; }
|
168 |
if ($filter !~ s/^\^\s*//) { $filter = "\%$filter"; }
|
| 155 |
if ($filter !~ s/\s*\$$//) { $filter = "$filter\%"; }
|
169 |
if ($filter !~ s/\s*\$$//) { $filter = "$filter\%"; }
|