mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Various code cleanup things and preparation for a new demo user.
This commit is contained in:
@@ -50,11 +50,10 @@ class CreateImport extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
// find the file
|
|
||||||
/** @var UserRepositoryInterface $userRepository */
|
/** @var UserRepositoryInterface $userRepository */
|
||||||
$userRepository = app(UserRepositoryInterface::class);
|
$userRepository = app(UserRepositoryInterface::class);
|
||||||
$file = $this->argument('file');
|
$file = $this->argument('file');
|
||||||
@@ -67,7 +66,6 @@ class CreateImport extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to parse configuration data:
|
|
||||||
$configurationData = json_decode(file_get_contents($configuration));
|
$configurationData = json_decode(file_get_contents($configuration));
|
||||||
if (is_null($configurationData)) {
|
if (is_null($configurationData)) {
|
||||||
$this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
$this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
||||||
@@ -82,21 +80,17 @@ class CreateImport extends Command
|
|||||||
|
|
||||||
/** @var ImportJobRepositoryInterface $jobRepository */
|
/** @var ImportJobRepositoryInterface $jobRepository */
|
||||||
$jobRepository = app(ImportJobRepositoryInterface::class, [$user]);
|
$jobRepository = app(ImportJobRepositoryInterface::class, [$user]);
|
||||||
|
|
||||||
$job = $jobRepository->create($type);
|
$job = $jobRepository->create($type);
|
||||||
$this->line(sprintf('Created job "%s"...', $job->key));
|
$this->line(sprintf('Created job "%s"...', $job->key));
|
||||||
|
|
||||||
// put the file in the proper place:
|
|
||||||
Artisan::call('firefly:encrypt', ['file' => $file, 'key' => $job->key]);
|
Artisan::call('firefly:encrypt', ['file' => $file, 'key' => $job->key]);
|
||||||
$this->line('Stored import data...');
|
$this->line('Stored import data...');
|
||||||
|
|
||||||
// store the configuration in the job:
|
|
||||||
$job->configuration = $configurationData;
|
$job->configuration = $configurationData;
|
||||||
$job->status = 'settings_complete';
|
$job->status = 'settings_complete';
|
||||||
$job->save();
|
$job->save();
|
||||||
$this->line('Stored configuration...');
|
$this->line('Stored configuration...');
|
||||||
|
|
||||||
// if user wants to run it, do!
|
|
||||||
if ($this->option('start') === true) {
|
if ($this->option('start') === true) {
|
||||||
$this->line('The import will start in a moment. This process is not visible...');
|
$this->line('The import will start in a moment. This process is not visible...');
|
||||||
Log::debug('Go for import!');
|
Log::debug('Go for import!');
|
||||||
@@ -109,10 +103,10 @@ class CreateImport extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five exactly.
|
||||||
*/
|
*/
|
||||||
private function validArguments(): bool
|
private function validArguments(): bool
|
||||||
{
|
{
|
||||||
// find the file
|
|
||||||
/** @var UserRepositoryInterface $userRepository */
|
/** @var UserRepositoryInterface $userRepository */
|
||||||
$userRepository = app(UserRepositoryInterface::class);
|
$userRepository = app(UserRepositoryInterface::class);
|
||||||
$file = $this->argument('file');
|
$file = $this->argument('file');
|
||||||
|
@@ -18,6 +18,7 @@ use FireflyIII\Import\Logging\CommandHandler;
|
|||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,34 +70,15 @@ class Import extends Command
|
|||||||
$monolog = Log::getMonolog();
|
$monolog = Log::getMonolog();
|
||||||
$handler = new CommandHandler($this);
|
$handler = new CommandHandler($this);
|
||||||
$monolog->pushHandler($handler);
|
$monolog->pushHandler($handler);
|
||||||
|
|
||||||
$importProcedure = new ImportProcedure;
|
$importProcedure = new ImportProcedure;
|
||||||
|
|
||||||
$result = $importProcedure->runImport($job);
|
$result = $importProcedure->runImport($job);
|
||||||
|
|
||||||
|
// display result to user:
|
||||||
/**
|
$this->presentResults($result);
|
||||||
* @var int $index
|
|
||||||
* @var TransactionJournal $journal
|
|
||||||
*/
|
|
||||||
foreach ($result as $index => $journal) {
|
|
||||||
if (!is_null($journal->id)) {
|
|
||||||
$this->line(sprintf('Line #%d has been imported as transaction #%d.', $index, $journal->id));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->error(sprintf('Could not store line #%d', $index));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->line('The import has completed.');
|
$this->line('The import has completed.');
|
||||||
|
|
||||||
// get any errors from the importer:
|
// get any errors from the importer:
|
||||||
$extendedStatus = $job->extended_status;
|
$this->presentErrors($job);
|
||||||
if (isset($extendedStatus['errors']) && count($extendedStatus['errors']) > 0) {
|
|
||||||
$this->line(sprintf('The following %d error(s) occured during the import:', count($extendedStatus['errors'])));
|
|
||||||
foreach ($extendedStatus['errors'] as $error) {
|
|
||||||
$this->error($error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,4 +104,36 @@ class Import extends Command
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportJob $job
|
||||||
|
*/
|
||||||
|
private function presentErrors(ImportJob $job)
|
||||||
|
{
|
||||||
|
$extendedStatus = $job->extended_status;
|
||||||
|
if (isset($extendedStatus['errors']) && count($extendedStatus['errors']) > 0) {
|
||||||
|
$this->line(sprintf('The following %d error(s) occured during the import:', count($extendedStatus['errors'])));
|
||||||
|
foreach ($extendedStatus['errors'] as $error) {
|
||||||
|
$this->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $result
|
||||||
|
*/
|
||||||
|
private function presentResults(Collection $result)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int $index
|
||||||
|
* @var TransactionJournal $journal
|
||||||
|
*/
|
||||||
|
foreach ($result as $index => $journal) {
|
||||||
|
if (!is_null($journal->id)) {
|
||||||
|
$this->line(sprintf('Line #%d has been imported as transaction #%d.', $index, $journal->id));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->error(sprintf('Could not store line #%d', $index));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,42 +60,26 @@ class ScanAttachments extends Command
|
|||||||
/** @var Attachment $attachment */
|
/** @var Attachment $attachment */
|
||||||
foreach ($attachments as $attachment) {
|
foreach ($attachments as $attachment) {
|
||||||
$fileName = $attachment->fileName();
|
$fileName = $attachment->fileName();
|
||||||
|
|
||||||
// try to grab file content:
|
|
||||||
try {
|
try {
|
||||||
$content = $disk->get($fileName);
|
$content = $disk->get($fileName);
|
||||||
} catch (FileNotFoundException $e) {
|
} catch (FileNotFoundException $e) {
|
||||||
$this->error(sprintf('Could not find data for attachment #%d', $attachment->id));
|
$this->error(sprintf('Could not find data for attachment #%d', $attachment->id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// try to decrypt content.
|
|
||||||
try {
|
try {
|
||||||
$decrypted = Crypt::decrypt($content);
|
$decrypted = Crypt::decrypt($content);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
$this->error(sprintf('Could not decrypt data of attachment #%d', $attachment->id));
|
$this->error(sprintf('Could not decrypt data of attachment #%d', $attachment->id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make temp file:
|
|
||||||
$tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
$tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||||
|
|
||||||
// store content in temp file:
|
|
||||||
file_put_contents($tmpfname, $decrypted);
|
file_put_contents($tmpfname, $decrypted);
|
||||||
|
|
||||||
// get md5 and mime
|
|
||||||
$md5 = md5_file($tmpfname);
|
$md5 = md5_file($tmpfname);
|
||||||
$mime = mime_content_type($tmpfname);
|
$mime = mime_content_type($tmpfname);
|
||||||
|
|
||||||
// update attachment:
|
|
||||||
$attachment->md5 = $md5;
|
$attachment->md5 = $md5;
|
||||||
$attachment->mime = $mime;
|
$attachment->mime = $mime;
|
||||||
$attachment->save();
|
$attachment->save();
|
||||||
|
|
||||||
|
|
||||||
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
|
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
|
||||||
|
|
||||||
// find file:
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@ class CreateSupportTables extends Migration
|
|||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -42,56 +41,20 @@ class CreateSupportTables extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* account_types
|
|
||||||
*/
|
|
||||||
$this->createAccountTypeTable();
|
$this->createAccountTypeTable();
|
||||||
/*
|
|
||||||
* transaction_currencies
|
|
||||||
*/
|
|
||||||
$this->createCurrencyTable();
|
$this->createCurrencyTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* transaction_types
|
|
||||||
*/
|
|
||||||
$this->createTransactionTypeTable();
|
$this->createTransactionTypeTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* jobs
|
|
||||||
*/
|
|
||||||
$this->createJobsTable();
|
$this->createJobsTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* password_resets
|
|
||||||
*/
|
|
||||||
$this->createPasswordTable();
|
$this->createPasswordTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* permissions
|
|
||||||
*/
|
|
||||||
$this->createPermissionsTable();
|
$this->createPermissionsTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* roles
|
|
||||||
*/
|
|
||||||
$this->createRolesTable();
|
$this->createRolesTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* permission_role
|
|
||||||
*/
|
|
||||||
$this->createPermissionRoleTable();
|
$this->createPermissionRoleTable();
|
||||||
|
|
||||||
/*
|
|
||||||
* sessions
|
|
||||||
*/
|
|
||||||
$this->createSessionsTable();
|
$this->createSessionsTable();
|
||||||
|
|
||||||
$this->createConfigurationTable();
|
$this->createConfigurationTable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -21,7 +21,7 @@ class CreateUsersTable extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@@ -43,8 +43,6 @@ class CreateUsersTable extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
@@ -55,6 +55,8 @@ class CreateMainTables extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@@ -89,14 +91,9 @@ class CreateMainTables extends Migration
|
|||||||
$table->string('name', 1024);
|
$table->string('name', 1024);
|
||||||
$table->decimal('virtual_balance', 14, 4)->nullable();
|
$table->decimal('virtual_balance', 14, 4)->nullable();
|
||||||
$table->string('iban', 255)->nullable();
|
$table->string('iban', 255)->nullable();
|
||||||
|
|
||||||
$table->boolean('active')->default(1);
|
$table->boolean('active')->default(1);
|
||||||
$table->boolean('encrypted')->default(0);
|
$table->boolean('encrypted')->default(0);
|
||||||
|
|
||||||
// link user id to users table
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
|
|
||||||
// link account type id to account types table
|
|
||||||
$table->foreign('account_type_id')->references('id')->on('account_types')->onDelete('cascade');
|
$table->foreign('account_type_id')->references('id')->on('account_types')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -110,8 +107,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->integer('account_id', false, true);
|
$table->integer('account_id', false, true);
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->text('data');
|
$table->text('data');
|
||||||
|
|
||||||
// link account id to accounts:
|
|
||||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -183,12 +178,10 @@ class CreateMainTables extends Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped.
|
||||||
*/
|
*/
|
||||||
private function createBudgetTables()
|
private function createBudgetTables()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (!Schema::hasTable('budgets')) {
|
if (!Schema::hasTable('budgets')) {
|
||||||
Schema::create(
|
Schema::create(
|
||||||
'budgets', function (Blueprint $table) {
|
'budgets', function (Blueprint $table) {
|
||||||
@@ -199,8 +192,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->string('name', 1024);
|
$table->string('name', 1024);
|
||||||
$table->boolean('active')->default(1);
|
$table->boolean('active')->default(1);
|
||||||
$table->boolean('encrypted')->default(0);
|
$table->boolean('encrypted')->default(0);
|
||||||
|
|
||||||
// link user id to users table
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +201,6 @@ class CreateMainTables extends Migration
|
|||||||
if (!Schema::hasTable('budget_limits')) {
|
if (!Schema::hasTable('budget_limits')) {
|
||||||
Schema::create(
|
Schema::create(
|
||||||
'budget_limits', function (Blueprint $table) {
|
'budget_limits', function (Blueprint $table) {
|
||||||
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->integer('budget_id', false, true);
|
$table->integer('budget_id', false, true);
|
||||||
@@ -218,8 +208,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->decimal('amount', 14, 4);
|
$table->decimal('amount', 14, 4);
|
||||||
$table->string('repeat_freq', 30);
|
$table->string('repeat_freq', 30);
|
||||||
$table->boolean('repeats')->default(0);
|
$table->boolean('repeats')->default(0);
|
||||||
|
|
||||||
// link budget id to budgets table
|
|
||||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,8 +222,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->date('startdate');
|
$table->date('startdate');
|
||||||
$table->date('enddate');
|
$table->date('enddate');
|
||||||
$table->decimal('amount', 14, 4);
|
$table->decimal('amount', 14, 4);
|
||||||
|
|
||||||
// link budget limit id to budget_limitss table
|
|
||||||
$table->foreign('budget_limit_id')->references('id')->on('budget_limits')->onDelete('cascade');
|
$table->foreign('budget_limit_id')->references('id')->on('budget_limits')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -319,8 +305,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->integer('order', false, true)->default(0);
|
$table->integer('order', false, true)->default(0);
|
||||||
$table->boolean('active')->default(0);
|
$table->boolean('active')->default(0);
|
||||||
$table->boolean('encrypted')->default(1);
|
$table->boolean('encrypted')->default(1);
|
||||||
|
|
||||||
// link to account_id to accounts
|
|
||||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -335,13 +319,10 @@ class CreateMainTables extends Migration
|
|||||||
$table->date('startdate')->nullable();
|
$table->date('startdate')->nullable();
|
||||||
$table->date('targetdate')->nullable();
|
$table->date('targetdate')->nullable();
|
||||||
$table->decimal('currentamount', 14, 4);
|
$table->decimal('currentamount', 14, 4);
|
||||||
|
|
||||||
$table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade');
|
$table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade');
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,7 +369,8 @@ class CreateMainTables extends Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped.
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its exactly five
|
||||||
*/
|
*/
|
||||||
private function createRuleTables()
|
private function createRuleTables()
|
||||||
{
|
{
|
||||||
@@ -503,7 +485,9 @@ class CreateMainTables extends Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped.
|
||||||
|
* @SuppressWarnings(PHPMD.NPathComplexity) // cannot be helped
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its exactly five
|
||||||
*/
|
*/
|
||||||
private function createTransactionTables()
|
private function createTransactionTables()
|
||||||
{
|
{
|
||||||
@@ -513,26 +497,19 @@ class CreateMainTables extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
|
|
||||||
$table->integer('user_id', false, true);
|
$table->integer('user_id', false, true);
|
||||||
$table->integer('transaction_type_id', false, true);
|
$table->integer('transaction_type_id', false, true);
|
||||||
$table->integer('bill_id', false, true)->nullable();
|
$table->integer('bill_id', false, true)->nullable();
|
||||||
$table->integer('transaction_currency_id', false, true);
|
$table->integer('transaction_currency_id', false, true);
|
||||||
|
|
||||||
$table->string('description', 1024);
|
$table->string('description', 1024);
|
||||||
|
|
||||||
$table->date('date');
|
$table->date('date');
|
||||||
$table->date('interest_date')->nullable();
|
$table->date('interest_date')->nullable();
|
||||||
$table->date('book_date')->nullable();
|
$table->date('book_date')->nullable();
|
||||||
$table->date('process_date')->nullable();
|
$table->date('process_date')->nullable();
|
||||||
|
|
||||||
$table->integer('order', false, true)->default(0);
|
$table->integer('order', false, true)->default(0);
|
||||||
$table->integer('tag_count', false, true);
|
$table->integer('tag_count', false, true);
|
||||||
|
|
||||||
$table->boolean('encrypted')->default(1);
|
$table->boolean('encrypted')->default(1);
|
||||||
$table->boolean('completed')->default(1);
|
$table->boolean('completed')->default(1);
|
||||||
|
|
||||||
// links to other tables:
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
$table->foreign('transaction_type_id')->references('id')->on('transaction_types')->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('bill_id')->references('id')->on('bills')->onDelete('set null');
|
||||||
@@ -550,7 +527,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->string('name', 255);
|
$table->string('name', 255);
|
||||||
$table->text('data');
|
$table->text('data');
|
||||||
$table->string('hash', 64);
|
$table->string('hash', 64);
|
||||||
|
|
||||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -562,7 +538,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('tag_id', false, true);
|
$table->integer('tag_id', false, true);
|
||||||
$table->integer('transaction_journal_id', false, true);
|
$table->integer('transaction_journal_id', false, true);
|
||||||
|
|
||||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
|
|
||||||
@@ -577,7 +552,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('budget_id', false, true);
|
$table->integer('budget_id', false, true);
|
||||||
$table->integer('transaction_journal_id', false, true);
|
$table->integer('transaction_journal_id', false, true);
|
||||||
|
|
||||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
@@ -590,7 +564,6 @@ class CreateMainTables extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('category_id', false, true);
|
$table->integer('category_id', false, true);
|
||||||
$table->integer('transaction_journal_id', false, true);
|
$table->integer('transaction_journal_id', false, true);
|
||||||
|
|
||||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,6 @@ class ChangesFor3101 extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -31,7 +29,7 @@ class ChangesFor3101 extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
@@ -21,8 +21,6 @@ class FixNullables extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -32,7 +30,7 @@ class FixNullables extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
@@ -19,8 +19,6 @@ class ExpandTransactionsTable extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -30,7 +28,7 @@ class ExpandTransactionsTable extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
@@ -20,8 +20,6 @@ class ChangesForV410 extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -31,7 +29,7 @@ class ChangesForV410 extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
@@ -19,8 +19,6 @@ class ChangesForV420 extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -30,7 +28,7 @@ class ChangesForV420 extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
@@ -1,21 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChangesForV430
|
* Class ChangesForV430
|
||||||
*/
|
*/
|
||||||
class ChangesForV430 extends Migration
|
class ChangesForV430 extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('available_budgets');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('available_budgets', function (Blueprint $table) {
|
Schema::create(
|
||||||
|
'available_budgets', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
@@ -28,16 +37,7 @@ class ChangesForV430 extends Migration
|
|||||||
|
|
||||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('available_budgets');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,12 @@ class PermissionSeeder extends Seeder
|
|||||||
$owner->description = 'User runs this instance of FF3'; // optional
|
$owner->description = 'User runs this instance of FF3'; // optional
|
||||||
$owner->save();
|
$owner->save();
|
||||||
|
|
||||||
|
$demo = new Role;
|
||||||
|
$demo->name ='demo';
|
||||||
|
$demo->display_name = 'Demo User';
|
||||||
|
$demo->description = 'User is a demo user';
|
||||||
|
$demo->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,6 @@ function removeRow(e) {
|
|||||||
$('table.split-table tbody tr[data-split="' + index + '"]').remove();
|
$('table.split-table tbody tr[data-split="' + index + '"]').remove();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
resetSplits();
|
resetSplits();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -171,8 +170,9 @@ function calculateSum() {
|
|||||||
for (var i = 0; i < set.length; i++) {
|
for (var i = 0; i < set.length; i++) {
|
||||||
var current = $(set[i]);
|
var current = $(set[i]);
|
||||||
sum += (current.val() == "" ? 0 : parseFloat(current.val()));
|
sum += (current.val() == "" ? 0 : parseFloat(current.val()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
sum = Math.round(sum * 100) / 100;
|
||||||
|
|
||||||
console.log("Sum is now " + sum);
|
console.log("Sum is now " + sum);
|
||||||
$('.amount-warning').remove();
|
$('.amount-warning').remove();
|
||||||
if (sum != originalSum) {
|
if (sum != originalSum) {
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
"type": "image\/png"
|
"type": "image\/png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"theme_color": "#ffffff",
|
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"start_url": "/",
|
"start_url": "/",
|
||||||
"orientation": "portrait"
|
"orientation": "portrait"
|
||||||
|
Reference in New Issue
Block a user