| Line 10... |
Line 10... |
| 10 |
use WebDB;
|
10 |
use WebDB;
|
| Line 11... |
Line 11... |
| 11 |
|
11 |
|
| 12 |
$SIG{__WARN__} = sub { warn sprintf("[%s] ", scalar localtime), @_ };
|
12 |
$SIG{__WARN__} = sub { warn sprintf("[%s] ", scalar localtime), @_ };
|
| Line 13... |
Line 13... |
| 13 |
$SIG{__DIE__} = sub { die sprintf("[%s] ", scalar localtime), @_ };
|
13 |
$SIG{__DIE__} = sub { die sprintf("[%s] ", scalar localtime), @_ };
|
| Line 14... |
Line 14... |
| 14 |
|
14 |
|
| Line 15... |
Line 15... |
| 15 |
our @EXPORT = qw( $ORCUSER $SYSTEM_EMAIL getRCDBH getAccessLevels authDB max authenticate canView getShiftRef getShiftDepartment getClassID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit validate_emt);
|
15 |
our @EXPORT = qw( $ORCUSER $SYSTEM_EMAIL getRCDBH getAccessLevels authDB max authenticate canView getShiftRef getShiftDepartment getClassID getSeminarID getDepartments convertDepartments convertTime getSchedule getRCid getSetting getUser getUserEmail getUserDerbyName getYears printRCHeader changeShift modShiftTime signUpCount signUpEligible findConflict changeLeadShift sendNewUserEMail logit validate_emt);
|
| 16 |
|
16 |
|
| Line 479... |
Line 479... |
| 479 |
|
479 |
|
| 480 |
warn "ERROR: No class.id found for shift $shiftref->{id}";
|
480 |
warn "ERROR: No class.id found for shift $shiftref->{id}";
|
| 481 |
return "";
|
481 |
return "";
|
| Line -... |
Line 482... |
| - |
|
482 |
}
|
| - |
|
483 |
|
| - |
|
484 |
sub getSeminarID {
|
| - |
|
485 |
my $shift = shift // "";
|
| - |
|
486 |
return unless $shift =~ /^\d+$/;
|
| - |
|
487 |
|
| - |
|
488 |
my $shiftref = getShiftRef ($shift);
|
| - |
|
489 |
my ($classid) = $dbh->selectrow_array ("select id from seminar where date = ? and start_time = ? and location = ?", undef, $shiftref->{date}, $shiftref->{start_time}, $shiftref->{location});
|
| - |
|
490 |
return $classid unless !$classid;
|
| - |
|
491 |
|
| - |
|
492 |
warn "ERROR: No seminar.id found for shift $shiftref->{id}";
|
| - |
|
493 |
return "";
|
| 482 |
}
|
494 |
}
|
| 483 |
|
495 |
|
| 484 |
sub getShiftRef {
|
496 |
sub getShiftRef {
|
| Line 485... |
Line 497... |
| 485 |
my $shiftID = shift // "";
|
497 |
my $shiftID = shift // "";
|
| Line 587... |
Line 599... |
| 587 |
my $where = scalar @whereclause ? "where ".join " and ", @whereclause : "";
|
599 |
my $where = scalar @whereclause ? "where ".join " and ", @whereclause : "";
|
| 588 |
my @shifts;
|
600 |
my @shifts;
|
| 589 |
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track as location, time, role, teams, signup, 'OFF' as dept, volhours from v_shift_officiating where RCid = ? union
|
601 |
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track as location, time, role, teams, signup, 'OFF' as dept, volhours from v_shift_officiating where RCid = ? union
|
| 590 |
select id, date, dayofweek, track as location, time, role, teams, signup, 'ANN' as dept, volhours from v_shift_announcer where RCid = ? union
|
602 |
select id, date, dayofweek, track as location, time, role, teams, signup, 'ANN' as dept, volhours from v_shift_announcer where RCid = ? union
|
| 591 |
select id, date, dayofweek, location, time, role, '' as teams, type as signup, dept, volhours from v_shift where RCid = ? union
|
603 |
select id, date, dayofweek, location, time, role, '' as teams, type as signup, dept, volhours from v_shift where RCid = ? union
|
| 592 |
select id, date, dayofweek, location, time, role, name as teams, 'mvpclass' as signup, 'CLA' as dept, 0 as volhours from v_class_signup_new where RCid = ?) temp
|
604 |
select id, date, dayofweek, location, time, role, name as teams, 'mvpclass' as signup, 'CLA' as dept, 0 as volhours from v_class_signup_new where RCid = ? union
|
| - |
|
605 |
select id, date, dayofweek, location, time, role, name as teams, 'seminar' as signup, 'SEM' as dept, 0 as volhours from v_seminar_signup_new where RCid = ?) temp
|
| 593 |
$where order by date, time");
|
606 |
$where order by date, time");
|
| 594 |
$sth->execute($RCid, $RCid, $RCid, $RCid);
|
607 |
$sth->execute($RCid, $RCid, $RCid, $RCid, $RCid);
|
| 595 |
my $hours = 0;
|
608 |
my $hours = 0;
|
| 596 |
while (my $s = $sth->fetchrow_hashref) {
|
609 |
while (my $s = $sth->fetchrow_hashref) {
|
| 597 |
my ($yyyy, $mm, $dd) = split /\-/, $s->{date};
|
610 |
my ($yyyy, $mm, $dd) = split /\-/, $s->{date};
|
| 598 |
my $cutoff = DateTime->new(
|
611 |
my $cutoff = DateTime->new(
|
| 599 |
year => $yyyy,
|
612 |
year => $yyyy,
|
| Line 604... |
Line 617... |
| 604 |
second => 0,
|
617 |
second => 0,
|
| 605 |
time_zone => 'America/Los_Angeles'
|
618 |
time_zone => 'America/Los_Angeles'
|
| 606 |
);
|
619 |
);
|
| Line 607... |
Line 620... |
| 607 |
|
620 |
|
| 608 |
|
621 |
|
| 609 |
if (!$s->{teams} or $s->{dept} eq "CLA") {
|
622 |
if (!$s->{teams} or $s->{dept} eq "CLA" or $s->{dept} eq "SEM") {
|
| 610 |
# it's a time-based shift
|
623 |
# it's a time-based shift
|
| 611 |
if ($s->{dept} eq "PER") {
|
624 |
if ($s->{dept} eq "PER") {
|
| 612 |
if ($RCid eq $ORCUSER->{RCid}) {
|
625 |
if ($RCid eq $ORCUSER->{RCid}) {
|
| Line 622... |
Line 635... |
| 622 |
if ($s->{dept} eq "CLA") {
|
635 |
if ($s->{dept} eq "CLA") {
|
| 623 |
$shiftORclass = "class";
|
636 |
$shiftORclass = "class";
|
| 624 |
$linkargs = "&role=$s->{role}";
|
637 |
$linkargs = "&role=$s->{role}";
|
| 625 |
$s->{role} = $s->{teams};
|
638 |
$s->{role} = $s->{teams};
|
| 626 |
$s->{teams} = "";
|
639 |
$s->{teams} = "";
|
| - |
|
640 |
} elsif ($s->{dept} eq "SEM") {
|
| - |
|
641 |
$shiftORclass = "seminar";
|
| - |
|
642 |
$linkargs = "&role=$s->{role}";
|
| - |
|
643 |
$s->{role} = $s->{teams};
|
| - |
|
644 |
$s->{teams} = "";
|
| 627 |
}
|
645 |
}
|
| 628 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to drop this $shiftORclass?')==true) { window.open('make_shift_change.pl?change=del&RCid=$RCid&id=$s->{id}$linkargs','Confirm Class Change','resizable,height=260,width=370'); return false; }" }, "DROP");
|
646 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to drop this $shiftORclass?')==true) { window.open('make_shift_change.pl?change=del&RCid=$RCid&id=$s->{id}$linkargs','Confirm Class Change','resizable,height=260,width=370'); return false; }" }, "DROP");
|
| 629 |
if ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5) {
|
647 |
if ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5) {
|
| 630 |
# NO SHOW
|
648 |
# NO SHOW
|
| 631 |
$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}$linkargs','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "NO SHOW");
|
649 |
$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}$linkargs','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "NO SHOW");
|
| Line 779... |
Line 797... |
| 779 |
}
|
797 |
}
|
| Line 780... |
Line 798... |
| 780 |
|
798 |
|
| 781 |
sub changeShift {
|
799 |
sub changeShift {
|
| 782 |
my ($change, $shift_id, $role, $user_id) = @_;
|
800 |
my ($change, $shift_id, $role, $user_id) = @_;
|
| - |
|
801 |
if ($shift_id =~ /(am|pm)/) {
|
| - |
|
802 |
my $s = $shift_id =~ /^SEM/ ? 1 : 0;
|
| 783 |
if ($shift_id =~ /(am|pm)/) {
|
803 |
$shift_id =~ s/^SEM\|//;
|
| 784 |
my ($td, $st, $tl) = split /\|/, $shift_id;
|
804 |
my ($td, $st, $tl) = split /\|/, $shift_id;
|
| 785 |
my ($hr, $min, $ampm) = split /:|\s/, $st;
|
805 |
my ($hr, $min, $ampm) = split /:|\s/, $st;
|
| 786 |
if ($ampm eq "pm") { $hr += 12; }
|
806 |
if ($ampm eq "pm") { $hr += 12; }
|
| Line 787... |
Line 807... |
| 787 |
elsif ($ampm eq "am" and $hr == 12) { $hr = "00" }
|
807 |
elsif ($ampm eq "am" and $hr == 12) { $hr = "00" }
|
| 788 |
|
808 |
|
| - |
|
809 |
$st = $hr.":".$min;
|
| 789 |
$st = $hr.":".$min;
|
810 |
$shift_id = join "|", ($td, $st, $tl);
|
| 790 |
$shift_id = join "|", ($td, $st, $tl);
|
811 |
$shift_id = "SEM|".$shift_id if $s;
|
| 791 |
} else {
|
812 |
} else {
|
| 792 |
$shift_id =~ s/(\d+:\d+):00/$1/;
|
813 |
$shift_id =~ s/(\d+:\d+):00/$1/;
|
| 793 |
}
|
814 |
}
|
| 794 |
#warn join " - ", $change, $shift_id, $role, $user_id;
|
815 |
#warn join " - ", $change, $shift_id, $role, $user_id;
|
| 795 |
my $leadership_change = 0;
|
816 |
my $leadership_change = 0;
|
| 796 |
# my $department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
|
817 |
# my $department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
|
| 797 |
my $department;
|
818 |
my $department;
|
| 798 |
if ($shift_id =~ /^\d+$/) {
|
819 |
if ($shift_id =~ /^\d+$/) {
|
| - |
|
820 |
$department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
|
| 799 |
$department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
|
821 |
} else {
|
| - |
|
822 |
if ($shift_id =~ /^SEM/) {
|
| 800 |
} else {
|
823 |
$department = "SEM";
|
| 801 |
$department = "CLA";
|
824 |
$shift_id =~ s/^SEM\|//;
|
| - |
|
825 |
if ($change eq "del") {
|
| - |
|
826 |
($shift_id, $role) = $dbh->selectrow_array ("select id, role from v_seminar_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id);
|
| - |
|
827 |
} else {
|
| - |
|
828 |
if ($change eq "override") {
|
| - |
|
829 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('SEM-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role from v_seminar_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id) unless $change ne "override";
|
| - |
|
830 |
} else {
|
| - |
|
831 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('SEM-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role, count(role), capacity from v_seminar_signup_new where date = ? and start_time = ? and location = ? having capacity > count(role)", undef, split /\|/, $shift_id);
|
| - |
|
832 |
}
|
| 802 |
if ($change eq "del") {
|
833 |
}
|
| - |
|
834 |
$role = "SEM-1" unless $role; # If no one has signed up for the class yet, the SQL above doesn't retrieve the first available
|
| 803 |
($shift_id, $role) = $dbh->selectrow_array ("select id, role from v_class_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id);
|
835 |
} else {
|
| 804 |
} else {
|
836 |
$department = "CLA";
|
| 805 |
if ($change eq "override") {
|
837 |
if ($change eq "del") {
|
| - |
|
838 |
($shift_id, $role) = $dbh->selectrow_array ("select id, role from v_class_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id);
|
| - |
|
839 |
} else {
|
| - |
|
840 |
if ($change eq "override") {
|
| 806 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role from v_class_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id) unless $change ne "override";
|
841 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role from v_class_signup_new where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id) unless $change ne "override";
|
| - |
|
842 |
} else {
|
| 807 |
} else {
|
843 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role, count(role), capacity from v_class_signup_new where date = ? and start_time = ? and location = ? having capacity > count(role)", undef, split /\|/, $shift_id);
|
| - |
|
844 |
}
|
| 808 |
($shift_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role, count(role), capacity from v_class_signup_new where date = ? and start_time = ? and location = ? having capacity > count(role)", undef, split /\|/, $shift_id);
|
845 |
}
|
| 809 |
}
|
- |
|
| 810 |
}
|
846 |
$role = "CLA-1" unless $role; # If no one has signed up for the class yet, the SQL above doesn't retrieve the first available
|
| 811 |
$role = "CLA-1" unless $role; # If no one has signed up for the class yet, the SQL above doesn't retrieve the first available
|
847 |
}
|
| 812 |
}
|
848 |
}
|
| 813 |
# my $game_based = $role ? "game" : "shift";
|
849 |
# my $game_based = $role ? "game" : "shift";
|
| Line 814... |
Line 850... |
| 814 |
my $game_based = $role =~ /^CLA-/ ? "class" : $role ? "game" : "shift";
|
850 |
my $game_based = $role =~ /^CLA-/ ? "class" : ($role =~ /^SEM-/) ? "seminar" : $role ? "game" : "shift";
|
| 815 |
my $sth;
|
851 |
my $sth;
|
| 816 |
|
852 |
|
| 817 |
if ($change eq "add" or $change eq "override") {
|
853 |
if ($change eq "add" or $change eq "override") {
|
| 818 |
my $taken;
|
854 |
my $taken;
|
| 819 |
if ($department eq "CLA") {
|
855 |
if ($department eq "CLA" or $department eq "SEM") {
|
| 820 |
($taken) = $shift_id ? 0 : 1;
|
856 |
($taken) = $shift_id ? 0 : 1;
|
| 821 |
} elsif ($game_based eq "game") {
|
857 |
} elsif ($game_based eq "game") {
|
| 822 |
($taken) = $dbh->selectrow_array ("select count(*) from assignment where Gid = ? and role = ?", undef, $shift_id, $role);
|
858 |
($taken) = $dbh->selectrow_array ("select count(*) from assignment where Gid = ? and role = ?", undef, $shift_id, $role);
|
| 823 |
} else {
|
859 |
} else {
|
| 824 |
($taken) = $dbh->selectrow_array ('select count(*) from shift where id = ? and (isnull(assignee_id) = 0 or assignee_id <> "")', undef, $shift_id);
|
860 |
($taken) = $dbh->selectrow_array ('select count(*) from shift where id = ? and (isnull(assignee_id) = 0 or assignee_id <> "")', undef, $shift_id);
|
| 825 |
}
|
861 |
}
|
| 826 |
if ($taken) {
|
862 |
if ($taken) {
|
| Line 827... |
Line 863... |
| 827 |
return ($department eq "CLA") ? "<br>Denied! This class is already full ($shift_id).<br>\n" : "<br>Denied! This shift is already taken ($shift_id).<br>\n";
|
863 |
return ($department eq "CLA") ? "<br>Denied! This class is already full ($shift_id).<br>\n" : ($department eq "SEM") ? "<br>Denied! This seminar is already full ($shift_id).<br>\n" : "<br>Denied! This shift is already taken ($shift_id).<br>\n";
|
| 828 |
}
|
864 |
}
|
| Line 844... |
Line 880... |
| 844 |
}
|
880 |
}
|
| Line 845... |
Line 881... |
| 845 |
|
881 |
|
| 846 |
if ($change eq "add") {
|
882 |
if ($change eq "add") {
|
| 847 |
if ($department eq "CLA" and !getUser($user_id)->{MVPid}) {
|
883 |
if ($department eq "CLA" and !getUser($user_id)->{MVPid}) {
|
| 848 |
return "<br>Denied! User ($user_id) does not have an MVP Pass!<br>\n";
|
884 |
return "<br>Denied! User ($user_id) does not have an MVP Pass!<br>\n";
|
| 849 |
} elsif ($department ne "CLA" and getUser($user_id)->{department} and convertDepartments(getUser($user_id)->{department})->{$department} < 1) {
|
885 |
} elsif ($department ne "CLA" and $department ne "SEM" and getUser($user_id)->{department} and convertDepartments(getUser($user_id)->{department})->{$department} < 1) {
|
| 850 |
return "<br>Denied! User ($user_id) is not a member of Department ($department)!<br>\n" unless $department eq "CMP";
|
886 |
return "<br>Denied! User ($user_id) is not a member of Department ($department)!<br>\n" unless $department eq "CMP";
|
| 851 |
} elsif ($department eq "EMT" and getUser($user_id)->{emt_verified} == 0) {
|
887 |
} elsif ($department eq "EMT" and getUser($user_id)->{emt_verified} == 0) {
|
| 852 |
return "<br>Denied! User ($user_id) has not had their EMT status verified!<br>\n";
|
888 |
return "<br>Denied! User ($user_id) has not had their EMT status verified!<br>\n";
|
| 853 |
}
|
889 |
}
|
| Line 857... |
Line 893... |
| 857 |
if ($change eq "add" and $conflict) {
|
893 |
if ($change eq "add" and $conflict) {
|
| 858 |
return "<br>Denied! There is a conflict ($conflict) with that shift's time!<br>\n";
|
894 |
return "<br>Denied! There is a conflict ($conflict) with that shift's time!<br>\n";
|
| 859 |
}
|
895 |
}
|
| Line 860... |
Line 896... |
| 860 |
|
896 |
|
| 861 |
my $game_type;
|
897 |
my $game_type;
|
| 862 |
if ($department ne "CLA") {
|
898 |
if ($department ne "CLA" and $department ne "SEM") {
|
| Line 863... |
Line 899... |
| 863 |
($game_type) = $dbh->selectrow_array ("select type from ".$game_based." where id = ?", undef, $shift_id);
|
899 |
($game_type) = $dbh->selectrow_array ("select type from ".$game_based." where id = ?", undef, $shift_id);
|
| 864 |
|
900 |
|
| 865 |
if ($game_type =~ /^selected/ and !$leadership_change) {
|
901 |
if ($game_type =~ /^selected/ and !$leadership_change) {
|
| Line 866... |
Line 902... |
| 866 |
return "<br>Denied! Only leadership can make changes to 'selected staffing' shifts!<br>\n" unless $department eq "CMP";
|
902 |
return "<br>Denied! Only leadership can make changes to 'selected staffing' shifts!<br>\n" unless $department eq "CMP";
|
| 867 |
}
|
903 |
}
|
| 868 |
|
904 |
|
| 869 |
if ($change eq "add" and $game_type eq "lead" and convertDepartments(getUser($user_id)->{department})->{$department} < 2 and $ORCUSER->{access} < 3) {
|
905 |
if ($change eq "add" and $game_type eq "lead" and convertDepartments(getUser($user_id)->{department})->{$department} < 2 and $ORCUSER->{access} < 3) {
|
| 870 |
return "<br>Denied! Shift reserved for leadership staff!<br>\n";
|
906 |
return "<br>Denied! Shift reserved for leadership staff!<br>\n";
|
| 871 |
}
|
907 |
}
|
| Line 872... |
Line 908... |
| 872 |
} else {
|
908 |
} else {
|
| 873 |
$game_type = "class";
|
909 |
$game_type = $department eq "CLA" ? "class" : "seminar";
|
| Line 903... |
Line 939... |
| 903 |
}
|
939 |
}
|
| 904 |
}
|
940 |
}
|
| 905 |
}
|
941 |
}
|
| Line 906... |
Line 942... |
| 906 |
|
942 |
|
| 907 |
my @DBARGS;
|
943 |
my @DBARGS;
|
| 908 |
if ($game_based eq "game" or $game_based eq "class") {
|
944 |
if ($game_based eq "game" or $game_based eq "class" or $game_based eq "seminar") {
|
| 909 |
if ($change eq "add" or $change eq "override") {
|
945 |
if ($change eq "add" or $change eq "override") {
|
| 910 |
$sth = $dbh->prepare("insert into assignment (Gid, role, RCid) values (?, ?, ?)");
|
946 |
$sth = $dbh->prepare("insert into assignment (Gid, role, RCid) values (?, ?, ?)");
|
| 911 |
} elsif ($change eq "del") {
|
947 |
} elsif ($change eq "del") {
|
| 912 |
$sth = $dbh->prepare("delete from assignment where Gid = ? and role = ? and RCid= ?");
|
948 |
$sth = $dbh->prepare("delete from assignment where Gid = ? and role = ? and RCid= ?");
|
| Line 932... |
Line 968... |
| 932 |
$daily_count = signUpCount ($change, $user_id, $department) unless $leadership_change;
|
968 |
$daily_count = signUpCount ($change, $user_id, $department) unless $leadership_change;
|
| 933 |
logit ($user_id, "Shift ".ucfirst($change).": $shift_id -> $role");
|
969 |
logit ($user_id, "Shift ".ucfirst($change).": $shift_id -> $role");
|
| 934 |
logit ($ORCUSER->{RCid}, "OVERRIDE: Shift ".ucfirst($change).": $shift_id -> $role") if $change eq "override";
|
970 |
logit ($ORCUSER->{RCid}, "OVERRIDE: Shift ".ucfirst($change).": $shift_id -> $role") if $change eq "override";
|
| 935 |
if ($department eq "CLA") {
|
971 |
if ($department eq "CLA") {
|
| 936 |
print "Success!...<br>You've signed up for $daily_count class(es) (you're currently allowed to sign up for $MAXSHIFTS).<br>\n";
|
972 |
print "Success!...<br>You've signed up for $daily_count class(es) (you're currently allowed to sign up for $MAXSHIFTS).<br>\n";
|
| 937 |
updateWRSTBND ($change, $wb_act_code, $DBARGS[0], $DBARGS[2]);
|
973 |
# updateWRSTBND ($change, $wb_act_code, $DBARGS[0], $DBARGS[2]);
|
| - |
|
974 |
} elsif ($department eq "CLA") {
|
| - |
|
975 |
print "Success!...<br>You've signed up for $daily_count seminar(s) (you're currently allowed to sign up for $MAXSHIFTS).<br>\n";
|
| 938 |
} else {
|
976 |
} else {
|
| 939 |
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";
|
977 |
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";
|
| 940 |
}
|
978 |
}
|
| 941 |
return;
|
979 |
return;
|
| 942 |
} else {
|
980 |
} else {
|
| 943 |
if ($department eq "CLA") {
|
981 |
if ($department eq "CLA") {
|
| 944 |
return "<br><b>You did not get the class</b>, most likely because it filled up while you were looking.<br>\nERROR: ", $sth->errstr();
|
982 |
return "<br><b>You did not get the class</b>, most likely because it filled up while you were looking.<br>\nERROR: ", $sth->errstr();
|
| - |
|
983 |
} elsif ($department eq "SEM") {
|
| - |
|
984 |
return "<br><b>You did not get the seminar</b>, most likely because it filled up while you were looking.<br>\nERROR: ", $sth->errstr();
|
| 945 |
} else {
|
985 |
} else {
|
| 946 |
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();
|
986 |
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();
|
| 947 |
}
|
987 |
}
|
| 948 |
}
|
988 |
}
|
| 949 |
}
|
989 |
}
|
| Line 1085... |
Line 1125... |
| 1085 |
$t->{start_time} =~ s/^(\d+:\d+):00$/$1/;
|
1125 |
$t->{start_time} =~ s/^(\d+:\d+):00$/$1/;
|
| 1086 |
($t->{id}) = $dbh->selectrow_array ("select id from v_class_new where date = ? and location = ? and start_time = ?", undef, $t->{date}, $t->{location}, $t->{start_time});
|
1126 |
($t->{id}) = $dbh->selectrow_array ("select id from v_class_new where date = ? and location = ? and start_time = ?", undef, $t->{date}, $t->{location}, $t->{start_time});
|
| 1087 |
$t->{dept} = "CLA";
|
1127 |
$t->{dept} = "CLA";
|
| 1088 |
$dept = "CLA";
|
1128 |
$dept = "CLA";
|
| 1089 |
$t->{type} = "open";
|
1129 |
$t->{type} = "open";
|
| - |
|
1130 |
} elsif ($shifttype eq "seminar") {
|
| - |
|
1131 |
my $classid = $t->{id};
|
| - |
|
1132 |
$t->{start_time} =~ s/^(\d+:\d+):00$/$1/;
|
| - |
|
1133 |
($t->{id}) = $dbh->selectrow_array ("select id from v_seminar_new where date = ? and location = ? and start_time = ?", undef, $t->{date}, $t->{location}, $t->{start_time});
|
| - |
|
1134 |
$t->{dept} = "SEM";
|
| - |
|
1135 |
$dept = "SEM";
|
| - |
|
1136 |
$t->{type} = "open";
|
| 1090 |
}
|
1137 |
}
|
| 1091 |
|
1138 |
|
| 1092 |
if (findConflict ($user->{RCid}, $t->{id}, $shifttype)) { return 0; }
|
1139 |
if (findConflict ($user->{RCid}, $t->{id}, $shifttype)) { return 0; }
|
| Line 1093... |
Line 1140... |
| 1093 |
|
1140 |
|
| 1094 |
if (!exists $user->{$limitkey}) {
|
1141 |
if (!exists $user->{$limitkey}) {
|
| 1095 |
$user->{$limitkey} = signUpCount('get', $user->{RCid}, $dept);
|
1142 |
$user->{$limitkey} = signUpCount('get', $user->{RCid}, $dept);
|
| Line 1114... |
Line 1161... |
| 1114 |
# MVP Class Sign-up
|
1161 |
# MVP Class Sign-up
|
| 1115 |
return 0 unless $user->{MVPid};
|
1162 |
return 0 unless $user->{MVPid};
|
| 1116 |
my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
|
1163 |
my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
|
| 1117 |
my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup_new where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
|
1164 |
my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup_new where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
|
| 1118 |
return 0 unless $class_count < $class_limit;
|
1165 |
return 0 unless $class_count < $class_limit;
|
| - |
|
1166 |
} elsif ($dept eq "SEM") {
|
| - |
|
1167 |
# Nothing to check for Seminars...
|
| 1119 |
} else {
|
1168 |
} else {
|
| 1120 |
if ($user->{department}->{$dept} < 1) { return 0; }
|
1169 |
if ($user->{department}->{$dept} < 1) { return 0; }
|
| 1121 |
}
|
1170 |
}
|
| 1122 |
if (lc $t->{type} eq "lead" and $user->{department}->{$dept} < 2) { return 0; }
|
1171 |
if (lc $t->{type} eq "lead" and $user->{department}->{$dept} < 2) { return 0; }
|
| 1123 |
if (lc $t->{type} eq "manager" and $user->{department}->{$dept} < 3) { return 0; }
|
1172 |
if (lc $t->{type} eq "manager" and $user->{department}->{$dept} < 3) { return 0; }
|
| Line 1149... |
Line 1198... |
| 1149 |
($conflicts) = $dbh->selectrow_array ("select count(*) from v_class_signup_new where id = ? and RCid = ?", undef, $gid, $rcid);
|
1198 |
($conflicts) = $dbh->selectrow_array ("select count(*) from v_class_signup_new where id = ? and RCid = ?", undef, $gid, $rcid);
|
| 1150 |
if ($conflicts) { return "CLA:".$gid; } # no need to keep looking...
|
1199 |
if ($conflicts) { return "CLA:".$gid; } # no need to keep looking...
|
| Line 1151... |
Line 1200... |
| 1151 |
|
1200 |
|
| Line -... |
Line 1201... |
| - |
|
1201 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from v_class_new where id = ?", undef, $gid);
|
| - |
|
1202 |
|
| - |
|
1203 |
} elsif ($type eq "seminar") {
|
| - |
|
1204 |
($conflicts) = $dbh->selectrow_array ("select count(*) from v_seminar_signup_new where id = ? and RCid = ?", undef, $gid, $rcid);
|
| - |
|
1205 |
if ($conflicts) { return "SEM:".$gid; } # no need to keep looking...
|
| - |
|
1206 |
|
| 1152 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from v_class_new where id = ?", undef, $gid);
|
1207 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from v_seminar_new where id = ?", undef, $gid);
|
| 1153 |
|
1208 |
|
| 1154 |
} elsif ($type eq "personal") {
|
1209 |
} elsif ($type eq "personal") {
|
| 1155 |
($date, $start, $end, $existing) = @{ $gid };
|
1210 |
($date, $start, $end, $existing) = @{ $gid };
|
| 1156 |
} else {
|
1211 |
} else {
|