function merci_node_type_update_variables in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
2 calls to merci_node_type_update_variables()
- merci_node_type_insert in ./
merci.module - @todo Please document this function. Implement hook_node_type_insert called via node_type_save NOTE: // Saving the content type after saving the variables allows modules to act // on those variables via hook_node_type_insert(). via…
- merci_node_type_update in ./
merci.module - @todo Please document this function.
File
- includes/
database.inc, line 83 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_node_type_update_variables($info, $existing) {
// This hack is necessary because the node type form submit
// automatically saves all remaining form items to {variable}
// We're doing custom storage, so remove these.
// Don't delete merci_type_setting_
$variables = array(
'merci_max_hours_per_reservation',
'merci_allow_overnight',
'merci_allow_weekends',
'merci_late_fee_per_hour',
'merci_rate_per_hour',
'merci_fee_free_hours',
'merci_status',
'merci_spare_items',
'merci_min_cancel_hours',
'merci_autocheckout',
'merci_autocheckin',
'merci_selfcheckout',
'merci_active_status',
'merci_auto_assign_bucket_item',
);
$settings = array(
'merci_type_setting' => merci_type_setting($info->type),
'type' => $info->type,
);
foreach ($variables as $variable) {
$settings[$variable] = variable_get($variable . '_' . $info->type, 0);
variable_del($variable . '_' . $info->type);
}
if (!$existing) {
$return = drupal_write_record('merci_node_type', $settings);
}
else {
$return = drupal_write_record('merci_node_type', $settings, 'type');
}
cache_clear_all('merci_' . $settings['type'] . '_data', 'cache');
cache_clear_all('merci_content_type_info', 'cache');
}