When I try to search available rooms I get message: The room is not available for this date.
What can be done to solve this?

Comments

larowlan’s picture

Hi
Is the calendar showing the room as available?
Do you have a rate set for those dates?
The date module is changing about so rapidly and dramatically that it is possible that something has moved upstream...
Lee

gkazhus’s picture

Hi,
Yes calendar shows rooms available and also I have set rates for those dates. But I have one more problem that I cant edit availability in calendar too. It left default.

gkazhus’s picture

Is here any news in this problem how to solve?

larowlan’s picture

Hi
I've not had time to try and replicate this on my install yet.
Will keep you posted.
Any more debugging info you can provide would be great.

Lee

j1mb0b’s picture

If I leave check-in date as defaulted value and make sure there is availability and a rate for that date it adds the room to the cart. If I replicate this for a date In the future I receive this message: The room is not available for this date. Even though on the calendar it is set to available with the rate. It is very annoying this issue as it seems it would be an easy fix if only I new!!

larowlan’s picture

I think something has changed in the date module. In my test an attempt to book one night ended up booking 366!

j1mb0b’s picture

Thank you larowlan I suspected that was the case, I just rolled back the date module to the april release and it works!

manicato’s picture

In the file hotel_booking.util.inc in line 483 :
$last_dt = new DateObject($check_in, date_default_timezone(), DATE_FORMAT_ISO);

This returns not the check-In date but today's date! $check_in has the correct date. So it's 100% because of the date module.

But I can't find in which file DateObject is declared.

larowlan’s picture

Hi
The format of the arguments must have changed...

manicato’s picture

Into what?

larowlan’s picture

what format is $check_in?
They've changed DATE_ISO to DATE_FORMAT_ISO before, maybe they've gone back again - or maybe I've missed somewhere in the file and still have DATE_ISO.
Looking at the date project page, it looks like we're doing it right so $check_in must be in the wrong format, in which case it might be the format of the 'date_popup' field defined on the checkout form in hotel_booking_search_form.

Lee

dazrour’s picture

I am having the same issue. I get the same issue whichever version of Date I use. Could the date format setting in drupal affect this?

Some more info:
I have been playing around with different versions of both Date and uc_hotel. Using the latest dev version of date 7.2 and the alpha version of uc_hotel I can set room availabilities and the calendars update to show the available rooms, however the date picker does not. Also if i select a date which is available it responds saying not available, but leaving it on tomorrows date (default date when page loads) it lets me add it cart but adds 366 nights.
I have looked at the hotel_booking.module and the hotel_booking.util.inc files and it would seem all of the date_format_iso v date_iso seem correct. Have you had chance to have a look at this?
I did try to get the version of date which the docs suggest but past dev versions are not available for download.

Thanks
Darren

sylvainblot’s picture

according to the date module code:

define('DATE_ISO', 'date');
define('DATE_UNIX', 'datestamp');
define('DATE_DATETIME', 'datetime');
define('DATE_ARRAY', 'array');
define('DATE_OBJECT', 'object');
define('DATE_ICAL', 'ical');

define('DATE_FORMAT_ISO', "Y-m-d\TH:i:s");
define('DATE_FORMAT_UNIX', "U");
define('DATE_FORMAT_DATETIME', "Y-m-d H:i:s");
define('DATE_FORMAT_ICAL', "Ymd\THis");
define('DATE_FORMAT_ICAL_DATE', "Ymd");
define('DATE_FORMAT_DATE', 'Y-m-d');

define('DATE_REGEX_ISO', '/(\d{4})?(-(\d{2}))?(-(\d{2}))?([T\s](\d{2}))?(:(\d{2}))?(:(\d{2}))?/');
define('DATE_REGEX_DATETIME', '/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):?(\d{2})?/');
define('DATE_REGEX_LOOSE', '/(\d{4})-?(\d{1,2})-?(\d{1,2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})?(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?/');
define('DATE_REGEX_ICAL_DATE', '/(\d{4})(\d{2})(\d{2})/');
define('DATE_REGEX_ICAL_DATETIME', '/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?/');

So for that line it should be DATE_FORMAT_DATE anyway I found this problem in lot of DateObject usage, I fixed most of them but I still have the issue. Any help ?

sylvainblot’s picture

There is also
hotel_booking.util.inc
422: $start_date = new DateObject($check_in, date_default_timezone(), DATE_FORMAT_DATE);
423: $end_date = new DateObject($check_out, date_default_timezone(), DATE_FORMAT_DATETIME);

and a couple more, I will prepare a patch.

sylvainblot’s picture

Status: Active » Needs review
StatusFileSize
new953 bytes

working in my install

larowlan’s picture

@manicato, @dazrour, @kingmackenzie, @gkazhus - does this patch sort the issues for you?
Please report testing results here and if all good I'll commit and re-roll a beta2

sylvainblot’s picture

StatusFileSize
new3.58 KB

Ive found a couple more argument errors

Here is a better patch.

_boban’s picture

Status: Needs review » Reviewed & tested by the community

It solve the issue with date-7.x-2.0-alpha4.

requiem08’s picture

sylvainblot .. How will I use the patch? newbie here!

larowlan’s picture

@requiem08 http://drupal.org/patch

Will try and roll a new version some time between now and weekend.

phuongnam3k’s picture

hi,

I'm using Date 7.x-2.0-alpha4 but still get the issue like always show 366 nights at shopping cart. which patch fixed it already? and how to apply a patch? (im using window not linux)

Please help me.
Best regards,
PS: Sorry my bad english

sylvainblot’s picture

@phuongnam3k use the latest patch #17

to patch on windows: http://drupal.org/node/60179

phuongnam3k’s picture

thanks so much sylvainblot,
it works! you save my life. :)

phuongnam3k’s picture

hi,

the patch work fine but there is 1 problem:

-First, I book 1 room
-Then add 1 product (such as: wifi)
-If I remove room first then product then it works fine but I remove product first then it raise an error.

Notice: Undefined index: qty in uc_cart_update_item_object() (line 1555 of F:\wamp\www\WBE\sites\all\modules\ubercart\uc_cart\uc_cart.module)...

What can be done to solve this?
PS:sorry my bad English

sylvainblot’s picture

@phuongnam3k Comment this:

# else {
# db_update("uc_cart_products")
# ->fields(array(
# 'qty' => $qty,
# 'changed' => REQUEST_TIME
# ))
# ->condition('nid', $nid)
# ->condition('cart_id', $cid)
# ->condition('data', serialize($data))
# ->execute();
# }

in hotel_booking.ubercart.inc in the hotel_booking_uc_update_cart_item function

sylvainblot’s picture

There is some other date issues in the hotel_booking_availability_calendars iSO => DATETIME

requiem08’s picture

Hi!! I just have a problem on adding base rate and adding hotel room type.. I added a base rate 1500.00 in the whole month of November, then I created a hotel room type, and apply my base rate.. when I hit save.. I get an error stating:

PDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'from_rate' at row 1: UPDATE {hotel_booking_room_types} SET from_rate=:db_update_placeholder_0 WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 1500.000 [:db_condition_placeholder_0] => 23 ) in hotel_booking_set_room_from_rate() (line 545 of C:\wamp\www\Balai Gloria\sites\all\modules\uc_hotel\hotel_booking\hotel_booking.util.inc).

..
how will I resolve this.. ?? I'm using Drupal 8 anyway Help me please..

gkazhus’s picture

I have the same issue what mentioned in #24, even when I commented your mentioned #25 lines error still appears, and can remove unwanted items from chart.

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

Can I get an update on the status of this patch?
Anyone using it successfully?

larowlan’s picture

Status: Needs review » Fixed

Fixed in dev release

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

JAScarb’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta1
Priority: Normal » Major
Status: Closed (fixed) » Active

Hi

I have this bug today (but I didn't have it a couple of days ago and I haven't changed anything).

Should I move to the dev version, I was hoping to use this 'live'?

Either that or .. what do I do to implement the patch (on Linux)?

All the best
J

PS. I also have the 365 day booking problem, but maybe that's for another day.

JAScarb’s picture

Sorry, I meant to give the versions: Drupal 7.15, Ubercart 7.x-3.1, Hotel Booking 7.x-1.0-beta1

larowlan’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Fixed

This is fixed in the -dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

giupenni’s picture

Will be fixed in beta version?