Only display errors in import table if things actually prevent the asset from being created. Also some table formatting improvements.

This commit is contained in:
Daniel Meltzer 2016-05-31 18:04:01 -05:00
parent 0e0b31bba6
commit dab2a50982
2 changed files with 11 additions and 14 deletions

View file

@ -286,7 +286,7 @@ class ObjectImportCommand extends Command {
/** /**
* Finds a category with the same name and item type in the database, otherwise creates it * Finds a category with the same name and item type in the database, otherwise creates it
* @param $asset_category string * @param $asset_category string
* @param $item_type string * @param $item_type stringI
* @return Category * @return Category
*/ */
public function createOrFetchCategory($asset_category, $item_type) public function createOrFetchCategory($asset_category, $item_type)
@ -348,7 +348,7 @@ class ObjectImportCommand extends Command {
$this->log('Company ' . $asset_company_name . ' was created'); $this->log('Company ' . $asset_company_name . ' was created');
return $company; return $company;
} else { } else {
$this->jsonError('Company', $company->getErrors()); $this->log('Company', $company->getErrors());
} }
} else { } else {
$this->companies->add($company); $this->companies->add($company);
@ -470,7 +470,7 @@ class ObjectImportCommand extends Command {
$this->log('Location ' . $asset_location . ' was created'); $this->log('Location ' . $asset_location . ' was created');
return $location; return $location;
} else { } else {
$this->jsonError('Location', $location->getErrors()) ; $this->log('Location', $location->getErrors()) ;
return $location; return $location;
} }
} else { } else {
@ -512,7 +512,7 @@ class ObjectImportCommand extends Command {
$this->log('Supplier ' . $supplier_name . ' was created'); $this->log('Supplier ' . $supplier_name . ' was created');
return $supplier; return $supplier;
} else { } else {
$this->jsonError('Supplier', $supplier->getErrors()); $this->log('Supplier', $supplier->getErrors());
return $supplier; return $supplier;
} }
} else { } else {

View file

@ -73,24 +73,21 @@
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>Warning</strong> {{trans('admin/hardware/message.import.errorDetail')}} <strong>Warning</strong> {{trans('admin/hardware/message.import.errorDetail')}}
</div> </div>
<table class="table table-striped" id="errors-table"> <table class="table table-striped table-bordered" id="errors-table">
<thead> <thead>
<th>Asset</th> <th>Asset</th>
<th colspan="1">Field</th> <th>Errors</th>
<th colspan ="1">Parameter</th>
<th colspan ="1">Errors</th>
</thead> </thead>
<tbody> <tbody>
@foreach (session('import_errors') as $asset => $error) @foreach (session('import_errors') as $asset => $error)
<tr> <tr>
<td> {{ $asset }}</td> <td> {{ $asset }}</td>
@foreach ($error as $field => $values ) @foreach ($error as $field => $values )
<td> {{ $field }} </td> <td> <span><b>{{ $field }}:</b>
@foreach( $values as $fieldName=>$errorString) @foreach( $values as $errorString)
<td>{{$fieldName}}</td> <span>{{$errorString[0]}} </span>
<td>{{$errorString[0]}}</td> @endforeach
@endforeach </td>
@endforeach @endforeach
</tr> </tr>
@endforeach @endforeach