Index: includes/comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/includes/comment.inc,v
retrieving revision 1.155
diff -u -p -r1.155 comment.inc
--- includes/comment.inc	23 Sep 2009 00:27:05 -0000	1.155
+++ includes/comment.inc	19 Dec 2009 22:04:38 -0000
@@ -46,6 +46,22 @@ function project_issue_comment(&$arg, $o
 
       if (isset($id)) {
         $rid = isset($arg['project_info']['rid']) ? $arg['project_info']['rid'] : 0;
+        // If the comment does not change something then we want to keep the
+        // current value not what was present when the original form was
+        // created aka avoid crossposting.
+        foreach ($arg['project_info']['originals'] as $key => $value) {
+          if (in_array($key, array('category', 'priority', 'sid'))) {
+            $posted_value = &$arg[$key];
+          }
+          else {
+            $posted_value = &$arg['project_info'][$key];
+          }
+          if ($posted_value == $value && $posted_value != $old_data->$key) {
+            $posted_value = $old_data->$key;
+          }
+          unset($posted_value);
+        }
+    
         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');
@@ -283,6 +299,8 @@ function project_issue_form_comment_form
   // Restructure the UI to de-emphasize the original project form inputs.
   $form['original_issue']['project_info'] = $form['project_info'];
   $form['original_issue']['issue_info'] = $form['issue_info'];
+  $form['original_issue']['project_info']['originals'] =  _project_issue_node_form_values($node, 'hidden', '#default_value');
+
   unset($form['project_info'], $form['issue_info']);
   unset($form['issue_details'], $form['project_help']);
   drupal_add_js(drupal_get_path('module', 'project_issue') .'/project_issue.js');
Index: includes/issue_node_form.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/includes/issue_node_form.inc,v
retrieving revision 1.5
diff -u -p -r1.5 issue_node_form.inc
--- includes/issue_node_form.inc	8 Oct 2009 23:36:16 -0000	1.5
+++ includes/issue_node_form.inc	19 Dec 2009 22:04:38 -0000
@@ -319,39 +319,8 @@ function _project_issue_form($node, $for
     // If we're not allowing issue metadata changes, add all of these values
     // into the form so they show up in the $node->project_issue array during
     // validation and submit, so we're consistent with where they live.
-    $form['project_issue'] = array('#tree' => TRUE);
-    $form['project_issue']['pid'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['pid'],
-    );
-    if (isset($node->project_issue['rid'])) {
-      $form['project_issue']['rid'] = array(
-        '#type' => 'value',
-        '#value' => $node->project_issue['rid'],
-      );
-    }
-    $form['project_issue']['component'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['component'],
-    );
-    $form['project_issue']['category'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['category'],
-    );
-    $form['project_issue']['priority'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['priority'],
-    );
-    $form['project_issue']['assigned'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['assigned'],
-    );
-    $form['project_issue']['sid'] = array(
-      '#type' => 'value',
-      '#value' => $node->project_issue['sid'],
-    );
+    $form['project_issue'] = _project_issue_node_form_values($node);
   }
-
   $form['issue_details'] = array(
     '#type' => 'fieldset',
     '#title' => t('Issue details'),
@@ -398,6 +367,41 @@ function _project_issue_form($node, $for
   return $form;
 }
 
+function _project_issue_node_form_values($node, $type = 'value', $key = '#value') {
+  $return = array('#tree' => TRUE);
+  $return['pid'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['pid'],
+  );
+  if (isset($node->project_issue['rid'])) {
+    $return['rid'] = array(
+      '#type' => $type,
+      $key => $node->project_issue['rid'],
+    );
+  }
+  $return['component'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['component'],
+  );
+  $return['category'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['category'],
+  );
+  $return['priority'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['priority'],
+  );
+  $return['assigned'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['assigned'],
+  );
+  $return['sid'] = array(
+    '#type' => $type,
+    $key => $node->project_issue['sid'],
+  );
+  return $return;
+}
+
 /**
  * Private helper to implement hook_validate().
  *
