You are here

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

1 string reference to 'merci_rro_add_new_override'
merci_rro_admin_page in modules/merci_rro/merci_rro.admin.inc
Menu callback; rule override administration.

File

modules/merci_rro/merci_rro.admin.inc, line 93
Admin section functions for MERCI Role Rule Override

Code

function merci_rro_add_new_override(&$form_state, $type_name, $exclude_roles) {
  $form = array();
  $roles = user_roles();
  foreach ($exclude_roles as $role) {
    unset($roles[$role]);
  }

  // foreach
  $form['merci_rro_type'] = array(
    '#type' => 'hidden',
    '#value' => $type_name,
  );
  $form['merci_rro_roles'] = array(
    '#type' => 'select',
    '#title' => t('Role'),
    '#options' => $roles,
    '#required' => TRUE,
    '#description' => t('Override settings will be applied to any users with this role.'),
  );
  $form['merci_rro_max_hours_per_reservation'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum hours per reservation'),
    '#size' => 10,
    '#default_value' => 0,
    '#element_validate' => array(
      'merci_is_numeric_validate',
    ),
    '#description' => t('The maximum hours the item can be reserved for in one reservation. Set to zero for no limit.') . $warning,
  );
  $form['merci_rro_allow_overnight'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow overnight reservation'),
    '#default_value' => 0,
    '#description' => t('Allow a reservation to continue over multiple days.') . $warning,
  );
  $form['merci_rro_allow_weekends'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow weekend reservation'),
    '#default_value' => 0,
    '#description' => t('Allow a reservation to be made over days defined as weekend.') . $warning,
  );
  $form['merci_rro_rate_per_hour'] = array(
    '#type' => 'textfield',
    '#title' => t('Rate per hour'),
    '#size' => 10,
    '#default_value' => 0,
    '#element_validate' => array(
      'merci_is_numeric_validate',
    ),
    '#description' => t('The per hour rental fee for the item.'),
  );
  $form['merci_rro_late_fee_per_hour'] = array(
    '#type' => 'textfield',
    '#title' => t('Late fee per hour'),
    '#size' => 10,
    '#default_value' => 0,
    '#element_validate' => array(
      'merci_is_numeric_validate',
    ),
    '#description' => t('The per hour fee for returning the item late.'),
  );
  $form['merci_rro_fee_free_hours'] = array(
    '#type' => 'textfield',
    '#title' => t('Fee free hours'),
    '#size' => 10,
    '#default_value' => 0,
    '#element_validate' => array(
      'merci_is_numeric_validate',
    ),
    '#description' => t('The number of hours the item can be used before fees are charged.'),
  );
  $form['merci_rro_min_cancel_hours'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum hours for cancelation without No Show'),
    '#size' => 10,
    '#default_value' => 0,
    '#element_validate' => array(
      'merci_is_numeric_validate',
    ),
    '#description' => t('Minimum number of hours a user can cancel a reservation for the item.'),
  );
  $hours_description = t('<div>Enter military time for both opening and closing time, separated by a dash, in the format <em>hh:mm-hh:mm</em></div>ex. <em>09:00-17:00</em> would be open at 9AM, close at 5PM. Leave blank to indicate not being open.');
  $form['merci_hours_mon'] = array(
    '#type' => 'textfield',
    '#title' => t('Monday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_mon', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_tue'] = array(
    '#type' => 'textfield',
    '#title' => t('Tuesday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_tue', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_wed'] = array(
    '#type' => 'textfield',
    '#title' => t('Wednesday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_wed', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_thu'] = array(
    '#type' => 'textfield',
    '#title' => t('Thursday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_thu', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_fri'] = array(
    '#type' => 'textfield',
    '#title' => t('Friday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_fri', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_sat'] = array(
    '#type' => 'textfield',
    '#title' => t('Saturday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_sat', ''),
    '#description' => $hours_description,
  );
  $form['merci_hours_sun'] = array(
    '#type' => 'textfield',
    '#title' => t('Sunday hours'),
    '#size' => 11,
    '#maxlength' => 11,
    '#default_value' => variable_get('merci_hours_sun', ''),
    '#description' => $hours_description,
  );
  $form['merci_rro_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  $form['#submit'] = array(
    'merci_rro_new_submit',
  );
  return $form;
}