We recently implemented uc_hotel for a client that, under some circumstances, required more than the default maximum (8) of adults for an "accommodation unit".

I've attached a patch for hotel_booking.module and hotel_booking.admin.inc

This patch uses a Drupal variable 'hotel_booking_adults_max_count' to store the maximum value (default is 8) and then uses this value to generate the "Number of Adults" selector

CommentFileSizeAuthor
uc_hotel_4.0A1.patch2.59 KBalansch

Comments

larowlan’s picture

Status: Active » Needs work
+++ F:/uc_hotel_patched/hotel_booking/hotel_booking.module	Tue Sep 20 16:05:31 2011
@@ -404,6 +404,14 @@
+      $form['search_adults_max_count'] = array(
+        '#type'          => 'textfield',
+        '#title'         => t('Maximum Number of Adults'),
+        '#default_value' => variable_get('hotel_booking_adults_max_count', '8'),
+        '#description'   => t('Select maximum number of adults to allow for adults selection option in search block.'),
+      );
+

I think this only belongs in the admin settings page, not the block settings. It impacts both the block search form and the page search form. Having it in both might lead the admin to believe they can change the two independently. Also I think 'Enter maximum...' would be more appropriate.

+++ F:/uc_hotel_patched/hotel_booking/hotel_booking.module	Tue Sep 20 16:05:31 2011
@@ -424,6 +432,7 @@
+      variable_set('hotel_booking_adults_max_count', $edit['search_adults_max_count']);

This not needed if admin option goes into the admin pages.

+++ F:/uc_hotel_patched/hotel_booking/hotel_booking.admin.inc	Tue Sep 20 16:04:56 2011
@@ -146,6 +146,14 @@
+  $form['block']['hotel_booking_adults_max_count'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Maximum Number of Adults'),
+    '#default_value' => variable_get('hotel_booking_adults_max_count', '8'),
+    '#description'   => t('Select maximum number of adults to allow for adults selection option in search block.'),
+  );

We need some validation code to ensure they've entered a valid number or the range function will error out.

Powered by Dreditor.