Problem/Motivation

As far as I can tell, there isn't currently an easy way to stop an instance from being deleted when its series is updated. This may not be ideal if an instance contains information that otherwise needs to be kept around. We should provide a hook to allow altering the instances before they are deleted and recreated.

Comments

mrweiner created an issue. See original summary.

mrweiner’s picture

Here's a patch that I created for my own use. The message I added in the event that instances were skipped probably isn't ideal for all cases. It might be nice to provide some way for the user to modify the message/provide their own message. Maybe another alter hook specifically for the message?

Patch doesn't provide tests.

mrweiner’s picture

Status: Active » Needs review

Probably worth marking NR for visibility.

owenbush’s picture

This is an interesting idea and I think the idea of adding a hook is a good one for this use-case. I do have some questions, though. In order to trigger the instance deletions, you must be updating something related to the recurrence pattern (either the type, the date, the time, the duration etc). The skipped events then will not match that pattern as they won't have been recreated. So how are you handling that sort of thing? Manually updating those events? Or is it not a problem that some of the event instances may be out of sync with the series configuration?

mrweiner’s picture

Or is it not a problem that some of the event instances may be out of sync with the series configuration?

Exactly this. The eventseries represents a music lesson schedule, and the instances represent music lessons. Teachers attach things like lesson notes, teaching materials media to share with students, etc, onto the instances, so I need this information to persist regardless of the overall schedule change. The initial date is also valuable in itself.

I'm sure there are a variety of use cases where folks might need a particular instance to stick around even if it's out of sync with the series.

  • owenbush committed f7242ce2 on 2.0.x authored by mrweiner
    Issue #3385480 by mrweiner: Add a hook to alter instances to be deleted...

  • owenbush committed 409a2b54 on 8.x-1.x authored by mrweiner
    Issue #3385480 by mrweiner: Add a hook to alter instances to be deleted...
owenbush’s picture

Status: Needs review » Fixed

Thanks for the patch and explanations. This has been merged into the latest dev branches.

mrweiner’s picture

Rad, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.