Download & Extend

repeat dates are not checked for conflicts

Project:Resource Conflict
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:raphaelhuefner
Status:reviewed & tested by the community

Issue Summary

if using date.module then repeat dates of already existing events or not checked for conflictso of intended date.

likewise repeat dates of the intended booking are not checked against existing dates or repeat dates.

Comments

#1

Version:6.x-2.0» 6.x-2.x-dev
Category:support request» feature request

Implementing repeat support will require additional code, as Date Repeat doesn't expose repeating dates as nodes.

#2

Assigned to:Anonymous» raphaelhuefner

I'm working on this for one of my clients. Hope to have a patch out until 2010-03-14.

#3

I'm having potentially related problems:

If I have a EventA that is every sunday from 10:00 to 11:00, with the exception of April 4. And, then I added an EventB for sunday april 4 at 10:30, I get a resource conflict and it won't save.

Is this related?

#4

Status:active» needs review

@keith_k: thank you for adding a further test case, so I tested that this 'gap filling' is indeed possible with my patch. I hope I understood your scenario right, please test it again at your site. If it fails, we'll go into the details. ;-)

Please review!

AttachmentSize
resource_conflict-2.0-641850.patch 5.68 KB
resource_conflict-2.x-dev-641850.patch 6.11 KB

#5

PS: outputting a correct error message makes only sense after applying #590200: Revisions causes wrong conflicts as we need the values of nid, vid and delta from the date_table for that.

#6

This patch is exactly what I need as well! I tried applying the 2.0 patch and, although it applied without issue, the conflict checking still isn't working on repeat events.

**Edit** by the way, I'm using node repeat which may add additional complication since it's actually generating nodes...note that it DOES use the Date Repeat API to create it's functionality, though. So I assumed that any date repeat implementation should also work here...

#7

Thank you for taking the time to test this!

I have no experience with http://drupal.org/project/node_repeat so far. Will only have time to look into it after 2010-05-12, though. From just glancing over the http://drupal.org/project/node_repeat project page it could well be that your suspicion is right.

As far as I got with http://drupal.org/project/resource_conflict and Date Repeat API the date sequence is stored inside ONE node as multiple value field, and as I understood in such a short time with http://drupal.org/project/node_repeat the date sequence is stored across SEVERAL nodes, so maybe my patch considers only the data suitable for the first use case.

#8

Ahh, yes, this makes sense. The date information is indeed stored across multiple nodes with node_repeat (it's actually creating nodes with a sort of 'reference' between them to get them to relate to each other). So, while it may use Date API for it's node creation, the actual creation may not be checked for conflicts.

Unless you can somehow hook into the actual node creation process and check every node being created (no matter the method) I have a feeling that this would need some 'glue code' to function with node_repeat. I will file a follow up support request on the best way to create that code.

Thanks!

#9

Here is an untested reroll of #4 that works with node revisions. Anyone care to test it?

AttachmentSize
641850_date_repeat_9.patch 6.12 KB

#10

I tired, but the patch failed against current resource_conflict-2.x-dev

drush dl resource_conflict-6.x-2.x-dev
patch -i 641850_date_repeat_9.patch
patching file resource_conflict.module
Hunk #1 succeeded at 28 with fuzz 1.
Hunk #2 succeeded at 331 (offset 6 lines).
Hunk #4 succeeded at 379 (offset 6 lines).
Hunk #5 FAILED at 400.
1 out of 6 hunks FAILED -- saving rejects to file resource_conflict.module.rej

#11

But I applied manually and it seems to work. However I have variable_del('rc_type_'. $type); commented, but there is no watchdog entry.

#12

resource_conflict-2.0-641850.patch in #4 worked like a charm for me.

thanks to raphaelhuefner for sharing this solution with the community!

#13

Thanks for the testing - let's try this gain.

AttachmentSize
641850_date_repeat_12.patch 6.09 KB

#14

The patch applies nicely to current dev release.

I extended it with a fix for the DATE_DATETIME issue mentioned here #821884: date_is_valid does not sufficiently distinguish between DATE_ISO and DATE_DATETIME this way it also checks for repeating datetime fields.

Further I added and ORDER BY clause this way the most recent conflict comes first.

AttachmentSize
resource_conflict-641850-14.patch 7.81 KB

#15

For resource_conflict-641850-14.patch, I think this line (around line 31)

$overlapping_node_ids = _resource_conflict_overlaps_from_date($start, $end);

needs to be removed.

#16

jromine, you are right - thanks:-)

Any way to get this into head?

#17

Updating the patch.

AttachmentSize
resource_conflict-641850-17.patch 7.78 KB

#18

This patch is working for me with Drupal-6.17.

#19

Here's an update that just clarifies some of the function comments and cleans up a few very minor spacing issues.

If someone tests it successfully, please mark it as RTBC and I'll commit it.

AttachmentSize
641850_node_repeat_19.patch 8.07 KB

#20

Status:needs review» reviewed & tested by the community

I've tested this patch, and it works fine for me.

#21

:-) The patch applies fine against 6.x-2.x-dev of today. Please commit this.