You are here

function merci_hours_access in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

Implements access callback.

1 string reference to 'merci_hours_access'
merci_hours_entity_info in merci_hours/merci_hours.module
Implements hook_entity_info().

File

merci_hours/merci_hours.module, line 129

Code

function merci_hours_access($op, $entity = NULL, $account = NULL) {
  switch ($op) {

    //case 'view':

    //case 'update':

    //case 'create':

    //case 'edit':
    case 'delete':
      $default = variable_get('merci_hours_default', NULL);
      if (isset($entity) and $entity->name == $default) {
        drupal_set_message(t("This is the default merci hours and can't be deleted. Please change the default merci hours at <a href='!url'>admin/config/merci/merci-hours/settings</a> if you want to delete this one.", array(
          '!url' => url('admin/config/merci/merci-hours/settings'),
        )), 'error');
        return false;
      }
      break;
  }
  return user_access('administer all merci hours');
}