Only try to return a department if there is a matching field

This commit is contained in:
snipe 2018-10-19 01:44:45 -07:00
parent 304fce73fc
commit 09a102fea8

View file

@ -302,6 +302,7 @@ class ItemImporter extends Importer
*/ */
public function createOrFetchDepartment($user_department_name) public function createOrFetchDepartment($user_department_name)
{ {
if ($user_department_name!='') {
$department = Department::where('name', '=', $user_department_name)->first(); $department = Department::where('name', '=', $user_department_name)->first();
if ($department) { if ($department) {
@ -317,6 +318,8 @@ class ItemImporter extends Importer
return $department->id; return $department->id;
} }
$this->logError($department, 'Department'); $this->logError($department, 'Department');
}
return null; return null;
} }