From 12d9bac3fdc82937af9fd4f63206a4f1dd847e3e Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 23 Oct 2016 14:41:26 +0300 Subject: [PATCH] Added fields for future features --- app/Models/Account.php | 17 +++++++++- ...10_20_191150_add_expense_to_activities.php | 32 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index 5de8497461..dbe7e447f7 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -102,6 +102,21 @@ class Account extends Eloquent ACCOUNT_USER_MANAGEMENT, ]; + public static $modules = [ + 1 => ENTITY_RECURRING_INVOICE, + 2 => ENTITY_CREDIT, + 4 => ENTITY_QUOTE, + 8 => ENTITY_TASK, + 16 => ENTITY_EXPENSE, + 32 => ENTITY_VENDOR, + ]; + + public static $dashboardSections = [ + 1 => 'total_revenue', + 2 => 'average_invoice', + 4 => 'outstanding', + ]; + /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ @@ -459,7 +474,7 @@ class Account extends Eloquent if ( ! $decorator) { $decorator = $this->show_currency_code ? CURRENCY_DECORATOR_CODE : CURRENCY_DECORATOR_SYMBOL; } - + return Utils::formatMoney($amount, $currencyId, $countryId, $decorator); } diff --git a/database/migrations/2016_10_20_191150_add_expense_to_activities.php b/database/migrations/2016_10_20_191150_add_expense_to_activities.php index 08e6bfa7e9..6b95da88e5 100644 --- a/database/migrations/2016_10_20_191150_add_expense_to_activities.php +++ b/database/migrations/2016_10_20_191150_add_expense_to_activities.php @@ -16,6 +16,22 @@ class AddExpenseToActivities extends Migration { $table->unsignedInteger('expense_id')->nullable(); }); + + Schema::table('accounts', function($table) + { + $table->date('financial_year_start')->nullable(); + $table->smallInteger('enabled_modules')->default(63); + $table->smallInteger('enabled_dashboard_sections')->default(7); + $table->boolean('show_accept_invoice_terms')->default(false); + $table->boolean('show_accept_quote_terms')->default(false); + $table->boolean('require_invoice_signature')->default(false); + $table->boolean('require_quote_signature')->default(false); + }); + + Schema::table('payments', function($table) + { + $table->text('credit_ids')->nullable(); + }); } /** @@ -29,5 +45,21 @@ class AddExpenseToActivities extends Migration { $table->dropColumn('expense_id'); }); + + Schema::table('accounts', function($table) + { + $table->dropColumn('financial_year_start'); + $table->dropColumn('enabled_modules'); + $table->dropColumn('enabled_dashboard_sections'); + $table->dropColumn('show_accept_invoice_terms'); + $table->dropColumn('show_accept_quote_terms'); + $table->dropColumn('require_invoice_signature'); + $table->dropColumn('require_quote_signature'); + }); + + Schema::table('payments', function($table) + { + $table->dropColumn('credit_ids'); + }); } }