| Line 3... |
Line 3... |
| 3 |
use strict;
|
3 |
use strict;
|
| 4 |
use Exporter;
|
4 |
use Exporter;
|
| 5 |
use CGI qw/:standard :netscape/;
|
5 |
use CGI qw/:standard :netscape/;
|
| 6 |
use CGI::Cookie;
|
6 |
use CGI::Cookie;
|
| 7 |
use DBI;
|
7 |
use DBI;
|
| - |
|
8 |
use WebDB;
|
| Line 8... |
Line -... |
| 8 |
|
- |
|
| - |
|
9 |
|
| 9 |
my $dsn = "DBI:mysql:database=rollerco_data;host=localhost;port=3306";
|
10 |
|
| 10 |
my $dbh = DBI->connect($dsn, 'rollerco_www', 'www-data');
|
11 |
my $dbh = WebDB->connect ();
|
| - |
|
12 |
our $ORCUSER;
|
| - |
|
13 |
use constant {
|
| - |
|
14 |
USER => 1,
|
| - |
|
15 |
LEAD => 2,
|
| - |
|
16 |
MANAGER => 3,
|
| - |
|
17 |
DIRECTOR => 4,
|
| - |
|
18 |
ADMIN => 5
|
| - |
|
19 |
};
|
| - |
|
20 |
|
| - |
|
21 |
sub getAccessLevels {
|
| - |
|
22 |
my %AccessLevels = (
|
| - |
|
23 |
-1 => "Locked",
|
| - |
|
24 |
0 => "Pending",
|
| - |
|
25 |
1 => "Volunteer",
|
| - |
|
26 |
2 => "Lead",
|
| - |
|
27 |
3 => "Manager",
|
| - |
|
28 |
4 => "Director",
|
| - |
|
29 |
5 => "SysAdmin"
|
| - |
|
30 |
);
|
| - |
|
31 |
return \%AccessLevels;
|
| Line 11... |
Line 32... |
| 11 |
our $ORCUSER;
|
32 |
}
|
| 12 |
|
33 |
|
| 13 |
sub authDB {
|
34 |
sub authDB {
|
| 14 |
my $src = shift;
|
35 |
my $src = shift;
|
| Line 39... |
Line 60... |
| 39 |
$result->{ERRMSG} = "Incorrect Password!";
|
60 |
$result->{ERRMSG} = "Incorrect Password!";
|
| 40 |
$result->{cookie_string} = '';
|
61 |
$result->{cookie_string} = '';
|
| 41 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
62 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
| 42 |
logit($RCDBIDHASH->{'RCid'}, "Incorrect Password");
|
63 |
logit($RCDBIDHASH->{'RCid'}, "Incorrect Password");
|
| 43 |
$result->{authenticated} = 'false';
|
64 |
$result->{authenticated} = 'false';
|
| 44 |
} elsif ($RCDBIDHASH->{'access'} < $level) {
|
65 |
} elsif (max ($RCDBIDHASH->{'access'}, values %{convertDepartments ($RCDBIDHASH->{department})}) < $level) {
|
| - |
|
66 |
if (getSetting ("MAINTENANCE")) {
|
| - |
|
67 |
$result->{ERRMSG} = "MAINTENANCE MODE: Logins are temporarily disabled.";
|
| - |
|
68 |
} else {
|
| 45 |
$result->{ERRMSG} = "Your account either needs to be activated, or doesn't have access to this page!";
|
69 |
$result->{ERRMSG} = "Your account either needs to be activated, or doesn't have access to this page!";
|
| - |
|
70 |
logit($RCDBIDHASH->{'RCid'}, "Insufficient Privileges");
|
| - |
|
71 |
}
|
| 46 |
$result->{cookie_string} = "${id}&${encpass}&$RCDBIDHASH->{'access'}";
|
72 |
$result->{cookie_string} = "${id}&${encpass}&$RCDBIDHASH->{'access'}";
|
| 47 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
73 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
| 48 |
logit($RCDBIDHASH->{'RCid'}, "Insufficient Privileges");
|
- |
|
| 49 |
$result->{authenticated} = 'false';
|
74 |
$result->{authenticated} = 'false';
|
| 50 |
} else {
|
75 |
} else {
|
| 51 |
$result->{ERRMSG} = '';
|
76 |
$result->{ERRMSG} = '';
|
| - |
|
77 |
$RCDBIDHASH->{department} = convertDepartments ($RCDBIDHASH->{department});
|
| - |
|
78 |
$RCDBIDHASH->{'access'} = max ($RCDBIDHASH->{'access'}, values %{$RCDBIDHASH->{department}});
|
| 52 |
$result->{cookie_string} = "${id}&${encpass}&$RCDBIDHASH->{'access'}";
|
79 |
$result->{cookie_string} = "${id}&${encpass}&$RCDBIDHASH->{'access'}";
|
| 53 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
80 |
$result->{RCid} = $RCDBIDHASH->{'RCid'};
|
| 54 |
logit($RCDBIDHASH->{'RCid'}, "Logged In") if $src eq "form";
|
81 |
logit($RCDBIDHASH->{'RCid'}, "Logged In") if $src eq "form";
|
| - |
|
82 |
$dbh->do ("update official set last_login = now() where RCid = ?", undef, $RCDBIDHASH->{'RCid'}) if $src eq "form";
|
| 55 |
$result->{authenticated} = 'true';
|
83 |
$result->{authenticated} = 'true';
|
| - |
|
84 |
# my @depts = map { s/-\d// } split /:/, $RCDBIDHASH->{department};
|
| - |
|
85 |
# my @depts = split /:/, $RCDBIDHASH->{department};
|
| - |
|
86 |
|
| 56 |
$ORCUSER=$RCDBIDHASH;
|
87 |
$ORCUSER=$RCDBIDHASH;
|
| 57 |
}
|
88 |
}
|
| 58 |
return $result;
|
89 |
return $result;
|
| 59 |
}
|
90 |
}
|
| Line -... |
Line 91... |
| - |
|
91 |
|
| - |
|
92 |
sub max {
|
| - |
|
93 |
my ($max, $next, @vars) = @_;
|
| - |
|
94 |
return $max if not $next;
|
| - |
|
95 |
return max( $max > $next ? $max : $next, @vars );
|
| - |
|
96 |
}
|
| 60 |
|
97 |
|
| 61 |
sub authenticate { # Verifies the user has logged in or puts up a log in screen
|
- |
|
| 62 |
# Check to see if the user has already logged in (there should be cookies with their authentication)?
|
98 |
sub authenticate { # Verifies the user has logged in or puts up a log in screen
|
| 63 |
my $MINLEVEL = shift || 1;
|
99 |
my $MAINTMODE = getSetting ("MAINTENANCE");
|
| - |
|
100 |
my $MINLEVEL = $MAINTMODE ? $MAINTMODE : shift // 1;
|
| 64 |
# my $MINLEVEL = 1;
|
101 |
|
| 65 |
my ($ERRMSG, $authenticated, %FORM);
|
102 |
my ($ERRMSG, $authenticated, %FORM);
|
| Line 66... |
Line 103... |
| 66 |
my $sth = $dbh->prepare("select * from official where email = '?'");
|
103 |
my $sth = $dbh->prepare("select * from official where email = '?'");
|
| - |
|
104 |
|
| - |
|
105 |
my $query = new CGI;
|
| 67 |
|
106 |
# Check to see if the user has already logged in (there should be cookies with their authentication)?
|
| 68 |
my $query = new CGI;
|
107 |
my $RCAUTH = $query->cookie('RCAUTH');
|
| 69 |
$FORM{'ID'} = $query->param('id') || '';
|
108 |
$FORM{'ID'} = $query->param('id') || '';
|
| 70 |
$FORM{'PASS'} = $query->param('pass') || '';
|
- |
|
| Line 71... |
Line 109... |
| 71 |
$FORM{'SUB'} = $query->param('login') || '';
|
109 |
$FORM{'PASS'} = $query->param('pass') || '';
|
| 72 |
my $RCAUTH = $query->cookie('RCAUTH');
|
110 |
$FORM{'SUB'} = $query->param('login') || '';
|
| 73 |
|
111 |
|
| 74 |
if ($FORM{'SUB'}) {
|
112 |
if ($FORM{'SUB'}) {
|
| Line 108... |
Line 146... |
| 108 |
print header(-cookie=>$RCAUTH_cookie);
|
146 |
print header(-cookie=>$RCAUTH_cookie);
|
| 109 |
printRCHeader("Please Sign In");
|
147 |
printRCHeader("Please Sign In");
|
| 110 |
print<<authpage;
|
148 |
print<<authpage;
|
| 111 |
<form action="$ENV{REQUEST_URI}" method=POST name=Req id=Req>
|
149 |
<form action="$ENV{REQUEST_URI}" method=POST name=Req id=Req>
|
| 112 |
<TR><TD colspan=2 align=center><b><font size=+2>Please Sign In</font>
|
150 |
<TR><TD colspan=2 align=center><b><font size=+2>Please Sign In</font>
|
| 113 |
|
151 |
<TABLE>
|
| 114 |
</TD></TR>
|
152 |
</TD></TR>
|
| 115 |
<TR><TD colspan=2> </TD></TR>
|
153 |
<TR><TD colspan=2> </TD></TR>
|
| 116 |
$authenticated->{ERRMSG}
|
154 |
$authenticated->{ERRMSG}
|
| 117 |
<TR>
|
155 |
<TR>
|
| 118 |
<TD align=right><B>User ID:</TD><TD><INPUT type=text name=id></TD>
|
156 |
<TD align=right><B>User ID:</TD><TD><INPUT type=text id=login name=id></TD>
|
| 119 |
</TR>
|
157 |
</TR>
|
| 120 |
<TR>
|
158 |
<TR>
|
| 121 |
<TD align=right><B>Password:</TD><TD><INPUT type=password name=pass></TD>
|
159 |
<TD align=right><B>Password:</TD><TD><INPUT type=password name=pass></TD>
|
| 122 |
</TR>
|
160 |
</TR>
|
| 123 |
<TR><TD></TD><TD><INPUT type=submit name=login value=Submit></TD></TR>
|
161 |
<TR><TD></TD><TD><INPUT type=submit name=login value=Submit></TD></TR>
|
| Line 127... |
Line 165... |
| 127 |
</TABLE>
|
165 |
</TABLE>
|
| 128 |
</FORM>
|
166 |
</FORM>
|
| Line 129... |
Line 167... |
| 129 |
|
167 |
|
| 130 |
<SCRIPT language="JavaScript">
|
168 |
<SCRIPT language="JavaScript">
|
| - |
|
169 |
<!--
|
| Line 131... |
Line 170... |
| 131 |
<!--
|
170 |
document.getElementById("login").focus();
|
| 132 |
|
171 |
|
| 133 |
function Login () {
|
172 |
function Login () {
|
| 134 |
document.getElementById('Req').action = "$ENV{SCRIPT_NAME}";
|
173 |
document.getElementById('Req').action = "$ENV{SCRIPT_NAME}";
|
| Line 147... |
Line 186... |
| 147 |
#}
|
186 |
#}
|
| 148 |
# &JScript;
|
187 |
# &JScript;
|
| 149 |
exit;
|
188 |
exit;
|
| 150 |
}
|
189 |
}
|
| Line -... |
Line 190... |
| - |
|
190 |
|
| - |
|
191 |
sub getShiftDepartment {
|
| - |
|
192 |
my $shiftID = shift // "";
|
| - |
|
193 |
my $dept;
|
| - |
|
194 |
|
| - |
|
195 |
if ($shiftID =~ /^\d+$/) {
|
| - |
|
196 |
($dept) = $dbh->selectrow_array ("select dept from shift where id = ?", undef, $shiftID);
|
| - |
|
197 |
} elsif ($shiftID =~ /^\d+-ANN/) {
|
| - |
|
198 |
$dept = "ANN";
|
| - |
|
199 |
} else {
|
| - |
|
200 |
$dept = "OFF";
|
| - |
|
201 |
}
|
| - |
|
202 |
|
| - |
|
203 |
return $dept;
|
| - |
|
204 |
}
|
| - |
|
205 |
|
| - |
|
206 |
sub getDepartments {
|
| - |
|
207 |
my $RCid = shift // "";
|
| - |
|
208 |
# If we get an RCid, return the list of departments and levels for that user.
|
| - |
|
209 |
# Otherwise (no parameter), return the list of departments with their display names.
|
| - |
|
210 |
|
| - |
|
211 |
if ($RCid) {
|
| - |
|
212 |
my $sth = $dbh->prepare("select department from official where RCid = ?");
|
| - |
|
213 |
$sth->execute($RCid);
|
| - |
|
214 |
my ($dlist) = $sth->fetchrow;
|
| - |
|
215 |
return convertDepartments ($dlist);
|
| - |
|
216 |
} else {
|
| - |
|
217 |
my %HASH;
|
| - |
|
218 |
my $sth = $dbh->prepare("select TLA, name from department");
|
| - |
|
219 |
$sth->execute();
|
| - |
|
220 |
while (my ($tla, $name) = $sth->fetchrow) {
|
| - |
|
221 |
$HASH{$tla} = $name;
|
| - |
|
222 |
}
|
| - |
|
223 |
return \%HASH;
|
| - |
|
224 |
}
|
| - |
|
225 |
|
| - |
|
226 |
}
|
| - |
|
227 |
|
| - |
|
228 |
sub convertDepartments {
|
| - |
|
229 |
# For the department membership, converts the DB string back and forth to a hashref...
|
| - |
|
230 |
my $input = shift // "";
|
| - |
|
231 |
my $output;
|
| - |
|
232 |
|
| - |
|
233 |
if (ref $input eq "HASH") {
|
| - |
|
234 |
$output = join ":", map { $_."-".$input->{$_} } sort keys %{$input};
|
| - |
|
235 |
} else {
|
| - |
|
236 |
foreach (split /:/, $input) {
|
| - |
|
237 |
my ($tla, $level) = split /-/;
|
| - |
|
238 |
$output->{$tla} = $level;
|
| - |
|
239 |
}
|
| - |
|
240 |
}
|
| - |
|
241 |
|
| - |
|
242 |
return $output;
|
| - |
|
243 |
}
|
| - |
|
244 |
|
| - |
|
245 |
sub getSchedule {
|
| - |
|
246 |
my $RCid = shift // return "ERROR: No RCid provided to getSchedule";
|
| - |
|
247 |
my $filter = shift // "";
|
| - |
|
248 |
|
| - |
|
249 |
my @whereclause;
|
| - |
|
250 |
push @whereclause, "date >= date(now())" unless $filter eq "all";
|
| - |
|
251 |
# if ($RCid ne $ORCUSER->{RCid}) {
|
| - |
|
252 |
# push @whereclause, "dept != 'PER'";
|
| - |
|
253 |
# }
|
| - |
|
254 |
|
| - |
|
255 |
use DateTime;
|
| - |
|
256 |
my $dt = DateTime->today;
|
| - |
|
257 |
$dt =~ s/T00\:00\:00$//;
|
| - |
|
258 |
my $now = DateTime->now;
|
| - |
|
259 |
|
| - |
|
260 |
|
| - |
|
261 |
use HTML::Tiny;
|
| - |
|
262 |
my $h = HTML::Tiny->new( mode => 'html' );
|
| - |
|
263 |
|
| - |
|
264 |
my $where = scalar @whereclause ? "where ".join " and ", @whereclause : "";
|
| - |
|
265 |
my @shifts;
|
| - |
|
266 |
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track as location, time, role, teams, gtype, 'OFF' as dept, volhours from v_shift_officiating where RCid = ? union
|
| - |
|
267 |
select id, date, dayofweek, track as location, time, role, teams, gtype, 'ANN' as dept, volhours from v_shift_announcer where RCid = ? union
|
| - |
|
268 |
select id, date, dayofweek, location, time, role, '' as teams, type as gtype, dept, volhours from v_shift where RCid = ?) temp
|
| - |
|
269 |
$where order by date, time");
|
| - |
|
270 |
$sth->execute($RCid, $RCid, $RCid);
|
| - |
|
271 |
my $hours;
|
| - |
|
272 |
while (my $s = $sth->fetchrow_hashref) {
|
| - |
|
273 |
my ($yyyy, $mm, $dd) = split /\-/, $s->{date};
|
| - |
|
274 |
my $cutoff = DateTime->new(
|
| - |
|
275 |
year => $yyyy,
|
| - |
|
276 |
month => $mm,
|
| - |
|
277 |
day => $dd,
|
| - |
|
278 |
hour => 5,
|
| - |
|
279 |
minute => 0,
|
| - |
|
280 |
second => 0,
|
| - |
|
281 |
time_zone => 'America/Los_Angeles'
|
| - |
|
282 |
);
|
| - |
|
283 |
|
| - |
|
284 |
|
| - |
|
285 |
if (!$s->{teams}) {
|
| - |
|
286 |
# it's a time-based shift
|
| - |
|
287 |
if ($s->{dept} eq "PER") {
|
| - |
|
288 |
if ($RCid eq $ORCUSER->{RCid}) {
|
| - |
|
289 |
# DROP
|
| - |
|
290 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to delete this personal time?')==true) { window.open('manage_personal_time.pl?choice=Delete&id=$s->{id}','Confirm Change','resizable,height=260,width=370'); return false; }" }, "DEL")." ".$h->button ({ onClick=>"location.href='manage_personal_time.pl?choice=Update&id=$s->{id}'" }, "EDIT");
|
| - |
|
291 |
} else {
|
| - |
|
292 |
$s->{location} = "";
|
| - |
|
293 |
$s->{role} = "";
|
| - |
|
294 |
}
|
| - |
|
295 |
} elsif (($RCid == $ORCUSER->{RCid} and $s->{gtype} !~ /^selected/ and $now < $cutoff) or ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5)) {
|
| - |
|
296 |
# DROP
|
| - |
|
297 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to drop this shift?')==true) { window.open('make_shift_change.pl?change=del&id=$s->{id}','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "DROP");
|
| - |
|
298 |
if ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5) {
|
| - |
|
299 |
# NO SHOW
|
| - |
|
300 |
$s->{buttons} .= " ".$h->button ({ onClick=>"if (confirm('Really? They were a no show?')==true) { window.open('make_shift_change.pl?noshow=true&change=del&RCid=$RCid&id=$s->{id}','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "NO SHOW");
|
| - |
|
301 |
}
|
| - |
|
302 |
$hours += $s->{volhours};
|
| - |
|
303 |
}
|
| - |
|
304 |
|
| - |
|
305 |
} elsif (($RCid == $ORCUSER->{RCid} and $s->{gtype} !~ /^selected/ and $now < $cutoff) or ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5)) {
|
| - |
|
306 |
# it's a game shift
|
| - |
|
307 |
#DROP
|
| - |
|
308 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to drop this shift?')==true) { window.open('make_shift_change.pl?change=del&RCid=$RCid&id=$s->{id}&role=$s->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "DROP");
|
| - |
|
309 |
if ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5) {
|
| - |
|
310 |
# NO SHOW
|
| - |
|
311 |
$s->{buttons} .= " ".$h->button ({ onClick=>"if (confirm('Really? They were a no show?')==true) { window.open('make_shift_change.pl?noshow=true&change=del&RCid=$RCid&id=$s->{id}&role=$s->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "NO SHOW");
|
| - |
|
312 |
}
|
| - |
|
313 |
$hours += $s->{volhours};
|
| - |
|
314 |
}
|
| - |
|
315 |
$s->{role} =~ s/\-\d$//;
|
| - |
|
316 |
|
| - |
|
317 |
push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "nowrap highlighted" : "nowrap shaded" }, join ' ', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
|
| - |
|
318 |
}
|
| - |
|
319 |
|
| - |
|
320 |
if (scalar @shifts) {
|
| - |
|
321 |
return $h->ul ([ @shifts, $h->h5 ("Currently showing $hours hours of Volunteer Time.") ]);
|
| - |
|
322 |
} else {
|
| - |
|
323 |
return $h->p ({ class=>"hint" }, "[nothing scheduled at the moment]");
|
| - |
|
324 |
}
|
| - |
|
325 |
}
|
| 151 |
|
326 |
|
| 152 |
sub getSetting {
|
327 |
sub getSetting {
|
| 153 |
my $k = shift;
|
328 |
my $k = shift;
|
| 154 |
my $sth = $dbh->prepare("select setting.value from setting where setting.key = ?");
|
329 |
my $sth = $dbh->prepare("select setting.value from setting where setting.key = ?");
|
| 155 |
$sth->execute($k);
|
330 |
$sth->execute($k);
|
| 156 |
return $sth->fetchrow_hashref()->{value};
|
331 |
return $sth->fetchrow_hashref()->{value};
|
| Line 157... |
Line 332... |
| 157 |
}
|
332 |
}
|
| 158 |
|
333 |
|
| - |
|
334 |
sub getUser {
|
| - |
|
335 |
my $ID = shift;
|
| - |
|
336 |
|
| - |
|
337 |
my $sth;
|
| - |
|
338 |
if ($ID =~ /^\d+$/) {
|
| 159 |
sub getUser {
|
339 |
$sth = $dbh->prepare("select * from official where RCid = ?");
|
| - |
|
340 |
} else {
|
| 160 |
my $EML = shift;
|
341 |
$sth = $dbh->prepare("select * from official where email = ?");
|
| 161 |
my $sth = $dbh->prepare("select * from official where email = ?");
|
342 |
}
|
| 162 |
$sth->execute($EML);
|
343 |
$sth->execute($ID);
|
| Line 163... |
Line 344... |
| 163 |
return $sth->fetchrow_hashref();
|
344 |
return $sth->fetchrow_hashref;
|
| 164 |
}
|
345 |
}
|
| 165 |
|
346 |
|
| Line 178... |
Line 359... |
| 178 |
my ($dname) = $sth->fetchrow_array();
|
359 |
my ($dname) = $sth->fetchrow_array();
|
| 179 |
return $dname;
|
360 |
return $dname;
|
| 180 |
}
|
361 |
}
|
| Line 181... |
Line 362... |
| 181 |
|
362 |
|
| 182 |
sub getYears {
|
363 |
sub getYears {
|
| - |
|
364 |
# my $sth = $dbh->prepare("select distinct year(date) from v_shift_admin_view union select year(now())");
|
| 183 |
my $sth = $dbh->prepare("select distinct year(date) from v_shift_admin_view union select year(now())");
|
365 |
my $sth = $dbh->prepare("select distinct year(date) from v_shift_admin_view");
|
| 184 |
$sth->execute();
|
366 |
$sth->execute();
|
| 185 |
my @years;
|
367 |
my @years;
|
| 186 |
while (my ($y) =$sth->fetchrow_array()) { push @years, $y; }
|
368 |
while (my ($y) =$sth->fetchrow_array()) { push @years, $y; }
|
| 187 |
return \@years;
|
369 |
return \@years;
|
| Line 188... |
Line 370... |
| 188 |
}
|
370 |
}
|
| 189 |
|
371 |
|
| - |
|
372 |
sub printRCHeader {
|
| - |
|
373 |
my $PAGE_TITLE = shift;
|
| - |
|
374 |
use CGI qw/start_html/;
|
| - |
|
375 |
use HTML::Tiny;
|
| - |
|
376 |
my $h = HTML::Tiny->new( mode => 'html' );
|
| - |
|
377 |
|
| 190 |
sub printRCHeader {
|
378 |
# my $logout = $h->a ({ href=>"index.pl", onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;" }, "[Log Out]");
|
| Line 191... |
Line 379... |
| 191 |
my $PAGE_TITLE = shift;
|
379 |
my $logout = $h->button ({ onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/'; location.href='/';" }, "Log Out");
|
| - |
|
380 |
my $loggedinas = $ORCUSER ? "Currently logged in as: ".$h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$ORCUSER->{RCid}" }, $ORCUSER->{derby_name})." $logout" : "";
|
| 192 |
my $loggedinas = $ORCUSER ? "Currently logged in as: $ORCUSER->{derby_name}" : "";
|
381 |
|
| 193 |
|
382 |
print start_html (-title=>"vORC - $PAGE_TITLE", -style => {'src' => "/style.css"} );
|
| 194 |
print<<rcheader;
|
383 |
|
| 195 |
<html><head><title>Officials' RollerCon Schedule Manager - $PAGE_TITLE</title>
|
384 |
#<html><head><title>Officials' RollerCon Schedule Manager - $PAGE_TITLE</title>
|
| - |
|
385 |
#<link rel="stylesheet" type="text/css" href="/style.css">
|
| - |
|
386 |
#</head>
|
| - |
|
387 |
#<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
| - |
|
388 |
print $h->div ({ class=>"sp0" }, [ $h->div ({ class=>"spLeft" }, $h->a ({ href=>"/schedule/" }, $h->img ({ src=>"/logo.jpg", width=>"75", height=>"75" }))),
|
| - |
|
389 |
$h->div ({ class=>"spRight" }, [ $h->h1 (["vORC $PAGE_TITLE", $h->br]),
|
| - |
|
390 |
$loggedinas,
|
| 196 |
<link rel="stylesheet" type="text/css" href="/rollercon.css">
|
391 |
])
|
| 197 |
</head>
|
392 |
]);
|
| 198 |
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
393 |
#print<<rcheader;
|
| 199 |
<TABLE>
|
394 |
# <TABLE>
|
| 200 |
<TR class="nostripe">
|
395 |
# <TR class="nostripe">
|
| 201 |
<TD align=right><img SRC="/logo.jpg"></TD>
|
396 |
# <TD align=right><img SRC="/logo.jpg"></TD>
|
| Line 202... |
Line 397... |
| 202 |
<TD align=center valign=middle><b><font size=+3>Officials' RollerCon<br>Schedule Manager<br>$PAGE_TITLE</FONT></b>
|
397 |
# <TD align=center valign=middle><b><font size=+3>Officials' RollerCon<br>Schedule Manager<br>$PAGE_TITLE</FONT></b>
|
| 203 |
<p align=right><font size=-2>$loggedinas <a href='index.pl' onClick="document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;">[Log Out]</a></font></TD>
|
398 |
# <p align=right><font size=-2>$loggedinas <a href='index.pl' onClick="document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;">[Log Out]</a></font></TD>
|
| Line 204... |
Line 399... |
| 204 |
</TR>
|
399 |
# </TR>
|
| 205 |
|
400 |
|
| 206 |
rcheader
|
401 |
#rcheader
|
| - |
|
402 |
}
|
| - |
|
403 |
|
| - |
|
404 |
sub changeShift {
|
| - |
|
405 |
my ($change, $shift_id, $role, $user_id) = @_;
|
| - |
|
406 |
my $leadership_change = 0;
|
| - |
|
407 |
my $department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
|
| - |
|
408 |
my $game_based = $role ? "game" : "shift";
|
| - |
|
409 |
my $sth;
|
| - |
|
410 |
|
| - |
|
411 |
if ($change eq "add") {
|
| - |
|
412 |
my $taken;
|
| - |
|
413 |
if ($game_based eq "game") {
|
| - |
|
414 |
($taken) = $dbh->selectrow_array ("select count(*) from assignment where Gid = ? and role = ?", undef, $shift_id, $role);
|
| - |
|
415 |
} else {
|
| - |
|
416 |
($taken) = $dbh->selectrow_array ("select count(*) from shift where id = ? and isnull(assignee_id) = 0", undef, $shift_id);
|
| Line 207... |
Line -... |
| 207 |
}
|
- |
|
| 208 |
|
- |
|
| 209 |
sub changeShift {
|
- |
|
| 210 |
my ($change, $game_id, $role, $user_id) = @_;
|
- |
|
| 211 |
my $countbypass = 0;
|
417 |
}
|
| 212 |
|
418 |
if ($taken) {
|
| 213 |
my $sth = $dbh->prepare("select type from game where id = ?");
|
419 |
return "<br>Denied! This shift is already taken ($shift_id).<br>\n";
|
| 214 |
$sth->execute($game_id);
|
420 |
}
|
| - |
|
421 |
}
|
| 215 |
my ($game_type) = $sth->fetchrow_array;
|
422 |
|
| 216 |
|
423 |
if (lc ($user_id) ne lc ($ORCUSER->{RCid})) { # they're changing someone else's schedule...
|
| 217 |
if (lc($user_id) ne lc($ORCUSER->{RCid})) {
|
424 |
if ($ORCUSER->{department}->{$department} >= 2 or $ORCUSER->{access} >= 5) {
|
| 218 |
if ($ORCUSER->{access} < 2) {
|
425 |
# the user making the change is either a lead in the dept or a sysadmin
|
| 219 |
print "<br>Denied! You are not authorized to change someone else's schedule.<br>\n";
|
426 |
logit ($ORCUSER->{RCid}, "$ORCUSER->{derby_name} changed someone else's schedule. ($change, $shift_id, $role, $user_id)");
|
| - |
|
427 |
logit ($user_id, "Schedule was changed by $ORCUSER->{derby_name}. ($change, $shift_id, $role, $user_id)");
|
| - |
|
428 |
$leadership_change = 1;
|
| - |
|
429 |
} else {
|
| 220 |
logit($ORCUSER->{RCid}, "Unauthorized attempt to change someone else's schedule. ($change, $game_id, $role, $user_id)");
|
430 |
logit ($ORCUSER->{RCid}, "Unauthorized attempt to change someone else's schedule. ($change, $shift_id, $role, $user_id)");
|
| Line 221... |
Line 431... |
| 221 |
return;
|
431 |
return "<br>Denied! You are not authorized to change someone else's schedule in this department ($department).<br>\n";
|
| 222 |
} else {
|
432 |
}
|
| - |
|
433 |
} elsif ($ORCUSER->{department}->{$department} >= 3) {
|
| 223 |
logit($ORCUSER->{RCid}, "$ORCUSER->{derby_name} changed someone else's schedule. ($change, $game_id, $role, $user_id)");
|
434 |
# Managers can sign up for as many shifts within their own department as they like...
|
| 224 |
$countbypass = 1;
|
- |
|
| 225 |
}
|
435 |
$leadership_change = 1;
|
| 226 |
}
|
436 |
}
|
| 227 |
|
- |
|
| 228 |
my $MAXSHIFTS = $game_type eq "clinic" ? getSetting("MAX_CLINIC_SIGNUPS") : $game_type eq "observation" ? getSetting("MAX_OBS_SIGNUPS") : getSetting("MAX_SHIFT_SIGNUP_PER_DAY");
|
437 |
|
| 229 |
# my $MAXSHIFTS = getSetting("MAX_SHIFT_SIGNUP_PER_DAY");
|
438 |
if ($change eq "add" and convertDepartments(getUser($user_id)->{department})->{$department} < 1) {
|
| - |
|
439 |
return "<br>Denied! User ($user_id) is not a member of Department ($department)!<br>\n";
|
| 230 |
|
440 |
}
|
| 231 |
my $daily_count = signUpCount('get', $user_id, $game_type);
|
441 |
|
| - |
|
442 |
if ($change eq "add" and findConflict ($user_id, $shift_id, $game_based)) {
|
| - |
|
443 |
return "<br>Denied! There is a conflict with that shift's time!<br>\n";
|
| 232 |
if ($change eq "add" and $daily_count >= $MAXSHIFTS and !$countbypass) {
|
444 |
}
|
| 233 |
print "<br>Denied! You may only sign up for $MAXSHIFTS $game_type shifts in one day!<br>\n";
|
445 |
|
| 234 |
return;
|
446 |
my ($game_type) = $dbh->selectrow_array ("select type from ".$game_based." where id = ?", undef, $shift_id);
|
| - |
|
447 |
if ($game_type =~ /^selected/ and !$leadership_change) {
|
| 235 |
}
|
448 |
return "<br>Denied! Only leadership can make changes to 'selected staffing' shifts!<br>\n";
|
| 236 |
|
449 |
}
|
| 237 |
if ($change eq "add" and ($daily_count < $MAXSHIFTS or $countbypass)) {
|
450 |
|
| 238 |
$sth = $dbh->prepare("insert into assignment (Gid, role, RCid) values (?, ?, ?)");
|
451 |
if ($change eq "add" and $game_type eq "lead" and convertDepartments(getUser($user_id)->{department})->{$department} < 2 and $ORCUSER->{access} < 3) {
|
| - |
|
452 |
return "<br>Denied! Shift reserved for leadership staff!<br>\n";
|
| - |
|
453 |
}
|
| - |
|
454 |
|
| 239 |
} elsif ($change eq "del") {
|
455 |
my $MAXSHIFTS = getSetting ("MAX_SHIFT_SIGNUP_PER_DAY");
|
| 240 |
$sth = $dbh->prepare("delete from assignment where Gid = ? and role = ? and RCid= ?");
|
- |
|
| 241 |
}
|
456 |
my $daily_count = signUpCount ('get', $user_id);
|
| 242 |
print "<br>attempting to make DB changes...<br>";
|
457 |
if ($change eq "add" and $daily_count >= $MAXSHIFTS and !$leadership_change) {
|
| 243 |
if ($sth->execute($game_id, $role, $user_id)) {
|
458 |
return "<br>Denied! You may only sign up for $MAXSHIFTS $game_type shifts in one day!<br>\n";
|
| 244 |
$daily_count = signUpCount($change, $user_id, $game_type) unless $countbypass;
|
459 |
}
|
| 245 |
logit($user_id, "Shift ".ucfirst($change).": $game_id -> $role");
|
460 |
|
| - |
|
461 |
my @DBARGS;
|
| 246 |
if ($game_type eq "clinic") {
|
462 |
if ($game_based eq "game") {
|
| - |
|
463 |
if ($change eq "add") {
|
| - |
|
464 |
$sth = $dbh->prepare("insert into assignment (Gid, role, RCid) values (?, ?, ?)");
|
| - |
|
465 |
} elsif ($change eq "del") {
|
| - |
|
466 |
$sth = $dbh->prepare("delete from assignment where Gid = ? and role = ? and RCid= ?");
|
| - |
|
467 |
}
|
| - |
|
468 |
@DBARGS = ($shift_id, $role, $user_id);
|
| - |
|
469 |
} else {
|
| - |
|
470 |
if ($change eq "add") {
|
| - |
|
471 |
$sth = $dbh->prepare("update shift set assignee_id = ? where id = ?");
|
| - |
|
472 |
@DBARGS = ($user_id, $shift_id);
|
| - |
|
473 |
} elsif ($change eq "del") {
|
| - |
|
474 |
$sth = $dbh->prepare("update shift set assignee_id = null where id = ?");
|
| - |
|
475 |
@DBARGS = ($shift_id);
|
| - |
|
476 |
}
|
| - |
|
477 |
}
|
| - |
|
478 |
|
| 247 |
print "Success!...<br>You've signed up for $daily_count clinic shifts (you're currently allowed to sign up for $MAXSHIFTS total).<br>\n";
|
479 |
print "<br>attempting to make DB changes...<br>";
|
| - |
|
480 |
if ($sth->execute (@DBARGS)) {
|
| - |
|
481 |
$daily_count = signUpCount ($change, $user_id) unless $leadership_change;
|
| - |
|
482 |
logit ($user_id, "Shift ".ucfirst($change).": $shift_id -> $role");
|
| - |
|
483 |
print "Success!...<br>You've signed up for $daily_count shifts today (you're currently allowed to sign up for $MAXSHIFTS per day).<br>\n";
|
| - |
|
484 |
return;
|
| - |
|
485 |
} else {
|
| - |
|
486 |
return "<br><b>You did not get the shift</b>, most likely because someone else took it while you were looking.<br>\nERROR: ", $sth->errstr();
|
| - |
|
487 |
}
|
| - |
|
488 |
}
|
| - |
|
489 |
|
| - |
|
490 |
sub modShiftTime {
|
| 248 |
} elsif ($game_type eq "observation") {
|
491 |
my ($shift_id, $user_id, $diff) = @_;
|
| - |
|
492 |
my $ORCUSER = getUser (1);
|
| - |
|
493 |
|
| - |
|
494 |
use Scalar::Util qw(looks_like_number);
|
| - |
|
495 |
if (!looks_like_number ($diff)) {
|
| - |
|
496 |
print "<br>ERROR! The time adjustment ($diff) doesn't look like a number.<br>\n";
|
| - |
|
497 |
return;
|
| - |
|
498 |
}
|
| - |
|
499 |
|
| - |
|
500 |
my ($validate_assignee) = $dbh->selectrow_array ("select count(*) from v_shift where id = ? and RCid = ?", undef, $shift_id, $user_id);
|
| - |
|
501 |
if (!$validate_assignee) {
|
| - |
|
502 |
print "<br>ERROR! This shift is assigned to someone else.<br>\n";
|
| - |
|
503 |
return;
|
| - |
|
504 |
}
|
| - |
|
505 |
|
| - |
|
506 |
my $department = getShiftDepartment ($shift_id);
|
| - |
|
507 |
if (convertDepartments ($ORCUSER->{department})->{$department} < 2 and $ORCUSER->{access} < 5) {
|
| - |
|
508 |
print "<br>ERROR! You're not authorized to modify this shift's time.<br>\n";
|
| - |
|
509 |
logit ($ORCUSER->{RCid}, "Unauthorized attempt to modify shift time. ($department, $shift_id)");
|
| - |
|
510 |
return;
|
| - |
|
511 |
}
|
| - |
|
512 |
|
| - |
|
513 |
my $rows_changed;
|
| - |
|
514 |
print "<br>attempting to make DB changes...<br>";
|
| - |
|
515 |
if ($diff == 0) {
|
| - |
|
516 |
$rows_changed = $dbh->do ("update shift set mod_time = null where id = ? and assignee_id = ?", undef, $shift_id, $user_id);
|
| - |
|
517 |
} else {
|
| - |
|
518 |
$rows_changed = $dbh->do ("update shift set mod_time = ? where id = ? and assignee_id = ?", undef, $diff, $shift_id, $user_id);
|
| - |
|
519 |
}
|
| - |
|
520 |
|
| - |
|
521 |
|
| - |
|
522 |
if (!$rows_changed or $dbh->errstr) {
|
| - |
|
523 |
print "ERROR: Nothing got updated".$dbh->errstr;
|
| 249 |
print "Success!...<br>You've signed up for $daily_count clinic observation game (you're currently allowed to sign up for $MAXSHIFTS total).<br>\n";
|
524 |
logit (0, "ERROR modifying a shift time ($diff, $shift_id, $user_id):".$dbh->errstr);
|
| Line 250... |
Line 525... |
| 250 |
} else {
|
525 |
} else {
|
| 251 |
print "Success!...<br>You've signed up for $daily_count challenge / scrimmage shifts today (you're currently allowed to sign up for $MAXSHIFTS per day).<br>\n";
|
526 |
print "SUCCESS: Shift $shift_id succesfully modified by $diff hour(s)";
|
| 252 |
}
|
527 |
logit ($ORCUSER->{RCid}, "SUCCESS: Shift $shift_id succesfully modified by $diff hour(s)");
|
| 253 |
} else {
|
528 |
|
| Line 254... |
Line 529... |
| 254 |
print "<br><b>You did not get the shift</b>, most likely because someone else took it while you were looking.<br>\nERROR: ", $sth->errstr();
|
529 |
}
|
| 255 |
}
|
530 |
return;
|
| 256 |
}
|
531 |
}
|
| 257 |
|
532 |
|
| 258 |
sub signUpCount {
|
533 |
sub signUpCount {
|
| 259 |
my $action = shift;
|
534 |
my $action = shift;
|
| 260 |
my $id = shift;
|
535 |
my $id = shift;
|
| 261 |
my $gtype = shift // "";
|
536 |
my $gtype = shift // "";
|
| 262 |
|
537 |
|
| 263 |
if ($gtype ne "clinic" and $gtype ne "observation" and $id eq $ORCUSER->{RCid}) {
|
538 |
if ($id eq $ORCUSER->{RCid}) {
|
| 264 |
if ($action eq 'add') {
|
539 |
if ($action eq 'add') {
|
| 265 |
if (signUpCount('get', $id)) {
|
540 |
if (signUpCount ('get', $id)) {
|
| 266 |
$dbh->do("update sign_up_count set sign_ups = sign_ups + 1 where date = curdate() and RCid = $id");
|
541 |
$dbh->do("update sign_up_count set sign_ups = sign_ups + 1 where date = curdate() and RCid = ?", undef, $id);
|
| Line 267... |
Line -... |
| 267 |
} else {
|
- |
|
| 268 |
$dbh->do("replace into sign_up_count values (curdate(), $id, 1)");
|
- |
|
| 269 |
}
|
- |
|
| 270 |
} elsif ($action eq 'del') {
|
- |
|
| 271 |
if (signUpCount('get', $id)) {
|
- |
|
| 272 |
$dbh->do("update sign_up_count set sign_ups = sign_ups - 1 where date = curdate() and RCid = $id");
|
- |
|
| 273 |
}
|
542 |
} else {
|
| 274 |
}
|
- |
|
| 275 |
}
|
- |
|
| 276 |
|
- |
|
| Line 277... |
Line 543... |
| 277 |
my $get;
|
543 |
$dbh->do("replace into sign_up_count values (curdate(), ?, 1)", undef, $id);
|
| 278 |
if ($gtype eq "clinic") {
|
544 |
}
|
| Line 279... |
Line 545... |
| 279 |
$get = $dbh->prepare("select count(*) from v_shift where RCid = ? and gtype = 'clinic' and date >= '2019'");
|
545 |
} elsif ($action eq 'del') {
|
| 280 |
} elsif ($gtype eq "observation") {
|
546 |
if (signUpCount ('get', $id)) {
|
| 281 |
$get = $dbh->prepare("select count(*) from v_shift where RCid = ? and gtype = 'observation' and date >= '2019'");
|
547 |
$dbh->do("update sign_up_count set sign_ups = sign_ups - 1 where date = curdate() and RCid = ?", undef, $id);
|
| - |
|
548 |
}
|
| Line 282... |
Line 549... |
| 282 |
} else {
|
549 |
}
|
| 283 |
$get = $dbh->prepare("select sign_ups from sign_up_count where RCid = ? and date = curdate()");
|
550 |
}
|
| 284 |
}
|
551 |
|
| 285 |
$get->execute($id);
|
552 |
my ($R) = $dbh->selectrow_array ("select sign_ups from sign_up_count where RCid = ? and date = curdate()", undef, $id);
|
| 286 |
my ($R) = $get->fetchrow_array();
|
553 |
|
| 287 |
|
- |
|
| 288 |
return $R ? $R : '0';
|
- |
|
| 289 |
}
|
- |
|
| 290 |
|
- |
|
| 291 |
sub signUpEligible {
|
- |
|
| 292 |
my $user = shift;
|
- |
|
| Line 293... |
Line 554... |
| 293 |
my $t = shift;
|
554 |
return $R ? $R : '0';
|
| 294 |
|
- |
|
| 295 |
if (findConflict($user->{RCid}, $t->{id})) { return 0; }
|
- |
|
| 296 |
|
- |
|
| 297 |
if (!exists $user->{sign_ups_today}) {
|
555 |
}
|
| 298 |
$user->{sign_ups_today} = signUpCount('get', $user->{RCid});
|
556 |
|
| 299 |
}
|
557 |
sub signUpEligible {
|
| 300 |
if (!exists $user->{clinic_sign_ups}) {
|
558 |
my $user = shift;
|
| 301 |
$user->{clinic_sign_ups} = signUpCount('get', $user->{RCid}, "clinic");
|
559 |
my $t = shift;
|
| - |
|
560 |
my $shifttype = shift // "game";
|
| 302 |
}
|
561 |
|
| 303 |
if (!exists $user->{obs_sign_ups}) {
|
562 |
if (findConflict ($user->{RCid}, $t->{id}, $shifttype)) { return 0; }
|
| 304 |
$user->{obs_sign_ups} = signUpCount('get', $user->{RCid}, "observation");
|
- |
|
| 305 |
}
|
563 |
|
| 306 |
|
564 |
if (!exists $user->{sign_ups_today}) {
|
| 307 |
if ($t->{gtype} eq "clinic") {
|
565 |
$user->{sign_ups_today} = signUpCount('get', $user->{RCid});
|
| 308 |
# Uncomment to open clinic games to everyone...
|
566 |
}
|
| 309 |
return 1;
|
567 |
|
| 310 |
#---------------------------------
|
568 |
if ($shifttype eq "game") {
|
| 311 |
if ($user->{clinic_pass} and $user->{clinic_sign_ups} < getSetting("MAX_CLINIC_SIGNUPS")) {
|
- |
|
| 312 |
return 1;
|
- |
|
| 313 |
} else {
|
- |
|
| 314 |
return 0;
|
- |
|
| 315 |
}
|
569 |
if ($t->{gtype} !~ /^selected/ and $t->{gtype} ne "short track" and $user->{sign_ups_today} < getSetting("MAX_SHIFT_SIGNUP_PER_DAY")) {
|
| 316 |
} elsif ($t->{gtype} eq "observation") {
|
- |
|
| 317 |
# Uncomment to open observation games to everyone...
|
570 |
return 1;
|
| Line 318... |
Line 571... |
| 318 |
# return 1;
|
571 |
} else {
|
| 319 |
#---------------------------------
|
572 |
return 0;
|
| 320 |
if ($user->{clinic_pass} and $user->{obs_sign_ups} < getSetting("MAX_OBS_SIGNUPS")) {
|
573 |
}
|
| 321 |
return 1;
|
574 |
} else {
|
| - |
|
575 |
if ($user->{department}->{$t->{dept}} < 1) { return 0; }
|
| Line -... |
Line 576... |
| - |
|
576 |
if ($t->{type} eq "lead" and $user->{department}->{$t->{dept}} < 2) { return 0; }
|
| 322 |
} else {
|
577 |
if ($t->{type} eq "manager" and $user->{department}->{$t->{dept}} < 3) { return 0; }
|
| - |
|
578 |
if ($t->{type} !~ /^selected/ and $user->{sign_ups_today} < getSetting("MAX_SHIFT_SIGNUP_PER_DAY")) {
|
| 323 |
return 0;
|
579 |
return 1;
|
| 324 |
}
|
580 |
} else {
|
| - |
|
581 |
return 0;
|
| 325 |
} elsif ($t->{gtype} ne "selected staffing" and $t->{gtype} ne "short track" and $user->{sign_ups_today} < getSetting("MAX_SHIFT_SIGNUP_PER_DAY")) {
|
582 |
}
|
| - |
|
583 |
}
|
| - |
|
584 |
}
|
| 326 |
return 1;
|
585 |
|
| - |
|
586 |
sub findConflict {
|
| - |
|
587 |
my $rcid = shift;
|
| - |
|
588 |
my $gid = shift;
|
| - |
|
589 |
my $type = shift // "";
|
| Line 327... |
Line 590... |
| 327 |
} else {
|
590 |
my ($date, $start, $end, $conflicts);
|
| 328 |
return 0;
|
591 |
|
| 329 |
}
|
592 |
if ($type eq "game") {
|
| 330 |
|
- |
|
| 331 |
}
|
- |
|
| 332 |
|
- |
|
| Line -... |
Line 593... |
| - |
|
593 |
# Are they already signed up for this game? (It's faster to check the two views one at a time...)
|
| - |
|
594 |
# ($conflicts) = $dbh->selectrow_array ("select count(*) from v_shift_officiating where substring_index(id, '-', 1) = ? and RCid = ?", undef, $gid, $rcid);
|
| - |
|
595 |
($conflicts) = $dbh->selectrow_array ("select count(*) from v_shift_officiating where id = ? and RCid = ?", undef, $gid, $rcid);
|
| - |
|
596 |
if ($conflicts) { return 1; } # no need to keep looking...
|
| - |
|
597 |
($conflicts) = $dbh->selectrow_array ("select count(*) from v_shift_announcer where id = ? and RCid = ?", undef, $gid, $rcid);
|
| - |
|
598 |
if ($conflicts) { return 1; } # no need to keep looking...
|
| - |
|
599 |
|
| 333 |
sub findConflict {
|
600 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, time, end_time from game where id = ?", undef, $gid);
|
| 334 |
my $rcid = shift;
|
601 |
} elsif ($type eq "personal") {
|
| Line 335... |
Line 602... |
| 335 |
my $gid = shift;
|
602 |
($date, $start, $end) = @{ $gid };
|
| 336 |
my $conflicts;
|
603 |
} else {
|