mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 10:47:00 +00:00 
			
		
		
		
	Code cleanup
This commit is contained in:
		| @@ -23,7 +23,6 @@ declare(strict_types=1); | |||||||
| use Carbon\Carbon; | use Carbon\Carbon; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| $factory->define( | $factory->define( | ||||||
|     FireflyIII\Models\Account::class, |     FireflyIII\Models\Account::class, | ||||||
|     function (Faker\Generator $faker) { |     function (Faker\Generator $faker) { | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
| declare(strict_types=1); | declare(strict_types=1); | ||||||
|  |  | ||||||
| use Carbon\Carbon; | use Carbon\Carbon; | ||||||
|  | use FireflyIII\Models\TransactionJournal; | ||||||
|  |  | ||||||
|  |  | ||||||
| $factory->define( | $factory->define( | ||||||
| @@ -29,7 +30,7 @@ $factory->define( | |||||||
|         return [ |         return [ | ||||||
|             'user_id'         => 1, |             'user_id'         => 1, | ||||||
|             'attachable_id'   => 1, |             'attachable_id'   => 1, | ||||||
|             'attachable_type' => \FireflyIII\Models\TransactionJournal::class, |             'attachable_type' => TransactionJournal::class, | ||||||
|             'md5'             => md5($faker->words(6, true)), |             'md5'             => md5($faker->words(6, true)), | ||||||
|             'mime'            => 'text/plain', |             'mime'            => 'text/plain', | ||||||
|             'size'            => 1, |             'size'            => 1, | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| declare(strict_types=1); | declare(strict_types=1); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * UserFactory.php |  * UserFactory.php | ||||||
|  * Copyright (c) 2018 thegrumpydictator@gmail.com |  * Copyright (c) 2018 thegrumpydictator@gmail.com | ||||||
|   | |||||||
| @@ -75,13 +75,14 @@ class ChangesForV431 extends Migration | |||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|      * |      * | ||||||
|      * @SuppressWarnings(PHPMD.ShortMethodName) |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|  |      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|         // add decimal places to "transaction currencies". |         // add decimal places to "transaction currencies". | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'transaction_currencies', |             'transaction_currencies', | ||||||
|             function (Blueprint $table) { |             static function (Blueprint $table) { | ||||||
|                 $table->smallInteger('decimal_places', false, true)->default(2); |                 $table->smallInteger('decimal_places', false, true)->default(2); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
| @@ -89,7 +90,7 @@ class ChangesForV431 extends Migration | |||||||
|         // change field "startdate" to "start_date" |         // change field "startdate" to "start_date" | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'budget_limits', |             'budget_limits', | ||||||
|             function (Blueprint $table) { |             static function (Blueprint $table) { | ||||||
|                 $table->renameColumn('startdate', 'start_date'); |                 $table->renameColumn('startdate', 'start_date'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
| @@ -97,7 +98,7 @@ class ChangesForV431 extends Migration | |||||||
|         // add date field "end_date" after "start_date" |         // add date field "end_date" after "start_date" | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'budget_limits', |             'budget_limits', | ||||||
|             function (Blueprint $table) { |             static function (Blueprint $table) { | ||||||
|                 $table->date('end_date')->nullable()->after('start_date'); |                 $table->date('end_date')->nullable()->after('start_date'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
| @@ -105,13 +106,13 @@ class ChangesForV431 extends Migration | |||||||
|         // drop "repeats" and "repeat_freq". |         // drop "repeats" and "repeat_freq". | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'budget_limits', |             'budget_limits', | ||||||
|             function (Blueprint $table) { |             static function (Blueprint $table) { | ||||||
|                 $table->dropColumn('repeats'); |                 $table->dropColumn('repeats'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'budget_limits', |             'budget_limits', | ||||||
|             function (Blueprint $table) { |             static function (Blueprint $table) { | ||||||
|                 $table->dropColumn('repeat_freq'); |                 $table->dropColumn('repeat_freq'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class CreateOauthAuthCodesTable extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class CreateOauthAccessTokensTable extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class CreateOauthRefreshTokensTable extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class CreateOauthClientsTable extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -42,6 +42,7 @@ class CreateOauthPersonalAccessClientsTable extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      */ |      */ | ||||||
|     public function up(): void |     public function up(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -53,6 +53,7 @@ class ChangesForV472 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -61,6 +61,7 @@ class ChangesForV473 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ class ChangesForV474 extends Migration | |||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Reverse the migrations. |      * Reverse the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
| @@ -92,6 +93,7 @@ class ChangesForV474 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -47,6 +47,8 @@ class ChangesForV475 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|  |      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ class ChangesForV477 extends Migration | |||||||
|         Schema::table( |         Schema::table( | ||||||
|             'budget_limits', function (Blueprint $table) { |             'budget_limits', function (Blueprint $table) { | ||||||
|  |  | ||||||
|                 // cannot drop foreign keys in SQLite: |             // cannot drop foreign keys in SQLite: | ||||||
|             if ('sqlite' !== config('database.default')) { |             if ('sqlite' !== config('database.default')) { | ||||||
|                 $table->dropForeign('budget_limits_transaction_currency_id_foreign'); |                 $table->dropForeign('budget_limits_transaction_currency_id_foreign'); | ||||||
|             } |             } | ||||||
| @@ -53,6 +53,7 @@ class ChangesForV477 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| declare(strict_types=1); | declare(strict_types=1); | ||||||
|  |  | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  |  | ||||||
| @@ -45,6 +46,7 @@ class ChangesForV479 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class ChangesForV4710 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
| @@ -73,7 +74,7 @@ class ChangesForV4710 extends Migration | |||||||
|                     $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); |                     $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); | ||||||
|  |  | ||||||
|                     // unique combi: |                     // unique combi: | ||||||
|                     $table->unique(['transaction_group_id', 'transaction_journal_id'],'unique_in_group'); |                     $table->unique(['transaction_group_id', 'transaction_journal_id'], 'unique_in_group'); | ||||||
|                 } |                 } | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -40,6 +40,7 @@ class ChangesForV4711 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
| @@ -59,7 +60,8 @@ class ChangesForV4711 extends Migration | |||||||
|         } |         } | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
|         Schema::table('preferences', function (Blueprint $table) { |         Schema::table( | ||||||
|  |             'preferences', function (Blueprint $table) { | ||||||
|             $table->text('data')->nullable()->change(); |             $table->text('data')->nullable()->change(); | ||||||
|         } |         } | ||||||
|         ); |         ); | ||||||
|   | |||||||
| @@ -42,6 +42,7 @@ class ChangesForV4712 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -46,6 +46,7 @@ class FixLdapConfiguration extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -47,9 +47,11 @@ class ChangesForV480 extends Migration | |||||||
|                 $table->dropColumn('transaction_group_id'); |                 $table->dropColumn('transaction_group_id'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|         Schema::table('rule_groups', static function (Blueprint $table) { |         Schema::table( | ||||||
|  |             'rule_groups', static function (Blueprint $table) { | ||||||
|             $table->dropColumn('stop_processing'); |             $table->dropColumn('stop_processing'); | ||||||
|         }); |         } | ||||||
|  |         ); | ||||||
|  |  | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'users', static function (Blueprint $table) { |             'users', static function (Blueprint $table) { | ||||||
| @@ -60,6 +62,7 @@ class ChangesForV480 extends Migration | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Run the migrations. |      * Run the migrations. | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|      * |      * | ||||||
|      * @return void |      * @return void | ||||||
|      */ |      */ | ||||||
| @@ -80,9 +83,11 @@ class ChangesForV480 extends Migration | |||||||
|                 $table->foreign('transaction_group_id')->references('id')->on('transaction_groups')->onDelete('cascade'); |                 $table->foreign('transaction_group_id')->references('id')->on('transaction_groups')->onDelete('cascade'); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|         Schema::table('rule_groups', static function (Blueprint $table) { |         Schema::table( | ||||||
|  |             'rule_groups', static function (Blueprint $table) { | ||||||
|             $table->boolean('stop_processing')->default(false); |             $table->boolean('stop_processing')->default(false); | ||||||
|         }); |         } | ||||||
|  |         ); | ||||||
|         Schema::table( |         Schema::table( | ||||||
|             'users', static function (Blueprint $table) { |             'users', static function (Blueprint $table) { | ||||||
|             $table->string('mfa_secret', 50)->nullable(); |             $table->string('mfa_secret', 50)->nullable(); | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ class AccountTypeSeeder extends Seeder | |||||||
|             AccountType::LOAN, |             AccountType::LOAN, | ||||||
|             AccountType::RECONCILIATION, |             AccountType::RECONCILIATION, | ||||||
|             AccountType::DEBT, |             AccountType::DEBT, | ||||||
|             AccountType::MORTGAGE |             AccountType::MORTGAGE, | ||||||
|         ]; |         ]; | ||||||
|         foreach ($types as $type) { |         foreach ($types as $type) { | ||||||
|             try { |             try { | ||||||
|   | |||||||
| @@ -28,11 +28,15 @@ use Illuminate\Database\Seeder; | |||||||
|  */ |  */ | ||||||
| class TransactionCurrencySeeder extends Seeder | class TransactionCurrencySeeder extends Seeder | ||||||
| { | { | ||||||
|  |     /** | ||||||
|  |      * @SuppressWarnings(PHPMD.ShortMethodName) | ||||||
|  |      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||||
|  |      */ | ||||||
|     public function run() |     public function run() | ||||||
|     { |     { | ||||||
|         $currencies = []; |         $currencies = []; | ||||||
|         // european currencies |         // european currencies | ||||||
|         $currencies[] = ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2,'enabled' => 1]; |         $currencies[] = ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2, 'enabled' => 1]; | ||||||
|         $currencies[] = ['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft', 'decimal_places' => 2]; |         $currencies[] = ['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft', 'decimal_places' => 2]; | ||||||
|         $currencies[] = ['code' => 'GBP', 'name' => 'British Pound', 'symbol' => '£', 'decimal_places' => 2]; |         $currencies[] = ['code' => 'GBP', 'name' => 'British Pound', 'symbol' => '£', 'decimal_places' => 2]; | ||||||
|         $currencies[] = ['code' => 'UAH', 'name' => 'Ukrainian hryvnia', 'symbol' => '₴', 'decimal_places' => 2]; |         $currencies[] = ['code' => 'UAH', 'name' => 'Ukrainian hryvnia', 'symbol' => '₴', 'decimal_places' => 2]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user