Ensure that people can be removed from projects as well.
authorJoey Schulze <joey@infodrom.org>
Mon, 21 Mar 2005 14:42:54 +0000 (14:42 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 21 Mar 2005 14:42:54 +0000 (14:42 +0000)
src/LinuxTag/2005/projects/update.wml

index 29c44be..6c3e49a 100644 (file)
 </when>                
 
       } else { # pg_NumRows() > 0 ==> user is member of >1 projects
-       $query = sprintf("DELETE from junction where person = %d AND project = %d",
+       $query = sprintf("DELETE from junction where person = %d AND project = '%s'",
                         $id,
                         addslashes($context));
        pg_exec($dbh, $query) or die ("Cannot delete junction.");
         if ($primproject == $context) {
           $row = pg_fetch_array($sth, 0);
         
+         # Set the first other project as primary project and reset the admin flag
           $query = sprintf ("UPDATE person SET project = '%s',admin=0 WHERE id = %d",
                           addslashes ($row['project']),
                           $id);