After enabling Resource Conflict module, in content types I see Resouce Conflict tab showing "This content type does not contain any suitable Date fields. Please add at least one Date field with required start and end dates.". I have a field date type set in that content type (as pop-up calendar).
What's wrong?
Thanks in advance

Comments

maciej lukianski’s picture

You have to mark the field as required and at the bottom mark "require end date"

Miao1994’s picture

Sorry for the trifling question, I tried to use resource conflit on used data field that not require end date, with data stored in DB; so I can't change require end date option anymore. I think there is no way to fix that.

problue solutions’s picture

Title: Module don't recognize data field » Module don't recognize date field

I have a date field with both start and end dates, required is also ticked.

Still receive the message:

"This content type does not contain any suitable Date fields. Please add at least one Date field with required start and end dates."

caspervoogt’s picture

I too have a date field (using Date 7.x-2.6) on my "Event" content type, with start and end dates required. I also tried Date (iso) and Date (unix timestamp) to avail. Added a date field to both the Resource and Event content types just for good measure, but it made no difference.

I had a quick look in the module code and it's looking for an array called $date_fields, and checking if it's empty. Apparently, it thinks it's empty. I think the following IF statement needs closer inspection;

if (isset($field['display']['default']['module'])&&($field['display']['default']['module'] == 'date')&&($field['required'] == 1)) {

Replace with:

if ( isset($fieldinfo['module']) && ($fieldinfo['module'] == 'date') && ($field['required'] == 1) ) {

Now I see the option "Enable resource conflict checking for this content type" when editing my Events content type.

Basically, the IF statement needed to reference $fieldinfo and not $field, except for checking whether the date field is required.
Also, I had to remove ['display']['default'] as that did not exist in the array structure I saw.

caspervoogt’s picture

I have changed my code so that the date field is no longer required. I have an Events content type, but not every event will need to reserve a resource.
I'm not sure why the date field must be required. What I ended up doing was having one date field for the event itself, and a second date field for reserving the resource.

So:
if ( isset($fieldinfo['module']) && ($fieldinfo['module'] == 'date') && ($field['required'] == 1) ) {
becomes:
if ( isset($fieldinfo['module']) && ($fieldinfo['module'] == 'date') ) {

My reservation date field is now set to *not* required. If I leave it 'required' and try to add an event, it will otherwise result in a white screen (500 server) error.
So maybe the above change still requires a check to make sure the field itself does not require a value. That wouldn't go in this IF statement .. not sure where.

caspervoogt’s picture

Attached is a patch per my comment #5 above.

bkosborne’s picture

Issue summary: View changes
Status: Active » Fixed

This was addressed in a previous commit and should be fixed now. Date fields are also no longer required to be compatible with this module, but the end date is always required.

Status: Fixed » Closed (fixed)

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