I'd like to rebuild this module around Rules and Entities, to make it easier for people to customize the workflow and results. Before I start committing, I'd like to open the floor for discussion on this. The structure I'm thinking about is simple:

* Make "conflict enabled" a generic entity property. So any entity can have conflict detection enabled.
* Build a single Rules event for "conflict detected", which matches any time two entities with conflict detection have conflicting dates (regardless of 'resources' reserved)
* Build the same (current) workflow in Rules and bundle them with the module.

So this module would be greatly simplified, down to the ability to enable conflict detection, select the relevant date field per-conflict-entity, and throw a Rules Event when they conflict. Rules would be included so that by default, a form error is thrown whenever a date conflict is detected. With Rules, it's very easy to add resource type detection into that workflow, and have different responses based on a variety of conditions.

Use cases not possible with the current structure:

* multiple conflict types: ie 2 kinds of events which should not conflict with each other
* conflicts between any field values, ie display a form error when a conflict pair shares the same TID.
* complex resource conflicts: ie a form error should be set when a conflict pair shares same taxonomy term AND the same entityreference value.
* different reactions per conflict: ie when a conflict pair shares the same TID, throw a form error. When it shares an entityreference, send an email and log it.

Looking through the issue queue, a lot of problems can be solved with this different structure.

On the down side, it would be more or less a complete rebuild. The core date comparison code would stay, but that's about it.

Comments

ohthehugemanatee’s picture

One other note - this would probably also entail dropping support for Event module. It never saw a stable D6 release, and never got to a working upgrade path from 5 to 6 (according to the module page).

We don't HAVE to drop Event module support, but it would simplify things greatly.

ohthehugemanatee’s picture

Committed a working version of this rules-based, no events support version for D7. See http://drupal.org/node/177009/git-instructions/rules to check it out and try for yourself. It's quite simple now, so there's not much to go wrong with it. :)

ohthehugemanatee’s picture

Status: Active » Needs review

updated a bit with more rules integration. Out of the box, this currently replicates the behavior of the existing module... it throws form errors when a conflict exists.

This is where it needs to be for now. I'll give it some time for comment before making it an official 7.x-3.x-dev .

Anyone who wants to play with this module in D7, the Rules branch could use your feedback!

ohthehugemanatee’s picture

Added a Rules Event during node validation, so the validation error works properly. "before content is saved" rules fire on node pre-save, which is long after validation time... so that validation rule didn't work.

ohthehugemanatee’s picture

updated the default Rule with the module so it mimics current behavior: checks for duplicates during node validation, and throws a form error.

The form error action that is included with this module stores a form error for the next time the node goes through validation. this means that it's basically useless with any Rules Event except the one included with the module "a conflict node is validated". With that Event, the action will successfully throw a form error.

I'm about ready to update readme and make this 7.x-3.x-dev . Any comments?

ohthehugemanatee’s picture

Status: Needs review » Closed (fixed)

Releasing as 7.x-3.x-dev and closing this ticket.