| Line 602... |
Line 602... |
| 602 |
if (!$s->{teams} or $s->{dept} eq "CLA") {
|
602 |
if (!$s->{teams} or $s->{dept} eq "CLA") {
|
| 603 |
# it's a time-based shift
|
603 |
# it's a time-based shift
|
| 604 |
if ($s->{dept} eq "PER") {
|
604 |
if ($s->{dept} eq "PER") {
|
| 605 |
if ($RCid eq $ORCUSER->{RCid}) {
|
605 |
if ($RCid eq $ORCUSER->{RCid}) {
|
| 606 |
# DROP
|
606 |
# DROP
|
| 607 |
$s->{buttons} = $h->button ({ onClick=>"if (confirm('Really? You want to delete this personal time?')==true) { window.open('personal_time.pl?choice=Delete&id=$s->{id}','Confirm Change','resizable,height=260,width=370'); return false; }" }, "DEL")." ".$h->button ({ onClick=>"location.href='personal_time.pl?choice=Update&id=$s->{id}'" }, "EDIT");
|
607 |
$s->{buttons} = $h->button ({ onClick=>"event.stopPropagation(); if (confirm('Really? You want to delete this personal time?')==true) { location.href='personal_time.pl?choice=Delete&id=$s->{id}'; return false; }" }, "DEL")." ".$h->button ({ onClick=>"event.stopPropagation(); location.href='personal_time.pl?choice=Update&id=$s->{id}'" }, "EDIT");
|
| 608 |
} else {
|
608 |
} else {
|
| 609 |
$s->{location} = "";
|
609 |
$s->{location} = "";
|
| 610 |
$s->{role} = "";
|
610 |
$s->{role} = "";
|
| 611 |
}
|
611 |
}
|
| 612 |
} elsif (($RCid == $ORCUSER->{RCid} and $s->{signup} !~ /^selected/ and $now < $cutoff) or ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5)) {
|
612 |
} elsif (($RCid == $ORCUSER->{RCid} and $s->{signup} !~ /^selected/ and $now < $cutoff) or ($ORCUSER->{department}->{$s->{dept}} >= 2 or $ORCUSER->{access} >= 5)) {
|
| Line 640... |
Line 640... |
| 640 |
$s->{role} =~ s/\-\d+$//;
|
640 |
$s->{role} =~ s/\-\d+$//;
|
| Line 641... |
Line 641... |
| 641 |
|
641 |
|
| 642 |
# 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});
|
642 |
# 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});
|
| 643 |
# push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, join ' ', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
|
643 |
# push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, join ' ', $s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams}, $s->{buttons});
|
| - |
|
644 |
$s->{time} = convertTime $s->{time};
|
| - |
|
645 |
if ($s->{dept} eq "PER") {
|
| - |
|
646 |
push @shifts, $h->li ({ onClick => "location.replace('personal_time.pl?id=$s->{id}');", class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, $h->div ({ class=>"lisp0" }, [ $h->div ({ class=>"liLeft" }, join ' ', ($s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, $s->{dept} eq "CLA" ? "MVP Class:" : getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams})), $h->div ({ class=>"liRight" }, $s->{buttons}) ]));
|
| 644 |
$s->{time} = convertTime $s->{time};
|
647 |
} else {
|
| - |
|
648 |
push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, $h->div ({ class=>"lisp0" }, [ $h->div ({ class=>"liLeft" }, join ' ', ($s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, $s->{dept} eq "CLA" ? "MVP Class:" : getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams})), $h->div ({ class=>"liRight" }, $s->{buttons}) ]));
|
| 645 |
push @shifts, $h->li ({ class=> $s->{date} eq $dt ? "highlighted" : "shaded" }, $h->div ({ class=>"lisp0" }, [ $h->div ({ class=>"liLeft" }, join ' ', ($s->{date}, $s->{dayofweek}, $s->{time}, $s->{location}, $s->{dept} eq "CLA" ? "MVP Class:" : getDepartments()->{$s->{dept}}, $s->{role}, $s->{teams})), $h->div ({ class=>"liRight" }, $s->{buttons}) ]));
|
649 |
}
|
| 646 |
$hours += $s->{volhours} unless $s->{dept} eq "PER" or $s->{dept} eq "CLA";
|
650 |
$hours += $s->{volhours} unless $s->{dept} eq "PER" or $s->{dept} eq "CLA";
|
| Line 647... |
Line 651... |
| 647 |
}
|
651 |
}
|
| 648 |
|
652 |
|
| Line 1036... |
Line 1040... |
| 1036 |
|
1040 |
|
| 1037 |
sub findConflict {
|
1041 |
sub findConflict {
|
| 1038 |
my $rcid = shift;
|
1042 |
my $rcid = shift;
|
| 1039 |
my $gid = shift;
|
1043 |
my $gid = shift;
|
| 1040 |
my $type = shift // "";
|
1044 |
my $type = shift // "";
|
| Line 1041... |
Line 1045... |
| 1041 |
my ($date, $start, $end, $conflicts);
|
1045 |
my ($date, $start, $end, $existing, $conflicts);
|
| 1042 |
|
1046 |
|
| 1043 |
if ($type eq "game") {
|
1047 |
if ($type eq "game") {
|
| 1044 |
# Are they already signed up for this game? (It's faster to check the two views one at a time...)
|
1048 |
# Are they already signed up for this game? (It's faster to check the two views one at a time...)
|
| Line 1054... |
Line 1058... |
| 1054 |
if ($conflicts) { return "CLA:".$gid; } # no need to keep looking...
|
1058 |
if ($conflicts) { return "CLA:".$gid; } # no need to keep looking...
|
| Line 1055... |
Line 1059... |
| 1055 |
|
1059 |
|
| Line 1056... |
Line 1060... |
| 1056 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from v_class where id = ?", undef, $gid);
|
1060 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from v_class where id = ?", undef, $gid);
|
| 1057 |
|
1061 |
|
| 1058 |
} elsif ($type eq "personal") {
|
1062 |
} elsif ($type eq "personal") {
|
| 1059 |
($date, $start, $end) = @{ $gid };
|
1063 |
($date, $start, $end, $existing) = @{ $gid };
|
| 1060 |
} else {
|
1064 |
} else {
|
| Line 1061... |
Line 1065... |
| 1061 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from shift where id = ?", undef, $gid);
|
1065 |
($date, $start, $end) = $dbh->selectrow_array ("select distinct date, start_time, end_time from shift where id = ?", undef, $gid);
|
| 1062 |
}
|
1066 |
}
|
| 1063 |
|
1067 |
|
| Line 1064... |
Line 1068... |
| 1064 |
# Are they signed up for any games that would conflict with this one?
|
1068 |
# Are they signed up for any games that would conflict with this one?
|
| 1065 |
# my $sth = $dbh->prepare("select count(*) from v_shift_admin_view where id in (select id from game where date = (select date from game where id = ?) and ((time <= (select time from game where id = ?) and end_time > (select time from game where id = ?)) or (time > (select time from game where id = ?) and time < (select end_time from game where id = ?)))) and RCid = ?");
|
1069 |
# my $sth = $dbh->prepare("select count(*) from v_shift_admin_view where id in (select id from game where date = (select date from game where id = ?) and ((time <= (select time from game where id = ?) and end_time > (select time from game where id = ?)) or (time > (select time from game where id = ?) and time < (select end_time from game where id = ?)))) and RCid = ?");
|
| 1066 |
# my $sth = $dbh->prepare("select count(*) from v_shift_all where id in (select id from v_shift_all where date = (select date from v_shift_all where id = ?) and ((start_time <= (select start_time from v_shift_all where id = ?) and end_time > (select start_time from v_shift_all where id = ?)) or (start_time > (select start_time from v_shift_all where id = ?) and start_time < (select end_time from v_shift_all where id = ?)))) and RCid = ?");
|
1070 |
# my $sth = $dbh->prepare("select count(*) from v_shift_all where id in (select id from v_shift_all where date = (select date from v_shift_all where id = ?) and ((start_time <= (select start_time from v_shift_all where id = ?) and end_time > (select start_time from v_shift_all where id = ?)) or (start_time > (select start_time from v_shift_all where id = ?) and start_time < (select end_time from v_shift_all where id = ?)))) and RCid = ?");
|
| 1067 |
|
1071 |
|
| 1068 |
($conflicts) = $dbh->selectrow_array ("select * from (
|
1072 |
($conflicts) = $dbh->selectrow_array ("select * from (
|
| - |
|
1073 |
select concat(dept, '-', id) as conflict from v_shift where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
| 1069 |
select concat(dept, '-', id) from v_shift where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
1074 |
select concat('CLA:', id) as conflict from v_class_signup where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
| 1070 |
select concat('CLA:', id) from v_class_signup where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
1075 |
select concat('ANN-', id) as conflict from v_shift_announcer where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
| Line 1071... |
Line 1076... |
| 1071 |
select concat('ANN-', id) from v_shift_announcer where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? union
|
1076 |
select concat('OFF-', id) as conflict from v_shift_officiating where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? ) alltables
|
| 1072 |
select concat('OFF-', id) from v_shift_officiating where date = ? and ((start_time <= ? and end_time > ?) or (start_time > ? and start_time < ?)) and RCid = ? ) alltables",
|
1077 |
where conflict <> ?",
|