| Line 7... |
Line 7... |
| 7 |
use CGI qw/param header start_html url/;
|
7 |
use CGI qw/param header start_html url/;
|
| 8 |
use CGI::Cookie;
|
8 |
use CGI::Cookie;
|
| 9 |
use DBI;
|
9 |
use DBI;
|
| 10 |
use WebDB;
|
10 |
use WebDB;
|
| Line 11... |
Line 11... |
| 11 |
|
11 |
|
| Line 12... |
Line 12... |
| 12 |
our @EXPORT = qw( $ORCUSER getRCDBH getAccessLevels authDB max authenticate canView getShiftDepartment getClassID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit );
|
12 |
our @EXPORT = qw( $ORCUSER getRCDBH getAccessLevels authDB max authenticate canView getShiftDepartment getClassID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit);
|
| 13 |
|
13 |
|
| 14 |
my $dbh = WebDB->connect ();
|
14 |
my $dbh = WebDB->connect ();
|
| 15 |
sub getRCDBH {
|
15 |
sub getRCDBH {
|
| Line 279... |
Line 279... |
| 279 |
if ($ADept->{$_} > 1) { # A is a Lead or higher of one of B's departments
|
279 |
if ($ADept->{$_} > 1) { # A is a Lead or higher of one of B's departments
|
| 280 |
return 1;
|
280 |
return 1;
|
| 281 |
}
|
281 |
}
|
| 282 |
}
|
282 |
}
|
| Line 283... |
Line 283... |
| 283 |
|
283 |
|
| 284 |
if ($ADept->{MVP} >= RollerCon::VOLUNTEER and $B->{mvp_pass} = 1) {
|
284 |
if ($ADept->{MVP} >= RollerCon::VOLUNTEER and $B->{MVPid}) {
|
| 285 |
# MVP Volunteers can see user details for people with MVP Passes
|
285 |
# MVP Volunteers can see user details for people with MVP Passes
|
| 286 |
return 1;
|
286 |
return 1;
|
| Line 287... |
Line 287... |
| 287 |
}
|
287 |
}
|
| Line 509... |
Line 509... |
| 509 |
sub getUser {
|
509 |
sub getUser {
|
| 510 |
my $ID = shift;
|
510 |
my $ID = shift;
|
| Line 511... |
Line 511... |
| 511 |
|
511 |
|
| 512 |
my $sth;
|
512 |
my $sth;
|
| 513 |
if ($ID =~ /^\d+$/) {
|
513 |
if ($ID =~ /^\d+$/) {
|
| 514 |
$sth = $dbh->prepare("select * from official where RCid = ?");
|
514 |
$sth = $dbh->prepare("select * from v_official where RCid = ?");
|
| 515 |
} else {
|
515 |
} else {
|
| 516 |
$sth = $dbh->prepare("select * from official where email = ?");
|
516 |
$sth = $dbh->prepare("select * from v_official where email = ?");
|
| 517 |
}
|
517 |
}
|
| Line 518... |
Line 518... |
| 518 |
$sth->execute($ID);
|
518 |
$sth->execute($ID);
|
| 519 |
|
519 |
|
| Line 631... |
Line 631... |
| 631 |
# Managers can sign up for as many shifts within their own department as they like...
|
631 |
# Managers can sign up for as many shifts within their own department as they like...
|
| 632 |
$leadership_change = 1;
|
632 |
$leadership_change = 1;
|
| 633 |
}
|
633 |
}
|
| Line 634... |
Line 634... |
| 634 |
|
634 |
|
| 635 |
if ($change eq "add") {
|
635 |
if ($change eq "add") {
|
| 636 |
if ($department eq "CLA" and getUser($user_id)->{mvp_pass} < 1) {
|
636 |
if ($department eq "CLA" and !getUser($user_id)->{MVPid}) {
|
| 637 |
return "<br>Denied! User ($user_id) does not have an MVP Pass!<br>\n";
|
637 |
return "<br>Denied! User ($user_id) does not have an MVP Pass!<br>\n";
|
| 638 |
} elsif ($department ne "CLA" and convertDepartments(getUser($user_id)->{department})->{$department} < 1) {
|
638 |
} elsif ($department ne "CLA" and convertDepartments(getUser($user_id)->{department})->{$department} < 1) {
|
| 639 |
return "<br>Denied! User ($user_id) is not a member of Department ($department)!<br>\n" unless $department eq "CMP";
|
639 |
return "<br>Denied! User ($user_id) is not a member of Department ($department)!<br>\n" unless $department eq "CMP";
|
| 640 |
}
|
640 |
}
|
| Line 835... |
Line 835... |
| 835 |
return 0;
|
835 |
return 0;
|
| 836 |
}
|
836 |
}
|
| 837 |
} else {
|
837 |
} else {
|
| 838 |
if ($dept eq "CLA") {
|
838 |
if ($dept eq "CLA") {
|
| 839 |
# MVP Class Sign-up
|
839 |
# MVP Class Sign-up
|
| 840 |
return 0 unless $user->{mvp_pass};
|
840 |
return 0 unless $user->{MVPid};
|
| 841 |
my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
|
841 |
my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
|
| 842 |
my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
|
842 |
my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
|
| 843 |
return 0 unless $class_count < $class_limit;
|
843 |
return 0 unless $class_count < $class_limit;
|
| 844 |
} else {
|
844 |
} else {
|
| 845 |
if ($user->{department}->{$t->{dept}} < 1) { return 0; }
|
845 |
if ($user->{department}->{$t->{dept}} < 1) { return 0; }
|