function rooms_unit_update_7008 in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Updates all data saved in Rooms Unit Type to change max/min_children_sleeps to max/min_children.
File
- modules/
rooms_unit/ rooms_unit.install, line 572 - Sets up the base table for our entity and a table to store information about the entity types.
Code
function rooms_unit_update_7008() {
foreach (rooms_unit_types_ids() as $type => $label) {
$unit_type = rooms_unit_type_load($type);
$unit_type->data = array(
'base_price' => $unit_type->data['base_price'],
'min_sleeps' => $unit_type->data['min_sleeps'],
'max_sleeps' => $unit_type->data['max_sleeps'],
// Rename min/max_children_sleeps to min/max_children.
'min_children' => isset($unit_type->data['min_children_sleeps']) ? $unit_type->data['min_children_sleeps'] : $unit_type->data['min_children'],
'max_children' => isset($unit_type->data['max_children_sleeps']) ? $unit_type->data['max_children_sleeps'] : $unit_type->data['max_children'],
'rooms_description_source' => $unit_type->data['$unit_type->data'],
);
rooms_unit_type_save($unit_type);
}
}