You are here

function rooms_booking_commerce_line_item_delete in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Implements hook_commerce_line_item_delete().

File

modules/rooms_booking/rooms_booking.module, line 720
Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.

Code

function rooms_booking_commerce_line_item_delete($line_item) {
  if (isset($line_item->rooms_booking_reference[LANGUAGE_NONE][0]['target_id'])) {
    $booking = rooms_booking_load($line_item->rooms_booking_reference[LANGUAGE_NONE][0]['target_id']);
    if ($booking !== FALSE) {
      if ($line_item->order_id == $booking->order_id) {
        rooms_booking_delete($booking, FALSE);
      }
    }
  }
}