function rooms_booking_find_customer_by_name in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Find a customer_id in the commerce customer tables looking by customer name.
@params string $customer_name The customer name to lookup.
Return value
int|false ID of the customer or FALSE if not found.
3 calls to rooms_booking_find_customer_by_name()
- rooms_booking_edit_form_submit in modules/
rooms_booking/ rooms_booking.admin.inc - Form API submit callback for the Booking form.
- rooms_booking_edit_form_validate in modules/
rooms_booking/ rooms_booking.admin.inc - Form API validate callback for the booking form.
- rooms_booking_manager_rooms_booking_edit_form_submit in modules/
rooms_booking_manager/ rooms_booking_manager.module - Submit handler for the 'rooms_booking_edit' form.
File
- modules/
rooms_booking/ rooms_booking.module, line 950 - Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.
Code
function rooms_booking_find_customer_by_name($customer_name) {
if (module_exists('commerce_customer')) {
return db_select('field_data_commerce_customer_address')
->fields('field_data_commerce_customer_address', array(
'entity_id',
))
->condition('commerce_customer_address_name_line', $customer_name, '=')
->condition('entity_type', 'commerce_customer_profile')
->condition('bundle', 'billing')
->execute()
->fetchField();
}
return FALSE;
}