Index: pift.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_test/pift.module,v
retrieving revision 1.26
diff -u -r1.26 pift.module
--- pift.module	16 Jul 2009 23:03:16 -0000	1.26
+++ pift.module	28 Jul 2009 20:32:43 -0000
@@ -201,8 +201,9 @@
       }
       break;
     case 'insert':
-      if (pift_test_check_criteria_issue($node)) {
-        $files = upload_load($node);
+      $proper = pift_nodeapi_clean($node);
+      if (pift_test_check_criteria_issue($proper)) {
+        $files = upload_load($proper);
         pift_test_add_files($files);
       }
       break;
@@ -213,6 +214,29 @@
 }
 
 /**
+ * Cleanup the inconsistent project_issue property placement.
+ *
+ * In order to remove the need to a bunch of conditions all of PIFT, convert
+ * the inconsistent node format to the one used everyone else. The inconsistent
+ * format is only found during node creation, after a node has been created and
+ * hook_load() is used the properties are prefixed by project_issue.
+ *
+ * @param object $node Node to convert.
+ * @return object Properly formatted node.
+ * @link http://drupal.org/node/519562
+ */
+function pift_nodeapi_clean($node) {
+  $node->project_issue = array();
+
+  $fields = array('pid', 'rid', 'component', 'category', 'priority', 'assigned', 'sid');
+  foreach ($fields as $field) {
+    $node->project_issue[$field] = $node->$field;
+  }
+
+  return $node;
+}
+
+/**
  * Implementation of hook_comment().
  */
 function pift_comment(&$comment, $op) {
