Fix notes in link types.

This commit is contained in:
James Cole
2018-01-17 10:40:44 +01:00
parent 70da38193f
commit 80f96abf08
4 changed files with 43 additions and 21 deletions

View File

@@ -24,6 +24,7 @@ namespace FireflyIII\Repositories\LinkType;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\LinkType;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\User;
@@ -188,10 +189,22 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
$link->source()->associate($right);
$link->destination()->associate($left);
}
$link->comment = $link['comments'] ?? null;
$link->save();
// make note in noteable:
if (strlen($information['notes']) > 0) {
$dbNote = $link->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($link);
}
$dbNote->text = trim($information['notes']);
$dbNote->save();
}
//$link->comment = $link['notes'] ?? null;
return $link;
}