Hey!

I've just started testing the RC2 and realized that whenever i make a booking and then try to edit it the number of adults defaults to 2. After printing the $booking variable i saw that the "data" didn't have any information about the group size in it.

I also tried looking at some older existing bookings made with the rc1 version and they have this information in the database (and also in the $booking variable), so i'm guessing that is a bug in the latest version?

Another wierd thing is that when i try to re-assign a unit i always get the results of rooms available that are units of the unit type which was created last. After booking all of them, i get a list of available units from another type (the "unit type" selection has no effect at all).
Any ideas what could be causing this behaviour?

Comments

Hi, sounds like a bug. Could you provide some more information - like step by step instructions to reproduce the bug with behaviour you expected to see and what you got?

Assigned:Unassigned» ronald_istos
Priority:Normal» Critical

Assigned:ronald_istos» Unassigned
Priority:Critical» Normal

Hey!

sure thing... so i also thought that maybe something that i already had in the configuration or the existing units/bookings,... could be causing the problem, and i decided to create a fresh testing environment to rule that out.

i've installed drupal 7.20, and the libraries and modules as writen in the README.txt file.

then the procedure went sth like this:
1. create a new room type

{
  "type" : "test_type_small",
  "label" : "test type small",
  "weight" : "0",
  "data" : {
    "base_price" : "20",
    "sleeps" : "2",
    "children_sleeps" : "",
    "cot_surcharge" : "",
    "rooms_description_source" : "",
    "singlediscount" : ""
  },
  "rdf_mapping" : []
}

2. do the same for "test_type_medium, the only difference is that 4 people can sleep there and the price is 40.
3. create 3 medium rooms and 2 small rooms (units) (at this step i found another minor bug which i will describe at the end of this post)
4. go to /booking and search for available rooms from 5.3.2013 to 7.3.2013 for 2 adults (one room)
5. make the booking for one of the small rooms
6. go to admin/rooms/bookings and edit the newly created booking
7. click on re-assign unit and only the units from the "medium" type rooms come up (none of the other available "small" rooms).
The unit type dropdown has no function here (doesn't change anything, results only show the "medium" type units no matter what the selection is).

8. another problem is that we can for example change the group size to 4 and save the booking (which is wrong since this unit can only sleep 2 -> i think this was not possible in the rc1

9. now i click on re-assign unit again and assign one of the "medium" rooms.
10. go to edit the same booking again, re-assign unit and again only the units from the "medium" type are shown (except the one we just moved it too)
11. create bookings for the same date on the other rooms from the "medium" type (after this step all the medium rooms should be booked)
12. edit the first booking again, re-assign unit and now the "small" type rooms show up as an option (since all the medium ones are full)
13. another problem now is that even thou the bookings were made for 4 persons (in all of the medium rooms except our first booking), i can move any of them to a small room no questions asked, that is because of the lack of group size information in the data variable. (as soon as we change the group size and save that booking the data geets stored there, just not when making the booking in the first place)

Hope that explains it a bit better, if it was not detailed enough or i wrote sth confusing pls let me know and i will try to explain better/clearer :)

and for the problem while creating units... i got an error:

Error message
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '' for column 'cot_surcharge' at row 1: INSERT INTO {rooms_units} (type, name, created, changed, base_price, cot_surcharge, default_state, bookable, sleeps, children, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => test_type_small [:db_insert_placeholder_1] => asdf [:db_insert_placeholder_2] => 1362328363 [:db_insert_placeholder_3] => 1362328363 [:db_insert_placeholder_4] => 20 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => 2 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => a:2:{s:14:"singlediscount";s:0:"";s:15:"bed_arrangement";a:2:{s:7:"singles";s:0:"";s:7:"doubles";s:0:"";}} ) in drupal_write_record() (line 7106 of J:\dev\drupal\sandbox2\includes\common.inc).
The website encountered an unexpected error. Please try again later.

The problem is only that the Cot Surcharge should default to 0 if "" is entered in the form but it doesn't so i don't think we need a new issue for this or am i wrong?

so i have done a bit more testing and printing variables... here are my findings:

only one unit type (the last one that has any rooms available) is printed because this code in function rooms_booking_edit_form($form, &$form_state, $booking) doesn't add a fieldset but just "overrides" the existing one.
this code for example

foreach ($available_units as $type => $units_per_price) {
          // Load the type obj and set a title
          $type_obj = rooms_unit_type_load($type);
          $form['availability_fieldset']['unit_fieldset']['type'] = array(
            '#type' => 'fieldset',
            '#title' => t($type_obj->label),
          );
...

if i print out the $form variable after each iteration of foreach ($available_units as $type => $units_per_price) loop, i see that all the unit types are there (also all of them exist in the $available_units variable)

after changing
$form['availability_fieldset']['unit_fieldset']['type'] = array(
$form['availability_fieldset']['unit_fieldset']['type']['unit_id'] = array(
to
$form['availability_fieldset']['unit_fieldset'][$type_obj->label] = array(
$form['availability_fieldset']['unit_fieldset'][$type_obj->label]['unit_id'] = array(

i get all the types listed (with the correct rooms available)

what really confuses me is how come the code from dev version (9th february release) works just fine, i'm guessing i'm missing something obvious...

hope that will help find out where the actual culprit is faster.

Status:Active» Closed (fixed)