Hi everyone,
I tried to edit a field(say some text field or body field) and choose "Update all following" or "Update all dates in the series", without changing the value of the repeat event date field, the value of the filed(say some text field or body field) is updated only in the current repeat event node and not in all other nodes.

On analysis, I came to know that, when the date of the repeat event is not changed, only the title of the events can be updated using "Update all following" or "Update all dates in the series" but not the other fields.

Comments

paulraj augustin’s picture

Assigned: Unassigned » paulraj augustin
paulraj augustin’s picture

I am uploading a patch for this issue. Kindly review the patch.

paulraj augustin’s picture

Sorry, wrong patch name. I am uploading another patch.

shortspoken’s picture

Thank you @a_paulraj. As far as I can tell the patch works as advertised! :)

merilainen’s picture

Status: Active » Needs review

Updated status

merilainen’s picture

There is also this mentioned in the README.txt file:
"A separate HOOK_repeating_date_update is provided to enable other
module developers to determine which properties and fields of each entity
should be updated."

So perhaps that is the recommended way to achieve this. Although blindly copying all fields sounds easier for site-builders, but there might be some fields which should never be copied.

Also, I'm not familiar with the module functionality, but how does the patch behave when user changes one value in one event in the series, let's say price for one specific day, then anther update comes which changes the event image for all events in the series. Is the price value also overwritten which should be different for that one event?

merilainen’s picture

Here is a quick example of how to implement the same thing the patch does in a custom module using the hook I mentioned:

<?php
/**
 * Used to update a date instance in a date series.
 *
 * @param object $date_entity
 *   An instance of a date entity in a series.
 * @param object $updated_entity
 *   The updated entity.
 * @param string $entity_type
 *   The type of entity.
 */
function YOUR_CUSTOM_MODULE_repeating_date_update($date_entity, $updated_entity, $entity_type = 'node') {
  $date_entity_wrapper = entity_metadata_wrapper($entity_type, $date_entity);
  $updated_entity_wrapper = entity_metadata_wrapper($entity_type, $updated_entity);

  // Get all the field names in the bundle
  $fields = field_info_instances($entity_type, 'event');

  // Get the repeating field name
  $repeating_date_field = date_repeat_entity_get_repeating_date_field($entity_type, 'event');

  // This is to ensure that we do not update the fields which are used for tracking the repeat date.
  $donot_update = array(DATE_REPEAT_ENTITY_FIELD_CLONE_STATE,DATE_REPEAT_ENTITY_FIELD_MASTER_UUID,$repeating_date_field['field_name']);
 // Update date entity title from updated entity.
  $date_entity_wrapper->title = $updated_entity_wrapper->label();

  // Save the field value in all other entities
  foreach (array_keys($fields) as $value) {
    if (!in_array($value, $donot_update)) {
      $date_entity_wrapper->{$value} = $updated_entity_wrapper->{$value}->value();
    }
  }
}
?>

This method also makes it possible to skip any additional fields, add more custom logic per fields etc.

geek-merlin’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
Assigned: paulraj augustin » Unassigned

This should in fact be configurable.

geek-merlin’s picture

StatusFileSize
new5.26 KB

Patch flying in that fixes this.
It adds a submodule that lets sitebuilders configure which properties to copy.
Using it here in production.

kopeboy’s picture

#9 Tested.

It clones field when creating, but doesn't update them after editing one node of the series.

Update: oh wait, it does, but only if you change the date field.
And the checkboxes' status at admin/config/date/date_repeat_entity of the fields to replicate are not saved.

tusharbodke’s picture

HI Axel.rutz,

Patch looks fine to me, except change in one line as follow.

Existing line to assign property to all repeated dates.
$date_entity_wrapper->$property_name = $updated_entity_wrapper->$property_name;

Above line should be like
$date_entity_wrapper->$property_name = $updated_entity_wrapper->$property_name->value();

Please have a look, everything else work fine for me.

Thanks

Steve Polito Design’s picture

Thanks for all the hard work on this! I have patched the module using the patch from #9, but am running into the following error when attempting to update all events in a series.

EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 122 of /sites/all/modules/entity/includes/entity.wrapper.inc).

I noticed that this error was mention in this related issue.

tusharbodke’s picture

Hi Steve Polito Design,

Please refer comment #11, to resolve your problem.
Its suggested to update #9 patch at single place, and it will work as expected.

Thanks

jwineichen’s picture

#9 submodule with the #11 edit works for me

yorkshire-pudding’s picture

#9 patch with the #11 edit works for me. @axel.rutz - any chance of updating the patch so this can be progressed?

Thanks

socialnicheguru’s picture

can patch in #9 be re-rolled with #14 update?

Also do you have to select all the fields for them to be considered?

Or is the default that all of these fields will be replicated?

If I select a field, then it will be automatically copied to all the instances and I will not be asked to update all?

Is #10 still an issue?

socialnicheguru’s picture

Status: Needs review » Needs work

It doesn't check if you have actually repeated the date.
it puts up a confirmation message 'Confirm Update' anyway.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new4.62 KB

Here's axel.rutz's patch from #9 with tusharbodke's fix from #11 added.

botris’s picture

Status: Needs review » Reviewed & tested by the community
roxart’s picture

edit, sorry worked now - my mistake