function gdpr_task_edit_gdpr_sar_form_validate in General Data Protection Regulation 7
Validate handler for export tasks.
File
- modules/
gdpr_tasks/ gdpr_tasks.admin.inc, line 202 - Administrative page and form callbacks for the GDPR Tasks module.
Code
function gdpr_task_edit_gdpr_sar_form_validate($form, &$form_state) {
gdpr_task_form_validate($form, $form_state);
// Make sure there are no two files with the same filename.
if (!empty($form_state['values']['gdpr_tasks_sar_export_parts'])) {
$files = array();
// Check for filename duplicates.
foreach ($form_state['values']['gdpr_tasks_sar_export_parts'][LANGUAGE_NONE] as $data) {
if ($data['fid']) {
$file = file_load($data['fid']);
if (!isset($files[$file->filename])) {
$files[$file->filename] = $file->filename;
}
else {
form_set_error('gdpr_tasks_sar_export_parts', t('Please remove the old file when replacing with a new one.'));
}
}
}
}
}