Hi
Congrats on v3.0 of the module.
This looks like such a solid solution that I'll move uc_hotel over to it instead.

I've tried to use this field as an availability calendar for a user by placing it on a profile2 entity.
The calendar displays fine but unfortunately the availability edits aren't saved.

Thanks

Lee

Comments

fietserwin’s picture

Assigned: Unassigned » fietserwin

I will have a look at it, it looks like I use the wrong hook to save changes or something like that.

Thanks for your compliments. However I would think, without having had an in-depth look at uc_hotel, that moving uc_hotel to rooms seems to be the more logical way?

fietserwin’s picture

Project: Availability Calendars » Profile 2
Version: 7.x-3.0 » 7.x-1.0
Component: Miscellaneous » Code
Assigned: fietserwin » Unassigned

I had a look at it with the debugger and I think the error is in the Profile2 module.

In the hook_field_attach_submit phase I do change the values of the fields. The documentation describes this phase as follows: "Perform necessary operations on field data submitted by a form." So I think that modules are allowed to change field values in this phase and may assume these values to be saved.

This hook receives an entity object and I expect the fields to be direct properties of this entity object. Profile2 however, stores the fields under the profile the field is part of and makes the profile a (direct) member of the user entity object. So, I would either expect that profile to be the entity that is being passed in or the fields to be copied (by reference) to (and thus available at) the user entity level.

Can a maintainer of profile2 have a look at this?

fietserwin’s picture

Project: Profile 2 » Availability Calendars
Version: 7.x-1.0 » 7.x-3.0
Assigned: Unassigned » fietserwin

OK, it is a problem in the Availability Calendars module after all. It turns out that the hook is (correctly) called multiple times for the different entities on the form, a situation not foreseen by AC. I will fix it and commit it to git.

fietserwin’s picture

Assigned: fietserwin » Unassigned
Status: Active » Fixed

Fixed and committed. Fetch the latest dev version or directly from git.

Status: Fixed » Closed (fixed)

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