You are here

function merci_rro_merci_rules_alter in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Implementation of hook_merci_rules_alter().

File

modules/merci_rro/merci_rro.module, line 151
Hooks and utility functions for MERCI Role Rule Override

Code

function merci_rro_merci_rules_alter(&$rules) {
  $overrides = merci_rro_content_type_overrides($rules->type);
  $rule_types = array(
    'max_hours_per_reservation',
    'allow_overnight',
    'allow_weekends',
    'rate_per_hour',
    'late_fee_per_hour',
    'fee_free_hours',
    'min_cancel_hours',
    'hours_mon',
    'hours_tue',
    'hours_wed',
    'hours_thu',
    'hours_fri',
    'hours_sat',
    'hours_sun',
  );

  // Get best value for every rule type in every override
  foreach ($overrides as $override) {
    foreach ($rule_types as $rule_type) {
      $rules->{$rule_type} = merci_rro_determine_best_value($rule_type, $rules->{$rule_type}, $override->{$rule_type});
    }

    // foreach
  }

  // foreach
}