This commit is contained in:
James Cole
2017-07-10 19:52:31 +02:00
parent 780bec35bb
commit 9b6ccdd43a
6 changed files with 61 additions and 10 deletions

View File

@@ -181,11 +181,17 @@ class ImportBudget
Log::debug('Finding a mapped budget based on', $array);
$search = intval($array['mapped']);
$account = $this->repository->find($search);
$budget = $this->repository->find($search);
Log::debug(sprintf('Found budget! #%d ("%s"). Return it', $account->id, $account->name));
if (is_null($budget->id)) {
Log::error(sprintf('There is no budget with id #%d. Invalid mapping will be ignored!', $search));
return $account;
return new Budget;
}
Log::debug(sprintf('Found budget! #%d ("%s"). Return it', $budget->id, $budget->name));
return $budget;
}
/**