function globallink_taxonomy_dashboard_form_validate in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink_taxonomy/globallink_taxonomy_send.inc \globallink_taxonomy_dashboard_form_validate()
- 7.6 globallink_taxonomy/globallink_taxonomy_send.inc \globallink_taxonomy_dashboard_form_validate()
Validates taxonomy form input.
File
- globallink_taxonomy/
globallink_taxonomy_send.inc, line 589
Code
function globallink_taxonomy_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;
}
$bids = array_filter($form_state['values']['table']);
if (count($bids) == 0) {
$bids = 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($bids) == 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 ($bids as $bid) {
$rows = globallink_taxonomy_get_sent_rows_by_bid($bid);
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');
}
}