From e86547645c096590fc493f89dc3dabe5ce3a7167 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2014 07:33:59 +0100 Subject: [PATCH] Small bug fixes. --- app/lib/FireflyIII/Database/Account/Account.php | 6 ++++-- app/lib/FireflyIII/Shared/Toolkit/Steam.php | 3 +-- app/models/BudgetLimit.php | 2 +- tests/_data/dump.sql | 0 4 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 tests/_data/dump.sql diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.php index e75ca92b56..efab9beab7 100644 --- a/app/lib/FireflyIII/Database/Account/Account.php +++ b/app/lib/FireflyIII/Database/Account/Account.php @@ -13,7 +13,7 @@ use Illuminate\Support\MessageBag; /** * Class Account * - * @package FireflyIII\Database + * @package FireflyIII\Database * @implements FireflyIII\Database\Account\AccountInterface */ class Account implements CUD, CommonDatabaseCalls, AccountInterface @@ -260,7 +260,9 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface $journal->delete(); } // also delete transactions. - \Transaction::whereIn('id', $transactions)->delete(); + if (count($transactions) > 0) { + \Transaction::whereIn('id', $transactions)->delete(); + } /* diff --git a/app/lib/FireflyIII/Shared/Toolkit/Steam.php b/app/lib/FireflyIII/Shared/Toolkit/Steam.php index e47ff266d9..066ee7ff2d 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Steam.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Steam.php @@ -63,8 +63,7 @@ class Steam { $user = \Auth::user(); if ($user) { - \BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')->where('budgets.user_id', $user->id) - ->where('budget_limits.amount', 0)->delete(); + \BudgetLimit::where('amount', 0)->delete(); } } diff --git a/app/models/BudgetLimit.php b/app/models/BudgetLimit.php index 2f260410e6..75e1e55e23 100644 --- a/app/models/BudgetLimit.php +++ b/app/models/BudgetLimit.php @@ -27,7 +27,7 @@ class BudgetLimit extends Eloquent */ public function budget() { - return $this->belongsTo('Budget', 'budget_id'); + return $this->belongsTo('Budget','budget_id'); } /** diff --git a/tests/_data/dump.sql b/tests/_data/dump.sql deleted file mode 100644 index e69de29bb2..0000000000