Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2862806-2-dont-override-created.patch | 737 bytes | torotil |
Comments
Comment #2
torotil CreditAttribution: torotil at more onion commentedHere is a patch implementing the proposed resolution.
Comment #3
torotil CreditAttribution: torotil at more onion commentedNever mind - this was already fixed in 7.x-1.x