? uuid_1065364_5.patch
? uuid_1065364_6.patch
Index: uuid.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uuid/uuid.module,v
retrieving revision 1.1.2.18
diff -u -p -r1.1.2.18 uuid.module
--- uuid.module	9 Feb 2011 21:38:30 -0000	1.1.2.18
+++ uuid.module	24 Feb 2011 03:55:53 -0000
@@ -60,6 +60,14 @@ function uuid_nodeapi(&$node, $op, $teas
     case 'update':
       // Get existing UUID info from the DB.
       $uuid_information = uuid_node_load($node);
+      // If the $node object is not fully loaded, set any existing UUID properties.
+      // http://drupal.org/node/1065364
+      if (!empty($uuid_information['uuid']) && empty($node->uuid)) {
+        $node->uuid = $uuid_information['uuid'];
+      }
+      if (!empty($uuid_information['revision_uuid']) && empty($node->revision_uuid)) {
+        $node->revision_uuid = $uuid_information['revision_uuid'];
+      }
       $auto_create = in_array($node->type, $automatic_types, TRUE);
       $uuid_exists = isset($node->uuid) && uuid_is_valid($node->uuid);
       $uuid_in_db = !empty($uuid_information['uuid']);
Index: uuid.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uuid/Attic/uuid.test,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 uuid.test
--- uuid.test	9 Feb 2011 21:38:30 -0000	1.1.2.2
+++ uuid.test	24 Feb 2011 03:55:53 -0000
@@ -501,6 +501,52 @@ class UUIDFunctionalityTestCase extends 
   }
 
   /**
+   * Verify uuid behavior when edititng via node form.
+   * http://drupal.org/node/1065364
+   */
+  function testEnabledNodeUUIDFormEdit() {
+    // Set module settings.
+    $settings = array(
+      'uuid_automatic_for_nodes[page]'  => TRUE,
+    );
+    $this->uuidSettingsSet($settings);
+
+    // Create and log in our privileged user.
+    $account = $this->drupalCreateUser(array('create page content', 'edit own page content'));
+    $this->drupalLogin($account);
+
+    // Create a node with that user.
+    $options = array(
+      'uid'  => $account->uid,
+      'type' => 'page',
+    );
+    $node = $this->drupalCreateNode($options);
+
+    // Verify fields are attached to the node.
+    $this->assertIsUUID(
+      $node->uuid,
+      t("Node has uuid field attached with enabled settings."),
+      t("Node UUID")
+    );
+
+    // Show current node only in verbose mode.
+    $this->verbose(print_r($node, 1));
+
+    // Edit the node via edit form
+    $edit = array();
+    $edit['title'] = $this->randomName(8);
+    $this->drupalPost("node/{$node->nid}/edit", $edit, t('Save'));
+    $this->assertText(t('@title has been updated.', array('@title' => $edit['title'])));
+
+    // Reload the node
+    $updated_node = node_load($node->nid, NULL, TRUE);
+    $this->assertEqual($node->uuid, $updated_node->uuid, t("Node updated with edit form retained same UUID."));
+
+    // Show current node only in verbose mode.
+    $this->verbose(print_r($updated_node, 1));
+  }
+
+  /**
    * Verify uuid behavior for users.
    */
   function testEnabledUserUUID() {
