Fix #6763. Import Stuck Processing - Error - Can only flip STRING and INTEGER values! (#6804)

* Added validation for errors when the Import Field to map isn't setted

* A slightly correction to the error message

* Added the translation strings for the Error Message
This commit is contained in:
Ivan Nieto 2019-03-14 13:32:40 -06:00 committed by snipe
parent 26c0cf5d33
commit bebdbdfb87
6 changed files with 16 additions and 1 deletions

View file

@ -42,7 +42,18 @@ class ItemImportRequest extends FormRequest
$import->field_map = request('column-mappings');
$import->save();
$fieldMappings=[];
if ($import->field_map) {
foreach ($import->field_map as $field => $fieldValue) {
$errorMessage = null;
if(is_null($fieldValue)){
$errorMessage = trans('validation.import_field_empty');
$this->errorCallback($import, $field, $errorMessage);
return $this->errors;
}
}
// We submit as csv field: column, but the importer is happier if we flip it here.
$fieldMappings = array_change_key_case(array_flip($import->field_map), CASE_LOWER);
// dd($fieldMappings);

View file

@ -90,7 +90,7 @@ return array(
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
"unique_undeleted" => "The :attribute must be unique.",
"import_field_empty" => "The value of the Import Field shouldn't be empty",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines

View file

@ -89,6 +89,7 @@ return array(
'uploaded' => 'El atributo: no se pudo cargar.',
'url' => ':attribute formato incorrecto.',
"unique_undeleted" => "El :atrribute debe ser único.",
"import_field_empty" => "El valor del Import Field no puede estar vacío.",
/*
|--------------------------------------------------------------------------

View file

@ -89,6 +89,7 @@ return array(
'uploaded' => 'El atributo: no se pudo cargar.',
'url' => ':attribute formato incorrecto.',
"unique_undeleted" => "El :atrribute debe ser único.",
"import_field_empty" => "El valor del Import Field no puede estar vacío.",
/*
|--------------------------------------------------------------------------

View file

@ -89,6 +89,7 @@ return array(
'uploaded' => 'El atributo: no se pudo cargar.',
'url' => ':attribute formato incorrecto.',
"unique_undeleted" => "El :atrribute debe ser único.",
"import_field_empty" => "El valor del Import Field no puede estar vacío.",
/*
|--------------------------------------------------------------------------

View file

@ -89,6 +89,7 @@ return array(
'uploaded' => 'El :attribute fallo al cargar.',
'url' => 'El formato :attribute es inválido.',
"unique_undeleted" => "El :atrribute debe ser único.",
"import_field_empty" => "El valor del Import Field no puede estar vacío.",
/*
|--------------------------------------------------------------------------