Subversion Repositories PEEPS

Rev

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

Rev 29 Rev 31
Line 43... Line 43...
43
	date_established    => [qw(Established          60    date               )],
43
	date_established    => [qw(Established          60    date               )],
44
	updated             => [qw(Updated              65    readonly  static   )],
44
	updated             => [qw(Updated              65    readonly  static   )],
45
);
45
);
Line 46... Line 46...
46
 
46
 
-
 
47
if ($user->{SYSADMIN}) {
47
if ($user->{SYSADMIN}) {
48
  $FIELDS{alcohol_liability_eligible} = ["AL Eligible", 69, "switch"];
48
  $FIELDS{visible} = [qw(Visible 70 switch)];
49
  $FIELDS{visible} = [qw(Visible 70 switch)];
Line 49... Line 50...
49
}
50
}
50
 
51
 
51
my %fieldDisplayName = map  { $_ => $FIELDS{$_}->[0]   } keys %FIELDS;
52
my %fieldDisplayName = map  { $_ => $FIELDS{$_}->[0]   } keys %FIELDS;
52
my %fieldType        = map  { $_ => $FIELDS{$_}->[2]   } keys %FIELDS;
53
my %fieldType        = map  { $_ => $FIELDS{$_}->[2]   } keys %FIELDS;
53
my @requiredFields   = sort fieldOrder grep { defined $FIELDS{$_}->[3] } keys %FIELDS;
54
my @requiredFields   = sort fieldOrder grep { defined $FIELDS{$_}->[3] } keys %FIELDS;
54
my @DBFields   = sort fieldOrder grep { $fieldType{$_} =~ /^(text|select|number|switch|date|time|auto)/ } keys %FIELDS;
55
my @DBFields   = sort fieldOrder grep { $fieldType{$_} =~ /^(text|select|number|switch|date|time|auto)/ } keys %FIELDS;
55
my @ROFields   = sort fieldOrder grep { $fieldType{$_} =~ /^(readonly)/ } keys %FIELDS;
56
my @ROFields   = sort fieldOrder grep { $fieldType{$_} =~ /^(readonly)/ } keys %FIELDS;
Line 56... Line 57...
56
my @SAFields = qw/ type status visible/;
57
my @SAFields = qw/ type status alcohol_liability_eligible visible/;
57
my $primary = $DBFields[0];
58
my $primary = $DBFields[0];
58
 
59
 
Line 154... Line 155...
154
      $F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
155
      $F{$DBFields[0]} .= $h->input ({ type=>"hidden", name=>$DBFields[0], value=> $F{$DBFields[0]} });
Line 155... Line 156...
155
 
156
 
156
      # Put the time fields into the user's preference
157
      # Put the time fields into the user's preference
157
      map { $F{$_} = convertTime $F{$_} } grep { $fieldType{$_} eq "time" } keys %FIELDS;
158
      map { $F{$_} = convertTime $F{$_} } grep { $fieldType{$_} eq "time" } keys %FIELDS;
-
 
159
      $F{url} = $h->a ({href => $F{url}, target=>"_blank"}, $F{url}) unless !$F{url};
158
      $F{url} = $h->a ({href => $F{url}, target=>"_blank"}, $F{url}) unless !$F{url};
160
      $F{alcohol_liability_eligible} = $F{alcohol_liability_eligible} ? "True" : "False";
Line 159... Line 161...
159
      $F{visible} = $F{visible} ? "True" : "False";
161
      $F{visible} = $F{visible} ? "True" : "False";
160
      
162
      
161
      $actionbutton = formField ("choice", "Update") if $ORCUSER->{SYSADMIN} or $leagueAdmin;
163
      $actionbutton = formField ("choice", "Update") if $ORCUSER->{SYSADMIN} or $leagueAdmin;
Line 222... Line 224...
222
  
224
  
223
  if ($leagueAdmin and (!$active_policy or !$active_alcohol_policy or remainingOrgPolicyDays ($active_policy) <= 90 or remainingOrgPolicyDays ($active_alcohol_policy) <= 90)) {
225
  if ($leagueAdmin and (!$active_policy or !$active_alcohol_policy or remainingOrgPolicyDays ($active_policy) <= 90 or remainingOrgPolicyDays ($active_alcohol_policy) <= 90)) {
224
    push @policyhistory, $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: smaller;" }, '&nbsp;') ]);
226
    push @policyhistory, $h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: smaller;" }, '&nbsp;') ]);
225
    push @policyhistory, $h->div ({ style=>"font-size: smaller;" }, [
227
    push @policyhistory, $h->div ({ style=>"font-size: smaller;" }, [
226
                                   ((!$active_policy or remainingOrgPolicyDays ($R->{$primary}, $active_policy) <= 90) ? $h->button ({ onClick=>"window.location.href='attestation?policy=2&league=".$R->{$primary}."'; return false;" }, ($active_policy ? "Renew" : "Purchase")." General Liability") : ""),
228
                                   ((!$active_policy or remainingOrgPolicyDays ($R->{$primary}, $active_policy) <= 90) ? $h->button ({ onClick=>"window.location.href='attestation?policy=2&league=".$R->{$primary}."'; return false;" }, ($active_policy ? "Renew" : "Purchase")." General Liability") : ""),
227
                                   ((!$active_alcohol_policy or remainingOrgPolicyDays ($R->{$primary}, $active_alcohol_policy) <= 90) ? $h->button ({ onClick=>"window.location.href='attestation?policy=3&league=".$R->{$primary}."'; return false;" }, ($active_alcohol_policy ? "Renew" : "Purchase")." Alcohol Liability") : "")
229
                                   (($F{alcohol_liability_eligible} eq "True" and (!$active_alcohol_policy or remainingOrgPolicyDays ($R->{$primary}, $active_alcohol_policy) <= 90)) ? $h->button ({ onClick=>"window.location.href='attestation?policy=3&league=".$R->{$primary}."'; return false;" }, ($active_alcohol_policy ? "Renew" : "Purchase")." Alcohol Liability") : "")
228
                                 ]);
230
                                 ]);
Line 229... Line 231...
229
  }
231
  }
Line 296... Line 298...
296
    my $league_name = getLeagueName ($FTS->{$primary});
298
    my $league_name = getLeagueName ($FTS->{$primary});
Line 297... Line 299...
297
    
299
    
298
    foreach my $field (grep { notInArray ($_, \@ROFields) } keys %{$FTS}) {
300
    foreach my $field (grep { notInArray ($_, \@ROFields) } keys %{$FTS}) {
299
      if (notInArray ($field, \@SAFields) or $ORCUSER->{SYSADMIN}) {
301
      if (notInArray ($field, \@SAFields) or $ORCUSER->{SYSADMIN}) {
300
        if ($FTS->{$field} ne $OG->{$field}) {
302
        if ($FTS->{$field} ne $OG->{$field}) {
301
        	if ($field eq "visible") {
303
        	if ($field eq "visible" or $field eq "alcohol_liability_eligible") {
302
        		$FTS->{$field} = $FTS->{$field} ? 1 : 0;
304
        		$FTS->{$field} = $FTS->{$field} ? 1 : 0;
303
        	}
305
        	}
304
          $dbh->do ("update $DBTable set $field = ?, updated = now() where $primary = ?", undef, $FTS->{$field}, $FTS->{$primary});
306
          $dbh->do ("update $DBTable set $field = ?, updated = now() where $primary = ?", undef, $FTS->{$field}, $FTS->{$primary});
305
          logit ($ORCUSER->{person_id}, "Updated league $league_name [$FTS->{$primary}]: $field -> $FTS->{$field}");
307
          logit ($ORCUSER->{person_id}, "Updated league $league_name [$FTS->{$primary}]: $field -> $FTS->{$field}");