Hello,

In a fresh install I created some Bookable Unit Types and afterwards I went to /booking page (without adding any Bookable Unit) and I saw the bellow Notices:

Notice: Undefined index: Standard Single Room in _rooms_booking_manager_get_unit_type_labels() (line 286 ...sites/all/modules/rooms/modules/rooms_booking_manager/rooms_booking_manager.availability_search.inc).
Notice: Trying to get property of non-object in _rooms_booking_manager_get_unit_type_labels() (line 286 ...sites/all/modules/rooms/modules/rooms_booking_manager/rooms_booking_manager.availability_search.inc).

I don't know if this is has to do with my setup or a general bug.

A possible solution might be changing the lines 285-287 in _rooms_booking_manager_get_unit_type_labels() function:

  foreach ($unit_type_ids as $label) {
    $unit_type_labels[$label] = $unit_types[$label]->label;
  }

with this

  foreach ($unit_type_ids as $key => $label) {
    $unit_type_labels[$key] = $unit_types[$key]->label;
  }

P.S. The $unit_type_ids variable has already the information the function returns...?

Comments

ashopin’s picture

Also experiencing this and the suggestion above fixed the error.

stefanpetrov’s picture

Same problem, applied fix from OP and it is ok.

Thank you, @chrbak!

scalas89’s picture

Hello everyone! I tried to reproduce the issue without fortune. With last dev it seems to work fine....can you confirm that?
Thank you for support!

petar_b’s picture

Hello, i an having this related issue/error:
Notice: Trying to get property of non-object in rooms_unit_handler_unit_type_field->render() (line 17 of C:\xampp\htdocs\...\sites\all\modules\rooms\modules\rooms_unit\views\rooms_unit_handler_unit_type_field.inc).

The thing is I cannot connect bookable unit with unit types. I have bookable units listed but the admin table leaves blank areas where should be types listed. I tried deleting them all and then creating new types and adding new units to these but no success. Any ideas?