Needs review
Project:
Hotel Booking System for Ubercart
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2012 at 16:57 UTC
Updated:
30 Dec 2012 at 16:57 UTC
When you goes to the Hotel Availability Calendar page. The title always show the current month even i am browsing other months.
I found the following error when i try to print the $ref_dt on hotel_booking.calendars.inc on line 41.
DateObject Object
(
[granularity] => Array
(
[0] => hour
[1] => minute
[2] => second
[3] => month
[4] => day
[5] => year
[6] => timezone
)
[errors] => Array
(
[invalid] => The value 2013-11-01 does not match the expected format.
)
[serializedTime:DateObject:private] =>
[serializedTimezone:DateObject:private] =>
[timeOnly] =>
[dateOnly] =>
[originalTime] => 2013-11-01
[date] => 2012-12-31 00:49:48
[timezone_type] => 3
[timezone] => Asia/Hong_Kong
)
The date string is not in DATE_FORMAT_ISO when creating the $ref_dt object.
To fix the problem, use the following date formatter.
function hotel_booking_availability_form($form, $form_state, $node, $year = NULL, $month = NULL) {
if (!$node || $node->type != 'hotel_room_type') {
return drupal_not_found();
}
if ($node->tnid && $node->nid != $node->tnid) {
drupal_set_message(t('This room is part of a translation set, availability can only be set against the
translation master, you have been redirected to the translation master to edit the availability'));
drupal_goto('node/'. $node->tnid .'/availability');
}
//set up defaults
if (!$year) {
$year = date('Y');
}
if (!$month) {
$month = date('m');
}
if (!is_numeric($year) || !is_numeric($month)) {
return drupal_not_found();
}
/* FIX */
//$ref_dt = new DateObject("$year-$month-01", date_default_timezone(), DATE_FORMAT_ISO);
$ref_dt = new DateObject("$year-$month-01", date_default_timezone(), 'Y-m-d');