? node_collisions_issue.patch
Index: comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/comment.inc,v
retrieving revision 1.105
diff -u -F^f -r1.105 comment.inc
--- comment.inc	17 Oct 2007 20:23:59 -0000	1.105
+++ comment.inc	20 Oct 2007 04:16:40 -0000
@@ -19,9 +19,11 @@ function project_issue_comment(&$arg, $o
   // This is ugly, but the form workflow doesn't really offer a better
   // choice for this scenario.
   if (isset($_POST['project_info']['pid'])) {
-    $node->pid = $_POST['project_info']['pid'];
+// MUNGE: $node->pid
+    $node->project_issue['pid'] = $_POST['project_info']['pid'];
   }
-  $project = node_load(array('nid' => $node->pid, 'type' => 'project_project'));
+// MUNGE: $node->pid
+  $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project'));
 
   switch ($op) {
     case 'form':
Index: issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.266
diff -u -F^f -r1.266 issue.inc
--- issue.inc	13 Oct 2007 13:51:52 -0000	1.266
+++ issue.inc	20 Oct 2007 04:16:41 -0000
@@ -544,7 +544,8 @@ function project_issue_form($node, $para
   }
 
   // Try to find the active project, if not already known.
-  if (empty($node->pid)) {
+// MUNGE: $node->pid
+  if (empty($node->project_issue['pid'])) {
     if (isset($_POST['pid'])) {
       $pid = $_POST['pid'];
     }
@@ -553,14 +554,17 @@ function project_issue_form($node, $para
     }
     if (isset($pid)) {
       if (is_numeric($pid)) {
-        $node->pid = db_result(db_query(db_rewrite_sql('SELECT p.nid FROM {project_projects} p WHERE p.nid = %d', 'p'), $pid), 0);
+// MUNGE: $node->pid
+        $node->project_issue['pid'] = db_result(db_query(db_rewrite_sql('SELECT p.nid FROM {project_projects} p WHERE p.nid = %d', 'p'), $pid), 0);
       }
       else {
-        $node->pid = db_result(db_query(db_rewrite_sql("SELECT p.nid FROM {project_projects} p WHERE p.uri = '%s'", 'p'), $pid), 0);
+// MUNGE: $node->pid
+        $node->project_issue['pid'] = db_result(db_query(db_rewrite_sql("SELECT p.nid FROM {project_projects} p WHERE p.uri = '%s'", 'p'), $pid), 0);
       }
     }
   }
-  $pid = $node->pid;
+// MUNGE: $node->pid
+  $pid = $node->project_issue['pid'];
   if ($pid) {
     // Load Javascript. This is needed only if we already have a project selected.
     drupal_add_js(drupal_get_path('module', 'project_issue') .'/project_issue.js');
@@ -583,14 +587,19 @@ function project_issue_form($node, $para
     }
     $categories = array_merge(array(t('<none>')), project_issue_category(0, 0));
     $priorities = project_issue_priority();
-    $states = project_issue_state(0, true, $node->nid && ($node->uid == $user->uid), $node->sid);
+// MUNGE: $node->sid
+    $states = project_issue_state(0, true, $node->nid && ($node->uid == $user->uid), $node->project_issue['sid']);
 
-    if ($user->uid == $node->assigned) {
+// MUNGE: $node->assigned
+    if ($user->uid == $node->project_issue['assigned']) {
       $assigned = array(0 => t('Unassign'), $user->uid => $user->name);
     }
     else {
       $assigned = array(
-        $node->assigned => ($node->assigned && ($account = user_load(array('uid' => $node->assigned))) ? $account->name : t('Unassigned')),
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+        $node->project_issue['assigned'] => ($node->project_issue['assigned'] && ($account = user_load(array('uid' => $node->project_issue['assigned']))) ? $account->name : t('Unassigned')),
         $user->uid => $user->name
       );
     }
@@ -612,7 +621,8 @@ function project_issue_form($node, $para
     $form['project_info']['pid'] = array(
       '#type' => 'select',
       '#title' => t('Project'),
-      '#default_value' => $node->pid,
+// MUNGE: $node->pid
+      '#default_value' => $node->project_issue['pid'],
       '#options' => $projects,
       '#required' => TRUE,
     );
@@ -620,14 +630,16 @@ function project_issue_form($node, $para
       $form['project_info']['rid'] = array(
         '#type' => 'select',
         '#title' => t('Version'),
-        '#default_value' => $node->rid,
+// MUNGE: $node->rid
+        '#default_value' => $node->project_issue['rid'],
         '#options' => $releases,
       );
     }
     $form['project_info']['component'] = array(
       '#type' => 'select',
       '#title' => t('Component'),
-      '#default_value' => $node->component,
+// MUNGE: $node->component
+      '#default_value' => $node->project_issue['component'],
       '#options' => $components,
     );
 
@@ -640,26 +652,33 @@ function project_issue_form($node, $para
     $form['issue_info']['category'] = array(
       '#type' => 'select',
       '#title' => t('Category'),
-      '#default_value' => $node->category ? $node->category : arg(4),
+// MUNGE: $node->category
+// MUNGE: $node->category
+      '#default_value' => $node->project_issue['category'] ? $node->project_issue['category'] : arg(4),
       '#options' => $categories,
     );
     $form['issue_info']['priority'] = array(
       '#type' => 'select',
       '#title' => t('Priority'),
-      '#default_value' => $node->priority ? $node->priority : 2,
+// MUNGE: $node->priority
+// MUNGE: $node->priority
+      '#default_value' => $node->project_issue['priority'] ? $node->project_issue['priority'] : 2,
       '#options' => $priorities,
     );
     $form['issue_info']['assigned'] = array(
       '#type' => 'select',
       '#title' => t('Assigned'),
-      '#default_value' => $node->assigned,
+// MUNGE: $node->assigned
+      '#default_value' => $node->project_issue['assigned'],
       '#options' => $assigned,
     );
     if (count($states) > 1) {
       $form['issue_info']['sid'] = array(
         '#type' => 'select',
         '#title' => t('Status'),
-        '#default_value' => $node->sid ? $node->sid : $default_state,
+// MUNGE: $node->sid
+// MUNGE: $node->sid
+        '#default_value' => $node->project_issue['sid'] ? $node->project_issue['sid'] : $default_state,
         '#options' => $states,
       );
     }
@@ -852,25 +871,37 @@ function project_issue_view($node, $teas
     $node->content['#prefix'] = '<div class="project-issue">';
     $node->content['#suffix'] = '</div>';
 
-    $project = node_load(array('nid' => $node->pid, 'type' => 'project_project'));
-    $release->nid = $node->rid;
+// MUNGE: $node->pid
+    $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project'));
+// MUNGE: $node->rid
+    $release->nid = $node->project_issue['rid'];
     if (module_exists('project_release')) {
       $release = project_release_load($release);
     }
-    $assigned = ($node->assigned && ($account = user_load(array('uid' => $node->assigned))) ? $account->name : t('Unassigned'));
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+    $assigned = ($node->project_issue['assigned'] && ($account = user_load(array('uid' => $node->project_issue['assigned']))) ? $account->name : t('Unassigned'));
 
     $rows = array();
     $rows[] = array('Project:', check_plain($project->title));
     if ($release->version) {
       $rows[] = array('Version:', check_plain($release->version));
     }
-    $rows[] = array(t('Component:'),  check_plain($node->component));
-    $rows[] = array(t('Category:'), check_plain($node->category));
-    $rows[] = array(t('Priority:'), project_issue_priority($node->priority));
+// MUNGE: $node->component
+    $rows[] = array(t('Component:'),  check_plain($node->project_issue['component']));
+// MUNGE: $node->category
+    $rows[] = array(t('Category:'), check_plain($node->project_issue['category']));
+// MUNGE: $node->priority
+    $rows[] = array(t('Priority:'), project_issue_priority($node->project_issue['priority']));
     $rows[] = array(t('Assigned:'), $assigned);
-    $rows[] = array(t('Status:'), project_issue_state($node->sid));
-    if ($node->file_path) {
-      $rows[] = array(t('Attachment:'), '<a href="'. file_create_url($node->file_path). '">'. basename($node->file_path) .'</a> ('. format_size($node->file_size) .')');
+// MUNGE: $node->sid
+    $rows[] = array(t('Status:'), project_issue_state($node->project_issue['sid']));
+// MUNGE: $node->file_path
+    if ($node->project_issue['file_path']) {
+// MUNGE: $node->file_size
+// MUNGE: $node->file_path
+// MUNGE: $node->file_path
+      $rows[] = array(t('Attachment:'), '<a href="'. file_create_url($node->project_issue['file_path']). '">'. basename($node->project_issue['file_path']) .'</a> ('. format_size($node->project_issue['file_size']) .')');
     }
     $node->content['project_issue_summary'] = array(
       '#value' => '<div class="summary">'. theme('table', array(), $rows) .'</div>',
@@ -884,7 +915,8 @@ function project_issue_view($node, $teas
     // Breadcrumb navigation
     $breadcrumb[] = array('path' => 'project', 'title' => t('Projects'));
     if (project_use_taxonomy()) {
-      $taxonomy_terms = taxonomy_node_get_terms($node->pid);
+// MUNGE: $node->pid
+      $taxonomy_terms = taxonomy_node_get_terms($node->project_issue['pid']);
       $term = reset($taxonomy_terms);
       $breadcrumb[] = array('path' => 'project/'. $term->name, 'title' => $term->name);
     }
@@ -936,7 +968,14 @@ function project_issue_insert($node) {
     $original_issue_data->$field = $node->$field;
   }
 
-  db_query("INSERT INTO {project_issues} (nid, pid, category, component, priority, rid, assigned, sid, file_path, file_mime, file_size, original_issue_data, last_comment_id, db_lock) VALUES (%d, %d, '%s', '%s', %d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d)", $node->nid, $node->pid, $node->category, $node->component, $node->priority, $node->rid, $node->assigned, $node->sid, $file->filepath, $file->filemime, $file->filesize, serialize($original_issue_data), 0, 0);
+// MUNGE: $node->sid
+// MUNGE: $node->assigned
+// MUNGE: $node->rid
+// MUNGE: $node->priority
+// MUNGE: $node->component
+// MUNGE: $node->category
+// MUNGE: $node->pid
+  db_query("INSERT INTO {project_issues} (nid, pid, category, component, priority, rid, assigned, sid, file_path, file_mime, file_size, original_issue_data, last_comment_id, db_lock) VALUES (%d, %d, '%s', '%s', %d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d)", $node->nid, $node->project_issue['pid'], $node->project_issue['category'], $node->project_issue['component'], $node->project_issue['priority'], $node->project_issue['rid'], $node->project_issue['assigned'], $node->project_issue['sid'], $file->filepath, $file->filemime, $file->filesize, serialize($original_issue_data), 0, 0);
   project_mail_notify($node);
 }
 
@@ -945,16 +984,31 @@ function project_issue_update($node) {
     // Remove old file.
     file_delete(db_result(db_query('SELECT file_path FROM {project_issues} WHERE nid = %d', $node->nid)));
     $file = file_save_upload($node->file, variable_get('project_directory_issues', 'issues'));
-    db_query("UPDATE {project_issues} SET pid = %d, category = '%s', component = '%s', priority = %d, rid = %d, assigned = %d, sid = %d, file_path = '%s', file_mime = '%s', file_size = %d WHERE nid = %d", $node->pid, $node->category, $node->component, $node->priority, $node->rid, $node->assigned, $node->sid, $file->filepath, $file->filemime, $file->filesize, $node->nid);
+// MUNGE: $node->sid
+// MUNGE: $node->assigned
+// MUNGE: $node->rid
+// MUNGE: $node->priority
+// MUNGE: $node->component
+// MUNGE: $node->category
+// MUNGE: $node->pid
+    db_query("UPDATE {project_issues} SET pid = %d, category = '%s', component = '%s', priority = %d, rid = %d, assigned = %d, sid = %d, file_path = '%s', file_mime = '%s', file_size = %d WHERE nid = %d", $node->project_issue['pid'], $node->project_issue['category'], $node->project_issue['component'], $node->project_issue['priority'], $node->project_issue['rid'], $node->project_issue['assigned'], $node->project_issue['sid'], $file->filepath, $file->filemime, $file->filesize, $node->nid);
   }
   else {
-    db_query("UPDATE {project_issues} SET pid = %d, category = '%s', component = '%s', priority = %d, rid = %d, assigned = %d, sid = %d WHERE nid = %d", $node->pid, $node->category, $node->component, $node->priority, $node->rid, $node->assigned, $node->sid, $node->nid);
+// MUNGE: $node->sid
+// MUNGE: $node->assigned
+// MUNGE: $node->rid
+// MUNGE: $node->priority
+// MUNGE: $node->component
+// MUNGE: $node->category
+// MUNGE: $node->pid
+    db_query("UPDATE {project_issues} SET pid = %d, category = '%s', component = '%s', priority = %d, rid = %d, assigned = %d, sid = %d WHERE nid = %d", $node->project_issue['pid'], $node->project_issue['category'], $node->project_issue['component'], $node->project_issue['priority'], $node->project_issue['rid'], $node->project_issue['assigned'], $node->project_issue['sid'], $node->nid);
   }
   project_mail_notify($node);
 }
 
 function project_issue_delete($node) {
-  file_delete($node->file_path);
+// MUNGE: $node->file_path
+  file_delete($node->project_issue['file_path']);
   db_query('DELETE FROM {project_issues} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {project_issue_comments} WHERE nid = %d', $node->nid);
 }
@@ -1605,9 +1659,12 @@ function project_issue_query_result($que
     while ($node = db_fetch_object($result)) {
       $node = node_load($node->nid);
       $row = array();
-      $class = "state-$node->sid";
+// MUNGE: $node->sid
+      $class = "state-$node->project_issue['sid']";
       if (!$project->nid) {
-        $row[] = l($projects[$node->pid], "project/issues/$node->pid");
+// MUNGE: $node->pid
+// MUNGE: $node->pid
+        $row[] = l($projects[$node->project_issue['pid']], "project/issues/$node->project_issue['pid']");
       }
       if (strlen($node->title) > 50) {
         $title = l(drupal_substr($node->title, 0, 50), "node/$node->nid", array('title' => $node->title));
@@ -1616,14 +1673,20 @@ function project_issue_query_result($que
         $title = l($node->title, "node/$node->nid");
       }
       $row[] = $title . theme('mark', node_mark($node->nid, $node->changed));
-      $row[] = $states[$node->sid];
-      $row[] = $priorities[$node->priority];
-      $row[] = t($node->category);
+// MUNGE: $node->sid
+      $row[] = $states[$node->project_issue['sid']];
+// MUNGE: $node->priority
+      $row[] = $priorities[$node->project_issue['priority']];
+// MUNGE: $node->category
+      $row[] = t($node->project_issue['category']);
       if (count($releases)) {
-        $row[] = $releases[$node->rid];
+// MUNGE: $node->rid
+        $row[] = $releases[$node->project_issue['rid']];
       }
       $row[] = array('data' => format_interval(time() - $node->changed, 2), 'align' => 'right');
-      $row[] = ($node->assigned) ? theme('username', user_load(array('uid' => $node->assigned))) : '';
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+      $row[] = ($node->project_issue['assigned']) ? theme('username', user_load(array('uid' => $node->project_issue['assigned']))) : '';
 
       $row = array('data' => $row, 'class' => $class);
 
Index: mail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/mail.inc,v
retrieving revision 1.81
diff -u -F^f -r1.81 mail.inc
--- mail.inc	13 Oct 2007 04:42:33 -0000	1.81
+++ mail.inc	20 Oct 2007 04:16:42 -0000
@@ -201,7 +201,8 @@ function project_mail_notify($node) {
   if (defined('PROJECT_NOMAIL')) {
     return;
   }
-  $project = node_load(array('nid' => $node->pid, 'type' => 'project_project'));
+// MUNGE: $node->pid
+  $project = node_load(array('nid' => $node->project_issue['pid'], 'type' => 'project_project'));
 
   $fields = array(
     'pid' => t('Project'),
@@ -222,7 +223,8 @@ function project_mail_notify($node) {
   // Load in the original issue data here, since we want a running
   // reverse history.
   else {
-    $original_issue_data = unserialize($node->original_issue_data);
+// MUNGE: $node->original_issue_data
+    $original_issue_data = unserialize($node->project_issue['original_issue_data']);
     foreach ($fields as $field => $label) {
       if ($field != 'name' && $field != 'updator') {
         $node->$field = $original_issue_data->$field;
@@ -249,8 +251,11 @@ function project_mail_notify($node) {
   if ($entry->uid) {
     $uids[$entry->uid] = $entry->uid;
   }
-  if ($node->assigned) {
-    $uids[$node->assigned] = $node->assigned;
+// MUNGE: $node->assigned
+  if ($node->project_issue['assigned']) {
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+    $uids[$node->project_issue['assigned']] = $node->project_issue['assigned'];
   }
 
   // Create link to related node
@@ -361,25 +366,30 @@ function project_mail_notify($node) {
 
   if (count($uids)) {
     $placeholders = implode(',', array_fill(0, count($uids), '%d'));
-    array_unshift($uids, $node->pid);
+// MUNGE: $node->pid
+    array_unshift($uids, $node->project_issue['pid']);
     $result = db_query("SELECT p.*, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND (p.level = 2 OR (p.level = 1 AND u.uid IN ($placeholders)))", $uids);
   }
   else {
-    $result = db_query('SELECT p.*, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND p.level = 2', $node->pid);
+// MUNGE: $node->pid
+    $result = db_query('SELECT p.*, u.name, u.mail FROM {project_subscriptions} p INNER JOIN {users} u ON p.uid = u.uid WHERE u.status = 1 AND p.nid = %d AND p.level = 2', $node->project_issue['pid']);
   }
 
   project_mail_output($node->title, 0);
-  $node->title = "[". t($node->category) ."] $node->title";
+// MUNGE: $node->category
+  $node->title = "[". t($node->project_issue['category']) ."] $node->title";
 
   while ($recipient = db_fetch_object($result)) {
     drupal_mail('project_issue_update', $recipient->mail, $node->title, $body, NULL, $header);
   }
 
-  if (is_array($project->mail_copy_filter) && count(array_filter($project->mail_copy_filter)) && !$project->mail_copy_filter[$node->category]) {
+// MUNGE: $node->category
+  if (is_array($project->mail_copy_filter) && count(array_filter($project->mail_copy_filter)) && !$project->mail_copy_filter[$node->project_issue['category']]) {
     return;
   }
 
-  if (is_array($project->mail_copy_filter_state) && count(array_filter($project->mail_copy_filter_state)) && !$project->mail_copy_filter_state[$node->sid]) {
+// MUNGE: $node->sid
+  if (is_array($project->mail_copy_filter_state) && count(array_filter($project->mail_copy_filter_state)) && !$project->mail_copy_filter_state[$node->project_issue['sid']]) {
     return;
   }
 
@@ -422,17 +432,24 @@ function project_mail_reminder() {
       $mail = $node->mail;
 
       if ($node->nid) {
-        if ($pid != $node->pid || $component != $node->component) {
-          $pid = $node->pid;
-          $component = $node->component;
+// MUNGE: $node->component
+// MUNGE: $node->pid
+        if ($pid != $node->project_issue['pid'] || $component != $node->project_issue['component']) {
+// MUNGE: $node->pid
+          $pid = $node->project_issue['pid'];
+// MUNGE: $node->component
+          $component = $node->project_issue['component'];
           $banner = "$projects[$pid] / $component";
           $body .= "[ $banner ]". str_repeat('=', 72 - 4 - strlen($banner)) ."\n";
         }
         $body .= "$node->title\n";
-        if ($node->assigned && $assigned = user_load(array('uid' => $node->assigned))) {
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+        if ($node->project_issue['assigned'] && $assigned = user_load(array('uid' => $node->project_issue['assigned']))) {
           $body .= "  assigned: $assigned->name\n";
         }
-        $body .= '  state: '. project_issue_state($node->sid) ."\n";
+// MUNGE: $node->sid
+        $body .= '  state: '. project_issue_state($node->project_issue['sid']) ."\n";
         $body .= '  age: '. format_interval(time() - $node->created) ."\n";
         $body .= '  url: '. url("node/$node->nid", NULL, NULL, 1) ."\n";
         $body .= "\n";
@@ -457,13 +474,18 @@ function project_mail_digest() {
     $category = '';
     $result2 = db_query(db_rewrite_sql('SELECT p.nid, n.title, n.created, p.sid, p.category, p.component, p.priority, p.assigned FROM {project_issues} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = 1 AND p.pid = %d AND p.sid = 1 AND p.priority = 1 ORDER BY p.category, n.created DESC', 'p'), $project->nid);
     while ($node = db_fetch_object($result2)) {
-      if ($category != $node->category) {
-        $category = $node->category;
-        $banner = "$project->title / ". project_issue_category($node->category);
+// MUNGE: $node->category
+      if ($category != $node->project_issue['category']) {
+// MUNGE: $node->category
+        $category = $node->project_issue['category'];
+// MUNGE: $node->category
+        $banner = "$project->title / ". project_issue_category($node->project_issue['category']);
         $body[$project->mail_digest] .= "$banner\n". str_repeat('-', $banner) ."\n";
       }
       $body[$project->mail_digest] .= "$node->title\n";
-      if ($node->assigned && $assigned = user_load(array('uid' => $node->assigned))) {
+// MUNGE: $node->assigned
+// MUNGE: $node->assigned
+      if ($node->project_issue['assigned'] && $assigned = user_load(array('uid' => $node->project_issue['assigned']))) {
         $body[$project->mail_digest] .= '  assigned: '. $assigned->name ."\n";
       }
       $body[$project->mail_digest] .= '  age: '. format_interval(time() - $node->created) ."\n";
Index: project_issue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.60
diff -u -F^f -r1.60 project_issue.module
--- project_issue.module	13 Oct 2007 22:09:25 -0000	1.60
+++ project_issue.module	20 Oct 2007 04:16:43 -0000
@@ -381,8 +381,12 @@ function project_issue_project_edit_issu
   project_project_set_breadcrumb($node);
   drupal_set_title(check_plain($node->title));
 
-  if (isset($node->components) && is_array($node->components)) {
-    $node->components = implode("\n", $node->components);
+// MUNGE: $node->component
+// MUNGE: $node->component
+  if (isset($node->project_issue['component']) && is_array($node->project_issue['component'])) {
+// MUNGE: $node->component
+// MUNGE: $node->component
+    $node->project_issue['component'] = implode("\n", $node->project_issue['component']);
   }
   return drupal_get_form('project_issue_project_edit_form', $node);
 }
@@ -411,7 +415,9 @@ function project_issue_project_edit_form
   $form['issue']['components'] = array(
     '#type' => 'textarea',
     '#title' => t('Components'),
-    '#default_value' => isset($node->components) ? $node->components : NULL,
+// MUNGE: $node->component
+// MUNGE: $node->component
+    '#default_value' => isset($node->project_issue['component']) ? $node->project_issue['component'] : NULL,
     '#cols' => 20,
     '#rows' => 5,
   );
@@ -541,13 +547,15 @@ function project_issue_issue_nodeapi(&$n
   global $user;
   switch ($op) {
     case 'validate':
-      $result = db_query('SELECT * FROM {project_issue_state} WHERE sid = %d ORDER BY weight', $node->sid);
+// MUNGE: $node->sid
+      $result = db_query('SELECT * FROM {project_issue_state} WHERE sid = %d ORDER BY weight', $node->project_issue['sid']);
       $state = db_fetch_object($result);
 
       // Check if user has access, or if status is default status and therefore available to all,
       // or if user is original issue poster and poster is granted access.
       // If none of these is true, set error.
-      if (!(user_access('set issue status '. str_replace("'", "", $state->name)) || ($node->sid == variable_get('project_issue_default_state', 1)) || ($state->author_has && ($user->uid == $node->uid)))) {
+// MUNGE: $node->sid
+      if (!(user_access('set issue status '. str_replace("'", "", $state->name)) || ($node->project_issue['sid'] == variable_get('project_issue_default_state', 1)) || ($state->author_has && ($user->uid == $node->uid)))) {
         form_set_error('sid', t('Invalid issue status %status: you do not have permission to set this status', array('%status' => $state)));
       }
       break;
@@ -747,7 +755,8 @@ function project_issue_project_load(&$no
     return $node;
   }
   //assert($project);
-  $node->components = unserialize($project->components);
+// MUNGE: $node->component
+  $node->project_issue['component'] = unserialize($project->components);
   $node->mail_copy_filter = unserialize($project->mail_copy_filter);
   $node->mail_copy_filter_state = unserialize($project->mail_copy_filter_state);
   foreach (array('issues', 'help', 'mail_digest', 'mail_copy', 'mail_reminder') as $field) {
@@ -763,8 +772,10 @@ function project_issue_project_insert($n
   // they'd use the "issues" subtab of the project edit tab (since none
   // of these fields are present on the initial project add form).
   $node->issues = 1;
-  $node->components = serialize(array('Code', 'Documentation', 'Miscellaneous', 'User interface'));
-  db_query("INSERT INTO {project_issue_projects} (nid, issues, components) VALUES (%d, %d, '%s')", $node->nid, $node->issues, $node->components);
+// MUNGE: $node->component
+  $node->project_issue['component'] = serialize(array('Code', 'Documentation', 'Miscellaneous', 'User interface'));
+// MUNGE: $node->component
+  db_query("INSERT INTO {project_issue_projects} (nid, issues, components) VALUES (%d, %d, '%s')", $node->nid, $node->issues, $node->project_issue['component']);
 }
 
 function project_issue_project_delete($node) {
@@ -889,4 +900,4 @@ function project_issue_comment_mass_upda
   while ($issue_comment = db_fetch_object($issue_comments)) {
     project_issue_update_by_comment($issue_comment, 'update');
   }
-}
\ No newline at end of file
+}
