Subversion Repositories VORC

Rev

Rev 75 | Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75 Rev 78
Line 282... Line 282...
282
		if ($ADept->{$_} > 1) { # A is a Lead or higher of one of B's departments
282
		if ($ADept->{$_} > 1) { # A is a Lead or higher of one of B's departments
283
			return 1;
283
			return 1;
284
		}
284
		}
285
	}
285
	}
Line 286... Line 286...
286
	
286
	
287
	if ($ADept->{MVP} >= RollerCon::VOLUNTEER and $B->{MVPid}) {
287
	if ($ADept->{MVP} >= RollerCon::LEAD and $B->{MVPid}) {
288
	  # MVP Volunteers can see user details for people with MVP Passes
288
	  # MVP Volunteers can see user details for people with MVP Passes
289
	  return 1;
289
	  return 1;
Line 290... Line 290...
290
	}
290
	}
Line 482... Line 482...
482
 		    # NO SHOW
482
 		    # NO SHOW
483
        $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");
483
        $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");
484
      }
484
      }
485
      $hours += $s->{volhours};
485
      $hours += $s->{volhours};
486
  	}
486
  	}
487
  	$s->{role} =~ s/\-\d$//;
487
  	$s->{role} =~ s/\-\d+$//;
Line 488... Line 488...
488
  	
488
  	
489
#  	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});
489
#  	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});
490
#  	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});
490
#  	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});
491
    $s->{time} = convertTime $s->{time};
491
    $s->{time} = convertTime $s->{time};
Line 587... Line 587...
587
#rcheader
587
#rcheader
588
}
588
}
Line 589... Line 589...
589
 
589
 
590
sub changeShift {
590
sub changeShift {
-
 
591
	my ($change, $shift_id, $role, $user_id) = @_;
-
 
592
  if ($shift_id =~ /(am|pm)/) {
-
 
593
    my ($td, $st, $tl) = split /\|/, $shift_id;
-
 
594
    my ($hr, $min, $ampm) = split /:|\s/, $st;
-
 
595
    if ($ampm eq "pm") { $hr += 12; }
-
 
596
    elsif ($ampm eq "am" and $hr == 12) { $hr = "00" }
-
 
597
 
-
 
598
    $st = $hr.":".$min;
-
 
599
    $shift_id = join "|", ($td, $st, $tl);
591
	my ($change, $shift_id, $role, $user_id) = @_;
600
  }
592
#warn join " - ", $change, $shift_id, $role, $user_id;
601
#warn join " - ", $change, $shift_id, $role, $user_id;
593
	my $leadership_change = 0;
602
	my $leadership_change = 0;
594
#	my $department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
603
#	my $department = getShiftDepartment ($role ? $shift_id."-".$role : $shift_id);
595
	my $department;
604
	my $department;
Line 598... Line 607...
598
	} else {
607
	} else {
599
		$department = "CLA";
608
		$department = "CLA";
600
		if ($change eq "del") {
609
		if ($change eq "del") {
601
		  ($shift_id, $role) = $dbh->selectrow_array ("select id, role from v_class_signup where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id);
610
		  ($shift_id, $role) = $dbh->selectrow_array ("select id, role from v_class_signup where date = ? and start_time = ? and location = ?", undef, split /\|/, $shift_id);
602
		} else {
611
		} else {
603
		  ($shift_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(substring_index(role, '-', -1)) +1) as role, count(role), capacity from v_class_signup where date = ? and start_time = ? and location = ? having capacity > count(role)", undef, split /\|/, $shift_id);
612
		  ($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 where date = ? and start_time = ? and location = ? having capacity > count(role)", undef, split /\|/, $shift_id);
604
		}
613
		}
605
    $role = "CLA-1" unless $role; # If no one has signed up for the class yet, the SQL above doesn't retrieve the first available 
614
    $role = "CLA-1" unless $role; # If no one has signed up for the class yet, the SQL above doesn't retrieve the first available 
606
	}
615
	}
607
#	my $game_based = $role ? "game" : "shift";
616
#	my $game_based = $role ? "game" : "shift";
608
	my $game_based = $role =~ /^CLA-/ ? "class" : $role ? "game" : "shift";
617
	my $game_based = $role =~ /^CLA-/ ? "class" : $role ? "game" : "shift";