diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 4c03129599..a6492f7b59 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -65,12 +65,6 @@ class AccountController extends BaseController /** @var \FireflyIII\Database\Account $acct */ $acct = App::make('FireflyIII\Database\Account'); - // find the initial balance account (the only other account that should be deleted) - // find all journals for both accounts (or just the one) and delete them. - // the rest will take care of itself. - // in the least amount of queries possible. - - // and it can be done in ONE query! or maybe two. $acct->destroy($account); $return = 'asset'; diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index f6db1ae8d6..c4e0c18640 100644 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -21,7 +21,7 @@ class HomeController extends BaseController /** @var TransactionJournal $journal */ foreach ($journals as $journal) { - if ($journal->TransactionType->type == 'Withdrawal') { + if ($journal->transactionType->type == 'Withdrawal') { echo '#' . $journal->id . ': ' . e($journal->description); /** @var Transaction $transaction */ foreach ($journal->transactions as $transaction) { diff --git a/app/controllers/ReminderController.php b/app/controllers/ReminderController.php index 15f226954d..5a50c48f94 100644 --- a/app/controllers/ReminderController.php +++ b/app/controllers/ReminderController.php @@ -14,6 +14,49 @@ class ReminderController extends BaseController View::share('mainTitleIcon', 'fa-lightbulb-o'); } + public function act(Reminder $reminder) + { + + switch (get_class($reminder->remindersable)) { + default: + throw new FireflyException('Cannot act on reminder for ' . get_class($reminder->remindersable)); + break; + break; + case 'Piggybank': + $amount = Reminders::amountForReminder($reminder); + $prefilled = [ + 'amount' => round($amount, 2), + 'description' => 'Money for ' . $reminder->remindersable->name, + 'piggybank_id' => $reminder->remindersable_id, + 'account_to_id' => $reminder->remindersable->account_id + ]; + Session::flash('prefilled', $prefilled); + + return Redirect::route('transactions.create', 'transfer'); + break; + + } + } + + public function dismiss(Reminder $reminder) + { + $reminder->active = 0; + $reminder->save(); + Session::flash('success', 'Reminder dismissed'); + + return Redirect::route('index'); + } + + public function notnow(Reminder $reminder) + { + $reminder->active = 0; + $reminder->notnow = 1; + $reminder->save(); + Session::flash('success', 'Reminder dismissed'); + + return Redirect::route('index'); + } + /** * @param Reminder $reminder */ @@ -29,40 +72,4 @@ class ReminderController extends BaseController return View::make('reminders.show', compact('reminder', 'amount')); } - public function act(Reminder $reminder) { - - switch(get_class($reminder->remindersable)) { - default: - throw new FireflyException('Cannot act on reminder for ' . get_class($reminder->remindersable)); - break; - break; - case 'Piggybank': - $amount = Reminders::amountForReminder($reminder); - $prefilled = [ - 'amount' => round($amount,2), - 'description' => 'Money for ' . $reminder->remindersable->name, - 'piggybank_id' => $reminder->remindersable_id, - 'account_to_id' => $reminder->remindersable->account_id - ]; - Session::flash('prefilled',$prefilled); - return Redirect::route('transactions.create','transfer'); - break; - - } - } - - public function dismiss(Reminder $reminder) { - $reminder->active = 0; - $reminder->save(); - Session::flash('success','Reminder dismissed'); - return Redirect::route('index'); - } - public function notnow(Reminder $reminder) { - $reminder->active = 0; - $reminder->notnow = 1; - $reminder->save(); - Session::flash('success','Reminder dismissed'); - return Redirect::route('index'); - } - } \ No newline at end of file diff --git a/app/controllers/RepeatedExpenseController.php b/app/controllers/RepeatedExpenseController.php index 9284cc43a7..45cbfc7408 100644 --- a/app/controllers/RepeatedExpenseController.php +++ b/app/controllers/RepeatedExpenseController.php @@ -60,7 +60,7 @@ class RepeatedExpenseController extends BaseController } ); - return View::make('repeatedexpense.show', compact('repetitions','piggyBank', 'today', 'subTitle')); + return View::make('repeatedexpense.show', compact('repetitions', 'piggyBank', 'today', 'subTitle')); } /** diff --git a/app/controllers/ReportController.php b/app/controllers/ReportController.php index 83b6dd83d6..ae92d2394e 100644 --- a/app/controllers/ReportController.php +++ b/app/controllers/ReportController.php @@ -180,7 +180,10 @@ class ReportController extends BaseController return $journal; } } + + return null; } + ); /* * Filter deposits. @@ -193,6 +196,8 @@ class ReportController extends BaseController return $journal; } } + + return null; } ); @@ -221,7 +226,7 @@ class ReportController extends BaseController */ public function year($year) { - Config::set('app.debug',false); + Config::set('app.debug', false); try { $date = new Carbon('01-01-' . $year); } catch (Exception $e) { @@ -276,9 +281,9 @@ class ReportController extends BaseController } $summary[] = [ - 'month' => $month, - 'income' => $income, - 'expense' => $expense, + 'month' => $month, + 'income' => $income, + 'expense' => $expense, 'incomeShared' => $incomeShared, 'expenseShared' => $expenseShared, ]; diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 01066c79ee..a5b8bcc4cb 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -140,18 +140,19 @@ class TransactionController extends BaseController $repository = App::make('FireflyIII\Database\TransactionJournal'); $repository->destroy($transactionJournal); + $return = 'withdrawal'; + switch ($type) { - case 'Withdrawal': - return Redirect::route('transactions.index', 'withdrawal'); - break; case 'Deposit': - return Redirect::route('transactions.index', 'deposit'); + $return = 'deposit'; break; case 'Transfer': - return Redirect::route('transactions.index', 'transfers'); + $return = 'transfers'; break; } + + return Redirect::route('transactions.index', $return); } // TODO this needs cleaning up and thinking over. @@ -506,6 +507,7 @@ class TransactionController extends BaseController $group->delete(); } } + return Response::json(true); }