? fapi.patch
Index: comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/comment.inc,v
retrieving revision 1.142
diff -u -p -r1.142 comment.inc
--- comment.inc	30 Jan 2009 07:16:57 -0000	1.142
+++ comment.inc	30 Jan 2009 22:20:18 -0000
@@ -40,7 +40,8 @@ function project_issue_comment(&$arg, $o
       }
 
       if (isset($id)) {
-        db_query("INSERT INTO {project_issue_comments} (nid, cid, pid, rid, component, category, priority, assigned, sid, title, timestamp, comment_number) VALUES (%d, %d, %d, %d, '%s', '%s', %d, %d, %d, '%s', %d, %d)", $arg['nid'], $arg['cid'], $arg['project_info']['pid'], $arg['project_info']['rid'], $arg['project_info']['component'], $arg['category'], $arg['priority'], $arg['project_info']['assigned'], $arg['sid'], $arg['title'], $arg['timestamp'], $id);
+        $rid = isset($arg['project_info']['rid']) ? $arg['project_info']['rid'] : 0;
+        db_query("INSERT INTO {project_issue_comments} (nid, cid, pid, rid, component, category, priority, assigned, sid, title, timestamp, comment_number) VALUES (%d, %d, %d, %d, '%s', '%s', %d, %d, %d, '%s', %d, %d)", $arg['nid'], $arg['cid'], $arg['project_info']['pid'], $rid, $arg['project_info']['component'], $arg['category'], $arg['priority'], $arg['project_info']['assigned'], $arg['sid'], $arg['title'], $arg['timestamp'], $id);
         db_query("UPDATE {comments} SET subject = '%s' WHERE cid = %d", "#$id", $arg['cid']);
         project_issue_update_by_comment($arg, 'insert');
       }
@@ -106,9 +107,6 @@ function project_issue_form_comment_form
     return;
   }
 
-  // Add our own custom validation to the comment form for issue nodes.
-  $form['#validate'][] = 'project_issue_form_comment_validate';
-
   // Comment body is not required since we validate that ourselves.
   unset($form['comment_filter']['comment']['#required']);
 
@@ -476,7 +474,7 @@ function project_issue_update_by_comment
       // Massage the incoming data so the structure is consistent throughout the function.
       $comment_data['component'] = $comment_data['project_info']['component'];
       $comment_data['pid'] = $comment_data['project_info']['pid'];
-      $comment_data['rid'] = $comment_data['project_info']['rid'];
+      $comment_data['rid'] = isset($comment_data['project_info']['rid']) ? $comment_data['project_info']['rid'] : 0;
       unset ($comment_data['project_info']);
       $comment_data = (object) $comment_data;
       // Mark the node for email notification during hook_exit(), so all issue
Index: issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.336
diff -u -p -r1.336 issue.inc
--- issue.inc	30 Jan 2009 07:16:57 -0000	1.336
+++ issue.inc	30 Jan 2009 22:20:18 -0000
@@ -91,6 +91,7 @@ function project_issue_update_project() 
   // Build the HTML output for the component select.
   $output = theme('status_messages') . drupal_render($project_info);
   drupal_json(array('status' => TRUE, 'data' => $output));
+  exit;
 }
 
 function project_issue_statistics($project = 0) {
Index: project_issue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.120
diff -u -p -r1.120 project_issue.module
--- project_issue.module	30 Jan 2009 07:16:57 -0000	1.120
+++ project_issue.module	30 Jan 2009 22:20:18 -0000
@@ -359,12 +359,21 @@ function project_issue_form_alter(&$form
 
     // see also: project_issue_form_comment_form_alter
     case 'comment_form':
+      $nid = $form['nid']['#value'];
+      $node = node_load($nid);
+
+      // Allows only project_issue
+      if ($node->type != 'project_issue') {
+        return;
+      }
       // Make sure the 'File attachments' fieldset is expanded and before the
       // original issue fieldset.
       if (isset($form['attachments'])) {
         $form['attachments']['#collapsed'] = FALSE;
         $form['attachments']['#weight'] = 2;
       }
+      // Add our own custom validation to the comment form for issue nodes.
+      $form['#validate'][] = 'project_issue_form_comment_validate';
       break;
 
     case 'comment_confirm_delete':
