I think the way shoud be adding a filter for NID where: nid NOT IN (custom PHP)

AND use custom php to select all nids with bookings for those days (loading a view)

2015-01-19 17:46 GMT+01:00 Lluís Forns <enboig@gmail.com>:
Not working; nearly solved this using:
[other filters]
AND
[
filter_start_date > booking_end_date
OR
filter_end_date<booking_start_date
OR
booking_nid IS NULL
]

But nearly all rooms appear because they have previous bookings outside the interval.


2015-01-19 16:52 GMT+01:00 Steve Kessler <skessler@denverdataman.com>:
If you require the relationship it should fix that.

On Monday, January 19, 2015, Lluís Forns <enboig@gmail.com> wrote:
I was trying to make it without coding a new module; the steps and the result are:

1. created a join, which is no required
I can list all the rooms with the nid of bookings (if avaliable).
2. Created a filter per dates:
only rooms with bookings for that night are available
3. Filter for NULL related booking nid
No room listed

I think the filter should affect only joined content, but it it is affecting the full content. How can I limit to the join?



2015-01-19 16:07 GMT+01:00 Jamie Holly <hovercrafter@earthlink.net>:
How are you associating the rooms content type to the reservations one? If you're using entity reference, then you would want to create a relationship with the reservations content type through that reference field. Make sure you don't check "require this relationship" then add a filter so that the related node (reservations) nid is NULL.

The other option is in a custom module, using hook_views_query_alter. Load the reserved room nids, through a normal DB query, then add a NOT IN condition to the list of nids. Here's the documentation on that hook:

https://api.drupal.org/api/views/views.api.php/function/hook_views_query_alter/7

Jamie Holly
http://hollyit.net
On 1/19/2015 9:37 AM, Lluís Forns wrote:
I have a site with 2 content types: rooms and reservations. I want to list all the rooms without a reservation for an interval, and also for services, capacity, ....

I tried creating a view with a PHP filter to check free rooms, but then if the page lists 10 rooms, sometimes there are 7, 2, or 0; because the filter lists the 10 rooms and after remove the occupied ones.

I have tried to create a "subview" filter to select nodes "not in (view of occupied rooms); but I haven't find a way to do so.

Any idea of how to accomplish this?

thanks
--
*Ser freak no és imprescindible per ser informàtic, però ajuda.




--
[ Drupal support list | http://lists.drupal.org/ ]



--
*Ser freak no és imprescindible per ser informàtic, però ajuda.
*La vida no ha de ser feliç, ha de ser plena.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.


--
Steve Kessler
Owner and Lead Consultant 
Denver DataMan, LLC 
303-587-4428


--
[ Drupal support list | http://lists.drupal.org/ ]



--
*Ser freak no és imprescindible per ser informàtic, però ajuda.
*La vida no ha de ser feliç, ha de ser plena.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.



--
*Ser freak no és imprescindible per ser informàtic, però ajuda.
*La vida no ha de ser feliç, ha de ser plena.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.