function merci_admin_validate_hours_of_operation in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2
Same name and namespace in other branches
- 7.2 includes/merci.admin.inc \merci_admin_validate_hours_of_operation()
1 string reference to 'merci_admin_validate_hours_of_operation'
- merci_admin_settings in includes/
merci.admin.inc - Builds the MERCI admininstration settings form.
File
- includes/
merci.admin.inc, line 231 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_admin_validate_hours_of_operation($element, &$form_state) {
if (!empty($element['#value'])) {
$values = explode('-', $element['#value']);
foreach ($values as $value) {
list($hour, $min) = explode(':', $value);
if ($hour > 23) {
form_error($element, t('Hour must be less than or equal to 23.'));
}
if ($hour < 0) {
form_error($element, t('Hour must be greater than or equal to 0.'));
}
if ($min > 59) {
form_error($element, t('Minutes must be less than or equal to 59.'));
}
if ($min < 0) {
form_error($element, t('Minutes must be greater than or equal to 0.'));
}
}
if ($values[1] < $values[0]) {
form_error($element, t('Closing time must be greater then opening time.'));
}
}
}