mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
* 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:
parent
26c0cf5d33
commit
bebdbdfb87
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -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.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -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.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -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.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue