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
I would be happy to write back latter with more support on a views query as those criteria should not be to bad but in the mean time you might want to look at http://www.drupalrooms.com.
-Steve
On Monday, January 19, 2015, Lluís Forns enboig@gmail.com 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.
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_alt...
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.
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_alt...
Jamie Hollyhttp://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/ ]
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:
- 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 javascript:_e(%7B%7D,'cvml','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_alt...
Jamie Hollyhttp://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.
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:
- 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_alt...
Jamie Hollyhttp://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/ ]
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:
- 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_alt...
Jamie Hollyhttp://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.
I would recommend you to use custom module.
If you want to use the view please mention how you connect these two content types?
On Mon, Jan 19, 2015 at 6:37 PM, Lluís Forns enboig@gmail.com 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/ ]
I use entity reference to connect them.
I thing a way to achieve this is adding a context filter for NID and using PHP to select all rooms occupied and remove them. I have a view to select reservations by date, I could call it using PHP, apply the date filter, and get the nids to remove.
My problem now is how to call a view programatically just to get the nids.
2015-01-20 6:20 GMT+01:00 muhammed naushad naushunaushad24@gmail.com:
I would recommend you to use custom module.
If you want to use the view please mention how you connect these two content types?
On Mon, Jan 19, 2015 at 6:37 PM, Lluís Forns enboig@gmail.com 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/ ]
-- Thanks Muhammed Naushad Web Developer +971529187882,+919744663973 http://stunningspider.com
-- [ Drupal support list | http://lists.drupal.org/ ]
At last it works. I created another view to list reservations by dates, and I called this inside context filter to avoid selected nodes.
thanks
2015-01-20 11:40 GMT+01:00 Lluís Forns enboig@gmail.com:
I use entity reference to connect them.
I thing a way to achieve this is adding a context filter for NID and using PHP to select all rooms occupied and remove them. I have a view to select reservations by date, I could call it using PHP, apply the date filter, and get the nids to remove.
My problem now is how to call a view programatically just to get the nids.
2015-01-20 6:20 GMT+01:00 muhammed naushad naushunaushad24@gmail.com:
I would recommend you to use custom module.
If you want to use the view please mention how you connect these two content types?
On Mon, Jan 19, 2015 at 6:37 PM, Lluís Forns enboig@gmail.com 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/ ]
-- Thanks Muhammed Naushad Web Developer +971529187882,+919744663973 http://stunningspider.com
-- [ 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.