function globallink_menu_dashboard_form_validate in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_menu/globallink_menu_send.inc \globallink_menu_dashboard_form_validate()
- 7.5 globallink_menu/globallink_menu_send.inc \globallink_menu_dashboard_form_validate()
Validates menu form input.
File
- globallink_menu/
globallink_menu_send.inc, line 609
Code
function globallink_menu_dashboard_form_validate($form, &$form_state) {
module_load_include('inc', 'globallink', 'globallink_settings');
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
$pd4 = globallink_get_project_director_details();
globallink_validate_project_director_details($pd4);
$source_locale = $form_state['values']['submission_source_locale'];
$target_locale_arr = $form_state['values']['submission_target_locale'];
if ($op != t('Send for Translation')) {
return;
}
$mids = array_filter($form_state['values']['table']);
if (count($mids) == 0) {
$mids = array_filter($form_state['values']['table']);
form_set_error('', t('No items selected.'));
}
if (!empty($form_state['values']['submission_due_date'])) {
$due_date = globallink_convert_date_to_timestamp($form_state['values']['submission_due_date']) / 1000;
if ($due_date < REQUEST_TIME) {
form_set_error('', t('The specified date is in past.'));
}
}
if (count($mids) == 0) {
return;
}
if (!isset($source_locale) || !isset($target_locale_arr)) {
return;
}
foreach ($target_locale_arr as $key => $target) {
if ($target == FALSE) {
unset($target_locale_arr[$key]);
}
}
$message = FALSE;
if (count($target_locale_arr) == 0) {
return;
}
foreach ($mids as $mlid) {
$rows = globallink_menu_get_sent_rows_by_mlid($mlid);
foreach ($rows as $row) {
if ($row->source == $source_locale && array_search($row->target, $target_locale_arr)) {
$message = TRUE;
}
}
}
if ($message) {
drupal_set_message(t('Ignored record(s) that has already been sent out for translation.'), 'warning');
}
}