You are here

function merci_update_7001 in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2

File

./merci.install, line 675
merci Installer / Uninstaller

Code

function merci_update_7001() {
  $days_of_the_week = array(
    'sun',
    'mon',
    'tue',
    'wed',
    'thu',
    'fri',
    'sat',
  );
  $hours_of_operation = array();
  foreach ($days_of_the_week as $num => $day) {
    $hours = variable_get('merci_hours_' . $day, '');
    if (empty($hours)) {
      $hours_of_operation[$num] = FALSE;
    }
    else {
      list($open, $close) = explode('-', $hours);
      $hours_of_operation[$num]['open'] = trim($open);
      $hours_of_operation[$num]['close'] = trim($close);
    }
  }
  $closed_days_raw = variable_get('merci_closed_dates', '');
  $hours_of_operation['closed_days'] = array();
  $parts = explode("\n", $closed_days_raw);
  foreach ($parts as $date) {
    $date = trim($date);
    if (drupal_strlen($date) == 5) {
      $hours_of_operation['closed_days'][] = $date;
    }
  }
  variable_set('merci_hours_operation', $hours_of_operation);
  return array(
    array(
      'success' => TRUE,
      'query' => 'Should only be doing db updates.  But I am doing a lot more.',
    ),
  );
}