Fix bug in bill name import routine

This commit is contained in:
James Cole 2016-04-17 20:40:26 +02:00
parent 0c0cc417ee
commit d02df46517
3 changed files with 11 additions and 4 deletions

View File

@ -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]);

View File

@ -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

View File

@ -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;
}