mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed some small issues in import routine.
This commit is contained in:
@@ -171,7 +171,7 @@ class ImportBudget
|
||||
Log::debug(sprintf('Find mapped budget based on field "%s" with value', $field), $array);
|
||||
// check if a pre-mapped object exists.
|
||||
$mapped = $this->getMappedObject($array);
|
||||
if (null !== $mapped->id) {
|
||||
if (null !== $mapped) {
|
||||
Log::debug(sprintf('Found budget #%d!', $mapped->id));
|
||||
|
||||
return $mapped;
|
||||
|
||||
@@ -192,7 +192,7 @@ class ImportCategory
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
private function getMappedObject(array $array): Category
|
||||
private function getMappedObject(array $array): ?Category
|
||||
{
|
||||
Log::debug('In getMappedObject() for Category');
|
||||
if (0 === count($array)) {
|
||||
|
||||
@@ -386,7 +386,7 @@ trait ImportSupport
|
||||
*/
|
||||
private function storeBill(TransactionJournal $journal, Bill $bill)
|
||||
{
|
||||
if (null !== $bill->id) {
|
||||
if (null !== $bill) {
|
||||
Log::debug(sprintf('Linked bill #%d to journal #%d', $bill->id, $journal->id));
|
||||
$journal->bill()->associate($bill);
|
||||
$journal->save();
|
||||
@@ -399,7 +399,7 @@ trait ImportSupport
|
||||
*/
|
||||
private function storeBudget(TransactionJournal $journal, Budget $budget)
|
||||
{
|
||||
if (null !== $budget->id) {
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Linked budget #%d to journal #%d', $budget->id, $journal->id));
|
||||
$journal->budgets()->save($budget);
|
||||
}
|
||||
@@ -411,7 +411,7 @@ trait ImportSupport
|
||||
*/
|
||||
private function storeCategory(TransactionJournal $journal, Category $category)
|
||||
{
|
||||
if (null !== $category->id) {
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Linked category #%d to journal #%d', $category->id, $journal->id));
|
||||
$journal->categories()->save($category);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user