Skip to content

Firefly III: a personal finances manager

Fix bug in bill name import routine

James Coled02df4651786
diff --git a/app/Helpers/Csv/Converter/BillName.php b/app/Helpers/Csv/Converter/BillName.php
index 043bf770f7..fc462a952a 100644
--- a/app/Helpers/Csv/Converter/BillName.php
+++ b/app/Helpers/Csv/Converter/BillName.php
@@ -21,7 +21,7 @@ class BillName extends BasicConverter implements ConverterInterface
/** @var BillRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
- $bill = null;
+ $bill = new Bill;
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$bill = $repository->find($this->mapped[$this->index][$this->value]);
diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php
index 90aadc3a0e..2066f3bd8a 100644
--- a/app/Helpers/Csv/Importer.php
+++ b/app/Helpers/Csv/Importer.php
@@ -147,8 +147,15 @@ class Importer
$transactionType = $this->getTransactionType(); // defaults to deposit
$errors = new MessageBag;
$journal = TransactionJournal::create(
- ['user_id' => Auth::user()->id, 'transaction_type_id' => $transactionType->id, 'transaction_currency_id' => $this->importData['currency']->id,
- 'description' => $this->importData['description'], 'completed' => 0, 'date' => $date, 'bill_id' => $this->importData['bill-id'],]
+ [
+ 'user_id' => Auth::user()->id,
+ 'transaction_type_id' => $transactionType->id,
+ 'transaction_currency_id' => $this->importData['currency']->id,
+ 'description' => $this->importData['description'],
+ 'completed' => 0,
+ 'date' => $date,
+ 'bill_id' => $this->importData['bill-id'],
+ ]
);
if ($journal->getErrors()->count() == 0) {
// first transaction
diff --git a/app/Helpers/Csv/PostProcessing/Bill.php b/app/Helpers/Csv/PostProcessing/Bill.php
index 9369fc26ad..5bae80b862 100644
--- a/app/Helpers/Csv/PostProcessing/Bill.php
+++ b/app/Helpers/Csv/PostProcessing/Bill.php
@@ -20,7 +20,7 @@ class Bill implements PostProcessorInterface
{
// get bill id.
- if (!is_null($this->data['bill'])) {
+ if (!is_null($this->data['bill']->id)) {
$this->data['bill-id'] = $this->data['bill']->id;
}