Subversion Repositories VORC

Rev

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

Rev 65 Rev 68
Line 801... Line 801...
801
sub signUpEligible {
801
sub signUpEligible {
802
	my $user = shift;
802
	my $user = shift;
803
	my $t = shift;
803
	my $t = shift;
804
	my $shifttype = shift // "game";
804
	my $shifttype = shift // "game";
805
	my $dept = $t->{dept} // "";
805
	my $dept = $t->{dept} // "";
-
 
806
  my $DEPTHASH = getDepartments ();
-
 
807
  if ($dept and !exists $DEPTHASH->{$dept}) {
-
 
808
    my %reverso = reverse %{$DEPTHASH};
-
 
809
    $dept = $reverso{$dept};
-
 
810
  }
Line 806... Line 811...
806
	
811
	
807
	my $limit = getSetting ("MAX_SHIFT_SIGNUP_PER_DAY_".$dept);
812
	my $limit = getSetting ("MAX_SHIFT_SIGNUP_PER_DAY_".$dept);
Line 808... Line 813...
808
	$limit = getSetting ("MAX_SHIFT_SIGNUP_PER_DAY") unless defined $limit;
813
	$limit = getSetting ("MAX_SHIFT_SIGNUP_PER_DAY") unless defined $limit;
Line 845... Line 850...
845
			return 0 unless $user->{MVPid};
850
			return 0 unless $user->{MVPid};
846
      my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
851
      my $class_limit = getSetting ("MAX_CLASS_SIGNUP");
847
			my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
852
			my ($class_count) = $dbh->selectrow_array ("select count(*) from v_class_signup where RCid = ? and year(date) = year(now())", undef, $user->{RCid});
848
			return 0 unless $class_count < $class_limit;
853
			return 0 unless $class_count < $class_limit;
849
    } else {
854
    } else {
850
	    if ($user->{department}->{$t->{dept}} < 1) { return 0; }
855
	    if ($user->{department}->{$dept} < 1) { return 0; }
851
	  }
856
	  }
852
	  if ($t->{type} eq "lead" and $user->{department}->{$t->{dept}} < 2) { return 0; }
857
	  if ($t->{type} eq "lead" and $user->{department}->{$dept} < 2) { return 0; }
853
	  if ($t->{type} eq "manager" and $user->{department}->{$t->{dept}} < 3) { return 0; }
858
	  if ($t->{type} eq "manager" and $user->{department}->{$dept} < 3) { return 0; }
854
    if ($t->{type} !~ /^selected/ and $user->{$limitkey} < $limit) {
859
    if ($t->{type} !~ /^selected/ and $user->{$limitkey} < $limit) {
855
			return 1;
860
			return 1;
856
		} else {
861
		} else {
857
			return 0;
862
			return 0;
858
		}
863
		}