Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Small optimisations.
James Cole2947ec00024f
diff --git a/app/Console/Commands/EncryptFile.php b/app/Console/Commands/EncryptFile.phpindex 25ebf9cf10..1039c8ec80 100644--- a/app/Console/Commands/EncryptFile.php+++ b/app/Console/Commands/EncryptFile.php@@ -51,7 +51,7 @@ class EncryptFile extends Command*/public function handle(){- $file = e($this->argument('file'));+ $file = e(strval($this->argument('file')));if (!file_exists($file)) {$this->error(sprintf('File "%s" does not seem to exist.', $file));@@ -59,7 +59,7 @@ class EncryptFile extends Command}$content = file_get_contents($file);$content = Crypt::encrypt($content);- $newName = $this->argument('key') . '.upload';+ $newName = e($this->argument('key')) . '.upload';$path = storage_path('upload') . '/' . $newName;file_put_contents($path, $content);diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.phpindex bf1d796aa6..2d10dc6c1f 100644--- a/app/Http/Controllers/ImportController.php+++ b/app/Http/Controllers/ImportController.php@@ -168,7 +168,7 @@ class ImportController extends Controller// return redirect to settings.// this could loop until the user is done.- return redirect(route('import.settings', $job->key));+ return redirect(route('import.settings', [$job->key]));}/**@@ -345,17 +345,14 @@ class ImportController extends ControllerLog::debug('Will redirect to configure()');return redirect(route('import.configure', [$job->key]));- break;case 'import_configuration_saved':Log::debug('Will redirect to settings()');return redirect(route('import.settings', [$job->key]));- break;case 'settings_complete':Log::debug('Will redirect to complete()');return redirect(route('import.complete', [$job->key]));- break;}throw new FireflyException('Cannot redirect for job state ' . $job->status);diff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.phpindex fb89335598..003bc03d2f 100644--- a/database/migrations/2016_06_16_000002_create_main_tables.php+++ b/database/migrations/2016_06_16_000002_create_main_tables.php@@ -290,6 +290,103 @@ class CreateMainTables extends Migration}+ private function createJournalTables()+ {+ if (!Schema::hasTable('transaction_journals')) {+ Schema::create(+ 'transaction_journals', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();++ $table->integer('user_id', false, true);+ $table->integer('transaction_type_id', false, true);+ $table->integer('bill_id', false, true)->nullable();+ $table->integer('transaction_currency_id', false, true);++ $table->string('description', 1024);++ $table->date('date');+ $table->date('interest_date')->nullable();+ $table->date('book_date')->nullable();+ $table->date('process_date')->nullable();++ $table->integer('order', false, true);+ $table->integer('tag_count', false, true);++ $table->boolean('encrypted')->default(1);+ $table->boolean('completed')->default(1);++ // links to other tables:+ $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');+ $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');+ $table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null');+ $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');+ }+ );+ }++ if (!Schema::hasTable('journal_meta')) {+ Schema::create(+ 'journal_meta', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->integer('transaction_journal_id', false, true);+ $table->string('name', 255);+ $table->text('data');+ $table->string('hash', 64);++ $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');+ }+ );+ }+ }++ private function createMoreJournalTables()+ {+ if (!Schema::hasTable('tag_transaction_journal')) {+ Schema::create(+ 'tag_transaction_journal', function (Blueprint $table) {+ $table->increments('id');+ $table->integer('tag_id', false, true);+ $table->integer('transaction_journal_id', false, true);++ $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');+ $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');+++ }+ );+ }++ if (!Schema::hasTable('budget_transaction_journal')) {+ Schema::create(+ 'budget_transaction_journal', function (Blueprint $table) {+ $table->increments('id');+ $table->integer('budget_id', false, true);+ $table->integer('transaction_journal_id', false, true);++ $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');+ $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');+ }+ );+ }++ if (!Schema::hasTable('category_transaction_journal')) {+ Schema::create(+ 'category_transaction_journal', function (Blueprint $table) {+ $table->increments('id');+ $table->integer('category_id', false, true);+ $table->integer('transaction_journal_id', false, true);++ $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');+ $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');+ }+ );+ }++ }+/****/@@ -497,96 +594,9 @@ class CreateMainTables extends Migration*/private function createTransactionTables(){+ $this->createJournalTables();+ $this->createMoreJournalTables();- if (!Schema::hasTable('transaction_journals')) {- Schema::create(- 'transaction_journals', function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();-- $table->integer('user_id', false, true);- $table->integer('transaction_type_id', false, true);- $table->integer('bill_id', false, true)->nullable();- $table->integer('transaction_currency_id', false, true);-- $table->string('description', 1024);-- $table->date('date');- $table->date('interest_date')->nullable();- $table->date('book_date')->nullable();- $table->date('process_date')->nullable();-- $table->integer('order', false, true);- $table->integer('tag_count', false, true);-- $table->boolean('encrypted')->default(1);- $table->boolean('completed')->default(1);-- // links to other tables:- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');- $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');- $table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null');- $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');- }- );- }-- if (!Schema::hasTable('journal_meta')) {- Schema::create(- 'journal_meta', function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->integer('transaction_journal_id', false, true);- $table->string('name', 255);- $table->text('data');- $table->string('hash', 64);-- $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');- }- );- }-- if (!Schema::hasTable('tag_transaction_journal')) {- Schema::create(- 'tag_transaction_journal', function (Blueprint $table) {- $table->increments('id');- $table->integer('tag_id', false, true);- $table->integer('transaction_journal_id', false, true);-- $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');- $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');--- }- );- }-- if (!Schema::hasTable('budget_transaction_journal')) {- Schema::create(- 'budget_transaction_journal', function (Blueprint $table) {- $table->increments('id');- $table->integer('budget_id', false, true);- $table->integer('transaction_journal_id', false, true);-- $table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');- $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');- }- );- }-- if (!Schema::hasTable('category_transaction_journal')) {- Schema::create(- 'category_transaction_journal', function (Blueprint $table) {- $table->increments('id');- $table->integer('category_id', false, true);- $table->integer('transaction_journal_id', false, true);-- $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');- $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');- }- );- }if (!Schema::hasTable('piggy_bank_events')) {Schema::create(