Subversion Repositories PEEPS

Rev

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

Rev 22 Rev 26
Line 165... Line 165...
165
        $actionbutton .= formField ("Cancel", "Back");
165
        $actionbutton .= formField ("Cancel", "Back");
166
      }
166
      }
167
    }
167
    }
168
  } else {
168
  } else {
169
    error ("No Organization ID provided.") unless $ORCUSER->{SYSADMIN};
169
    error ("No Organization ID provided.") unless $ORCUSER->{SYSADMIN};
170
 
170
    
171
    print $h->p ("Adding a new League...");
171
    print $h->p ("Adding a new League...");
172
 
172
    
173
    foreach (@DBFields) {
173
    foreach (@DBFields) {
174
      $F{$_} = formField ($_);
174
      $F{$_} = formField ($_);
175
    }
175
    }
176
#		$F{$DBFields[0]} = "NEW".$h->input ({ type=>"hidden", name=>$DBFields[0], value=> "NEW" });
176
		$F{$DBFields[0]} = "NEW".$h->input ({ type=>"hidden", name=>$DBFields[0], value=> "NEW" });
Line 177... Line 177...
177
		
177
		
178
    $actionbutton = formField ("choice", "Save");
178
    $actionbutton = formField ("choice", "Save");
179
    $actionbutton .= formField ("Cancel");
179
    $actionbutton .= formField ("Cancel");
Line 278... Line 278...
278
  my $FTS = shift;
278
  my $FTS = shift;
Line 279... Line 279...
279
  
279
  
280
  if ($FTS->{$DBFields[0]} eq "NEW") {
280
  if ($FTS->{$DBFields[0]} eq "NEW") {
281
    $dbh->do (
281
    $dbh->do (
282
      "INSERT INTO $DBTable (".
282
      "INSERT INTO $DBTable (".
283
      join (", ", @DBFields)
283
      join (", ", grep { $FTS->{$_} } grep { $_ ne $primary } @DBFields)
284
      .") VALUES (". join (", ", map { '?' } @DBFields) .")",
284
      .") VALUES (". join (", ", map { '?' } grep { $FTS->{$_} } grep { $_ ne $primary } @DBFields) .")",
285
    	undef,
285
    	undef,
286
    	map { $FTS->{$_} } @DBFields
286
    	map { $FTS->{$_} } grep { $FTS->{$_} } grep { $_ ne $primary } @DBFields
287
    );
287
    ) or warn $dbh->errstr;
288
    if (!$FTS->{$primary}) {
288
    if ($FTS->{$primary} eq "NEW") {
289
      ($FTS->{$primary}) = $dbh->selectrow_array ("select max($primary) from $DBTable");
289
      ($FTS->{$primary}) = $dbh->selectrow_array ("select max($primary) from $DBTable");
290
    }
290
    }
291
    logit ($user->{person_id}, "$username edited a league (".join (", ", map { $FTS->{$_} } @DBFields).")");
291
    logit ($user->{person_id}, "$username added a league (".join (", ", map { $FTS->{$_} } @DBFields).")");
292
  } else {
292
  } else {
Line 293... Line 293...
293
    my $OG = $dbh->selectrow_hashref ("select * from organization where id = ?", undef, $FTS->{$primary});
293
    my $OG = $dbh->selectrow_hashref ("select * from organization where id = ?", undef, $FTS->{$primary});
294
    
294