Index: hotel_booking/hotel_booking.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_hotel/hotel_booking/hotel_booking.module,v
retrieving revision 1.5
diff -u -p -r1.5 hotel_booking.module
--- hotel_booking/hotel_booking.module  30 Nov 2009 22:30:11 -0000      1.5
+++ hotel_booking/hotel_booking.module  30 Nov 2009 23:17:57 -0000
@@ -1501,3 +1501,9 @@ function hotel_booking_cart_details_tabl
     return theme('table', $header, $rows);
   }
 }
+
+
+function hotel_booking_pad_with_zeros($s, $n) {
+  return sprintf("%0". $n ."d", $s);
+}
+
Index: hotel_booking/hotel_booking_admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_hotel/hotel_booking/hotel_booking_admin.inc,v
retrieving revision 1.3
diff -u -p -r1.3 hotel_booking_admin.inc
--- hotel_booking/hotel_booking_admin.inc       5 Nov 2009 09:23:12 -0000       1.3
+++ hotel_booking/hotel_booking_admin.inc       30 Nov 2009 23:17:57 -0000
@@ -574,7 +574,7 @@ function hotel_booking_rates_form_valida
             $day_num = 1;

             while ($day_num <= $days_in_month) {
-                $form_state['price['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']'] = $form_state['rate_all_'. $i];
+                $form_state['price['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']'] = $form_state['rate_all_'. $i];
             }
         }
         else {
@@ -762,7 +762,7 @@ function hotel_booking_rate_calendar($mo

   $header = array(t('<center>Sunday</center>'), t('<center>Monday</center>'), t('<center>Tuesday</center>'), t('<center>Wednesday</center>'), t('<center>Thursday</center>'), t('<center>Friday</center>'), t('<center>Saturday</center>'));

-  $result = db_query('SELECT rate, caldate FROM {hotel_rate_calendars} WHERE hrid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $hrid, $year, _pad_with_zeros($month, 2), $year, _pad_with_zeros($month, 2), _days_in_month($month, $year));
+  $result = db_query('SELECT rate, caldate FROM {hotel_rate_calendars} WHERE hrid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $hrid, $year, hotel_booking_pad_with_zeros($month, 2), $year, hotel_booking_pad_with_zeros($month, 2), _days_in_month($month, $year));

   while ($results = db_fetch_array($result)) {
     // Extract DAY from the crappy datetime DB field type.
@@ -808,7 +808,7 @@ function hotel_booking_rate_calendar($mo

   while ($day_num <= $days_in_month) {
     $output = '<div style="text-align:center">'. $day_num .'</div>';
-    $output .= '$ <input class="form-text uc_hotel_rate'. $group .'" type="text" size = "12" name="price['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']" value="';
+    $output .= '$ <input class="form-text uc_hotel_rate'. $group .'" type="text" size = "12" name="price['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']" value="';
     $output .= (isset($day_prices[$day_num]['rate']) && is_numeric($day_prices[$day_num]['rate'])) ? number_format($day_prices[$day_num]['rate'], 2, '.', '') : '0.00';
     $output .= '" />';

Index: hotel_calendars/hotel_calendars.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_hotel/hotel_calendars/hotel_calendars.module,v
retrieving revision 1.2
diff -u -p -r1.2 hotel_calendars.module
--- hotel_calendars/hotel_calendars.module      30 Nov 2009 22:30:11 -0000      1.2
+++ hotel_calendars/hotel_calendars.module      30 Nov 2009 23:17:57 -0000
@@ -145,7 +145,7 @@ function hotel_calendars_month_table($mo
   }

   // Gather up all existing availability info
-  $results = db_query('SELECT * FROM {hotel_availability_calendars} WHERE rtid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $nid, $year, _pad_with_zeros($month, 2), $year, _pad_with_zeros($month, 2), hotel_calendars_days_in_month($month, $year));
+  $results = db_query('SELECT * FROM {hotel_availability_calendars} WHERE rtid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $nid, $year, hotel_booking_pad_with_zeros($month, 2), $year, hotel_booking_pad_with_zeros($month, 2), hotel_calendars_days_in_month($month, $year));
   while ($result = db_fetch_array($results)) {
     // Extract DAY from the crappy datetime DB field type.
     $tmp = explode("-", $result['caldate']);
@@ -194,7 +194,7 @@ function hotel_calendars_month_table($mo
     $output = '<div style="text-align:right"><strong>'. $day_num .'</strong></div>';

     // Quantity Field
-    $output .= '<div style="text-align:center">Available: <input class="form-text" type="text" size = "3" name="avail_quantity['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']" value="';
+    $output .= '<div style="text-align:center">Available: <input class="form-text" type="text" size = "3" name="avail_quantity['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']" value="';
     $output .= (isset($day_data[$day_num]['avail_quantity']) && is_numeric($day_data[$day_num]['avail_quantity'])) ? $day_data[$day_num]['avail_quantity'] : $default_available;
     $output .= '" /></div>';

@@ -202,7 +202,7 @@ function hotel_calendars_month_table($mo
     $output .= '<fieldset class="collapsible collapsed"><legend>Restrictions</legend>';

     // Minimum Stay Field
-    $output .= '<div style="text-align:center">Required Minimums:<br /><select class="form-select" name="minstay['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']">';
+    $output .= '<div style="text-align:center">Required Minimums:<br /><select class="form-select" name="minstay['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']">';
     $selected_stay = (isset($day_data[$day_num]['minstay'])) ? $day_data[$day_num]['minstay'] : 0;
     foreach ($stay_options as $value => $text) {
       $output .= '<option value="'. $value .'"';
@@ -214,7 +214,7 @@ function hotel_calendars_month_table($mo
     $output .= '</select></div>';

     // Minimum Occupancy Field
-    $output .= '<div style="text-align:center"><select class="form-select" name="minoccupancy['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']">';
+    $output .= '<div style="text-align:center"><select class="form-select" name="minoccupancy['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']">';
     $selected_occ = (isset($day_data[$day_num]['minoccupancy'])) ? $day_data[$day_num]['minoccupancy'] : 0;
     foreach ($occ_options as $value => $text) {
       $output .= '<option value="'. $value .'"';
@@ -226,7 +226,7 @@ function hotel_calendars_month_table($mo
     $output .= '</select></div>';

     // Arrival & Departure restrictions:
-    $output .= '<div style="text-align:center">Check In/Out<br /><select class="form-select" name="cir['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']">';
+    $output .= '<div style="text-align:center">Check In/Out<br /><select class="form-select" name="cir['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']">';
     $output .= '<option value="0"';
     if ($day_data[$day_num]['cir'] == 0) {
       $output .= ' selected="selected"';
@@ -237,7 +237,7 @@ function hotel_calendars_month_table($mo
       $output .= ' selected="selected"';
     }
     $output .= ">Can't Check-in</option></select>";
-    $output .= '<div style="text-align:center"><select class="form-select" name="cor['. $year .'-'. _pad_with_zeros($month, 2) .'-'. _pad_with_zeros($day_num, 2) .']">';
+    $output .= '<div style="text-align:center"><select class="form-select" name="cor['. $year .'-'. hotel_booking_pad_with_zeros($month, 2) .'-'. hotel_booking_pad_with_zeros($day_num, 2) .']">';
     $output .= '<option value="0"';
     if ($day_data[$day_num]['cor'] == 0) {
       $output .= ' selected="selected"';
@@ -272,16 +272,11 @@ function hotel_calendars_month_table($mo
   return $table;
 }

-
-function _pad_with_zeros($s, $n) {
-  return sprintf("%0". $n ."d", $s);
-}
-
 function hotel_calendars_node_edit_form_submit($form, &$form_state) {
   $nid   = check_plain($form_state['values']['nid']);
   $year  = check_plain($form_state['values']['year']);
   $month = check_plain($form_state['values']['month']);
-  db_query('DELETE FROM {hotel_availability_calendars} WHERE rtid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $nid, $year, _pad_with_zeros($month, 2), $year, _pad_with_zeros($month, 2), hotel_calendars_days_in_month($month, $year));
+  db_query('DELETE FROM {hotel_availability_calendars} WHERE rtid = %d AND caldate BETWEEN "%s-%s-01" AND "%s-%s-%s"', $nid, $year, hotel_booking_pad_with_zeros($month, 2), $year, hotel_booking_pad_with_zeros($month, 2), hotel_calendars_days_in_month($month, $year));

   foreach ($_POST['avail_quantity'] as $date => $avail) {
     $today = explode('-', $date);
