The number of nights part in the commerce_line_item label is set to maximum 30 days. If a booking is placed with 31 it starts over from 0.

I don't know if this is a bug but i have a hard time understanding the use of the current functionality.

I fixed it by changing and moving the php date/time formating on line 29-30 of rooms_booking_manager/rooms_booking_manager_commerce.inc:

- $nights = $dd->diff($agent->start_date)->d;
- $line_item_label = 'Booking for ' . $unit_type->label . ' (' . $nights . ' Nights; Arriv......

+ $nights = $dd->diff($agent->start_date);
+ $line_item_label ='Booking for ' . $unit_type->label . ' (' . $nights->format('%a') . ' Nights; Arriv.....

Comments

1an_m’s picture

StatusFileSize
new63.33 KB

I can confirm this with dev version as well. This seems to be an issue with the line item label only, since the correct number of nights is used to calculate the price.

nicola85’s picture

The fix is this:

- $nights = $dd->diff($agent->start_date)->d;

+ $nights = $dd->diff($agent->start_date)->days;

This will be solved soon in the latest dev

pozzobalbi’s picture

Priority: Normal » Critical
StatusFileSize
new55.93 KB

Besides a calculation error when selecting a booking from 1. October 2013 to 1. November 2013 (he was calculating 1 Night - which was fixed with the fix from above), I also get an error in calculating the price for the complete stay. When calculating the total for 31 nights, he is actually giving the price for only one night.

See attachment. Unit price is 30€. This is a critical bug and present in 1.0 and 1.x-dev. Please help.

nicola85’s picture

The fix is this:

- $days = $event->diff()->d + 1;
+ $days = $event->diff()->days + 1;

in file rooms_pricing.unit_pricing_calendar.inc

This will be solved soon in the latest dev

ronald_istos’s picture

Issue summary: View changes
Status: Active » Closed (fixed)

Code committed to master