In RedhenContactEntityController::save() there is the following snippet:

      // New contact, set created prop.
      if (isset($contact->is_new) && $contact->is_new && !isset($contact->created)) {
        $contact->created = REQUEST_TIME;
      }
      // Set revision flags. By default, save a new revision and set it as
      // default.
      else {
        if (!isset($contact->is_new_revision)) {
          $contact->is_new_revision = TRUE;
        }
        if (!isset($contact->default_revision)) {
          $contact->default_revision = TRUE;
        }
      }

This means for new contacts $contact->created is always overridden regardless of it's current value. This means there is no straightforward way to set another created time ie. when importing contacts from another CRM system.

Proposed resolution

Add a check for an existing $contact->created and use REQUEST_TIME only as default.

CommentFileSizeAuthor
#2 2862806-2-dont-override-created.patch737 bytestorotil
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

torotil created an issue. See original summary.

torotil’s picture

Status: Active » Needs review
FileSize
737 bytes

Here is a patch implementing the proposed resolution.

torotil’s picture

Status: Needs review » Closed (outdated)

Never mind - this was already fixed in 7.x-1.x