Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
New test content.
James Coleb741565f578d
diff --git a/app/database/migrations/2014_12_13_190730_changes_for_v321.php b/app/database/migrations/2014_12_13_190730_changes_for_v321.phpindex cfb1e6839a..6b28be56cb 100644--- a/app/database/migrations/2014_12_13_190730_changes_for_v321.php+++ b/app/database/migrations/2014_12_13_190730_changes_for_v321.php@@ -75,22 +75,6 @@ class ChangesForV321 extends Migration}- public function createComponentId() {- Schema::table(- 'budget_limits', function (Blueprint $table) {- $table->integer('component_id')->unsigned();- }- );- }-- public function createComponentIdForeignKey() {- Schema::table(- 'budget_limits', function (Blueprint $table) {- $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade');- }- );- }-public function moveBudgetsBack(){Budget::get()->each(@@ -121,6 +105,15 @@ class ChangesForV321 extends Migration);}+ public function createComponentId()+ {+ Schema::table(+ 'budget_limits', function (Blueprint $table) {+ $table->integer('component_id')->unsigned();+ }+ );+ }+public function updateComponentInBudgetLimits(){BudgetLimit::get()->each(@@ -138,6 +131,15 @@ class ChangesForV321 extends Migration);}+ public function createComponentIdForeignKey()+ {+ Schema::table(+ 'budget_limits', function (Blueprint $table) {+ $table->foreign('component_id','limits_component_id_foreign')->references('id')->on('components')->onDelete('cascade');+ }+ );+ }+public function dropBudgetIdColumnInBudgetLimits(){Schema::table(@@ -411,18 +413,28 @@ class ChangesForV321 extends Migrationpublic function moveComponentIdToBudgetId(){+ \Log::debug('Now in moveComponentIdToBudgetId()');BudgetLimit::get()->each(function (BudgetLimit $bl) {+ \Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id);$component = Component::find($bl->component_id);if ($component) {+ \Log::debug('Found component with id #' . $component->id . ' and name ' . $component->name);$budget = Budget::whereName($component->name)->whereUserId($component->user_id)->first();if ($budget) {+ \Log::debug('Found a budget with ID #' . $budget->id . ' and name ' . $budget->name);$bl->budget_id = $budget->id;$bl->save();+ \Log::debug('Connected budgetLimit #' . $bl->id . ' to budget_id' . $budget->id);+ } else {+ \Log::debug('Could not find a matching budget with name ' . $component->name);}+ } else {+ \Log::debug('Could not find a component with id ' . $bl->component_id);}});+ \Log::debug('Done with moveComponentIdToBudgetId()');}diff --git a/app/database/seeds/TestContentSeeder.php b/app/database/seeds/TestContentSeeder.phpindex ce0f3fa21a..dabac9f474 100644--- a/app/database/seeds/TestContentSeeder.php+++ b/app/database/seeds/TestContentSeeder.php@@ -96,8 +96,8 @@ class TestContentSeeder extends Seeder'order' => 0,]);- $piggyBankEvent = PiggyBankEvent::create(['piggybank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);- $piggyBankRepetition = PiggybankRepetition::create(+ PiggyBankEvent::create(['piggybank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);+ PiggybankRepetition::create(['piggybank_id' => $piggy->id,'startdate' => Carbon::now()->format('Y-m-d'),@@ -106,6 +106,35 @@ class TestContentSeeder extends Seeder]);+ // piggy bank+ $piggyTargeted = Piggybank::create(+ [+ 'account_id' => $savings->id,+ 'name' => 'New clothes',+ 'targetamount' => 2000,+ 'startdate' => Carbon::now()->format('Y-m-d'),+ 'targetdate' => Carbon::now()->addMonths(4)->format('Y-m-d'),+ 'repeats' => 0,+ 'rep_length' => null,+ 'rep_every' => 0,+ 'rep_times' => null,+ 'reminder' => null,+ 'reminder_skip' => 0,+ 'remind_me' => 0,+ 'order' => 0,+ ]+ );++ PiggyBankEvent::create(['piggybank_id' => $piggyTargeted->id, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);+ PiggybankRepetition::create(+ [+ 'piggybank_id' => $piggyTargeted->id,+ 'startdate' => Carbon::now()->format('Y-m-d'),+ 'targetdate' => Carbon::now()->addMonths(4)->format('Y-m-d'),+ 'currentamount' => 0+ ]+ );+// recurring transaction$recurring = \RecurringTransaction::create([diff --git a/app/lib/FireflyIII/Database/Budget/Budget.php b/app/lib/FireflyIII/Database/Budget/Budget.phpindex 7ef23b1c77..ad5f8f8ab1 100644--- a/app/lib/FireflyIII/Database/Budget/Budget.php+++ b/app/lib/FireflyIII/Database/Budget/Budget.php@@ -334,7 +334,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface$limit->repeat_freq = 'monthly';$limit->repeats = 0;$result = $limit->save();- \Log::info('Created new limit? ' . boolval($result));+ \Log::info('Created new limit? ' . boolstr($result));\Log::info('ID: ' . $limit->id);/** A newly stored limit also created a limit repetition.diff --git a/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php b/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.phpindex 80f139323a..44d4a6adf9 100644--- a/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php+++ b/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php@@ -262,7 +262,9 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface*/public function leftOnAccount(\Account $account){+ \Log::debug('Now in leftOnAccount() for account #'.$account->id.' ('.$account->name.')');$balance = \Steam::balance($account);+ \Log::debug('Steam says: ' . $balance);/** @var \Piggybank $p */foreach ($account->piggybanks()->get() as $p) {$balance -= $p->currentRelevantRep()->currentamount;diff --git a/app/lib/FireflyIII/Shared/Toolkit/Steam.php b/app/lib/FireflyIII/Shared/Toolkit/Steam.phpindex 066ee7ff2d..03d0238e57 100644--- a/app/lib/FireflyIII/Shared/Toolkit/Steam.php+++ b/app/lib/FireflyIII/Shared/Toolkit/Steam.php@@ -23,6 +23,7 @@ class Steam*/public function balance(\Account $account, Carbon $date = null){+ \Log::debug('Now in Steam::balance() for account #' . $account->id.' ('.$account->name.')');if (is_null($date)) {$key = 'account.' . $account->id . '.latestBalance';} else {@@ -33,6 +34,7 @@ class Steam#return \Cache::get($key);}$date = is_null($date) ? Carbon::now() : $date;+ \Log::debug('Now reached the moment we fire the query.');$balance = floatval($account->transactions()->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'diff --git a/app/models/Piggybank.php b/app/models/Piggybank.phpindex 51998e3b0e..cb5d420795 100644--- a/app/models/Piggybank.php+++ b/app/models/Piggybank.php@@ -1,7 +1,8 @@<?phpuse Carbon\Carbon;+use Illuminate\Database\Eloquent\Model as Eloquent;use Watson\Validating\ValidatingTrait;-use \Illuminate\Database\Eloquent\Model as Eloquent;+/*** Class Piggybank*/@@ -90,6 +91,7 @@ class Piggybank extends Eloquentif ($this->repeats == 0) {$rep = $this->piggybankrepetitions()->first(['piggybank_repetitions.*']);$this->currentRep = $rep;+ \Log::debug('currentRelevantRep() reports $rep is null: ' . boolstr(is_null($rep)));return $rep;} else {