protected function RoomsBookingController::delete_line_item in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
1 call to RoomsBookingController::delete_line_item()
- RoomsBookingController::delete in modules/
rooms_booking/ rooms_booking.module - Implements EntityAPIControllerInterface.
File
- modules/
rooms_booking/ rooms_booking.module, line 1155 - Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.
Class
- RoomsBookingController
- The Controller for RoomsBooking entities.
Code
protected function delete_line_item($booking) {
if ($booking->order_id != '') {
$order = commerce_order_load($booking->order_id);
if (isset($order->commerce_line_items[LANGUAGE_NONE])) {
foreach ($order->commerce_line_items[LANGUAGE_NONE] as $value) {
$line_item = commerce_line_item_load($value['line_item_id']);
if ($line_item->rooms_booking_reference[LANGUAGE_NONE][0]['target_id'] == $booking->booking_id) {
commerce_line_item_delete($line_item->line_item_id);
if (count($order->commerce_line_items) == 0) {
commerce_order_delete($order->order_number);
}
break;
}
}
}
}
}