mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
First part of a large code cleanup commit.
This commit is contained in:
@@ -222,7 +222,7 @@ trait AccountServiceTrait
|
||||
/** @var AccountFactory $factory */
|
||||
$factory = app(AccountFactory::class);
|
||||
$factory->setUser($user);
|
||||
|
||||
|
||||
return $factory->findOrCreate($opposingAccountName, AccountType::INITIAL_BALANCE);
|
||||
}
|
||||
|
||||
|
@@ -23,10 +23,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Trait BillServiceTrait
|
||||
@@ -70,7 +72,11 @@ trait BillServiceTrait
|
||||
if ('' === $note) {
|
||||
$dbNote = $bill->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
$dbNote->delete(); // @codeCoverageIgnore
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::debug(sprintf('Error deleting note: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -55,7 +55,7 @@ trait JournalServiceTrait
|
||||
return; // @codeCoverageIgnore
|
||||
}
|
||||
foreach ($data['tags'] as $string) {
|
||||
if (\strlen($string) > 0) {
|
||||
if ('' != $string) {
|
||||
$tag = $factory->findOrCreate($string);
|
||||
if (null !== $tag) {
|
||||
$set[] = $tag->id;
|
||||
@@ -116,7 +116,7 @@ trait JournalServiceTrait
|
||||
protected function storeNote(TransactionJournal $journal, ?string $notes): void
|
||||
{
|
||||
$notes = (string)$notes;
|
||||
if (\strlen($notes) > 0) {
|
||||
if ('' !== $notes) {
|
||||
$note = $journal->notes()->first();
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
|
@@ -107,7 +107,7 @@ trait TransactionServiceTrait
|
||||
return $repository->findByName($accountName, [AccountType::ASSET]);
|
||||
}
|
||||
// for revenue and expense:
|
||||
if (\strlen($accountName) > 0) {
|
||||
if ('' !== $accountName) {
|
||||
/** @var AccountFactory $factory */
|
||||
$factory = app(AccountFactory::class);
|
||||
$factory->setUser($this->user);
|
||||
@@ -218,7 +218,7 @@ trait TransactionServiceTrait
|
||||
return;
|
||||
}
|
||||
// enable currency if not enabled:
|
||||
if(false === $currency->enabled) {
|
||||
if (false === $currency->enabled) {
|
||||
$currency->enabled = true;
|
||||
$currency->save();
|
||||
}
|
||||
|
Reference in New Issue
Block a user