1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Improve test data

This commit is contained in:
David Bomba 2020-06-29 09:38:37 +10:00
parent b2037095a2
commit 22c8304510
3 changed files with 26 additions and 3 deletions

View File

@ -20,6 +20,7 @@ use App\Jobs\Quote\CreateQuoteInvitations;
use App\Listeners\Credit\CreateCreditInvitation;
use App\Listeners\Invoice\CreateInvoiceInvitation;
use App\Models\CompanyToken;
use App\Models\Country;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\Product;
@ -396,6 +397,14 @@ class CreateTestData extends Command
]);
$client->id_number = $this->getNextClientNumber($client);
$settings = $client->settings;
$settings->currency_id = (string)rand(1,79);
$client->settings = $settings;
$country = Country::all()->random();
$client->country_id = $country->id;
$client->save();
}

View File

@ -38,9 +38,14 @@ class DemoMode extends Command
{
set_time_limit(0);
Artisan::call('migrate:fresh');
Artisan::call('db:seed');
Artisan::call('db:seed --class=RandomDataSeeder');
$this->info("Migrating");
Artisan::call('migrate:fresh --force');
$this->info("Seeding");
Artisan::call('db:seed --force');
$this->info("Seeding Random Data");
Artisan::call('db:seed --class=RandomDataSeeder --force');
}
}

View File

@ -302,16 +302,25 @@ class BaseRepository
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
}
if(!$model->design_id)
$model->design_id = $client->getSetting('invoice_design_id');
event(new InvoiceWasUpdated($model, $model->company));
}
if ($class->name == Credit::class) {
$model = $model->calc()->getCredit();
if(!$model->design_id)
$model->design_id = $client->getSetting('credit_design_id');
}
if ($class->name == Quote::class) {
$model = $model->calc()->getQuote();
if(!$model->design_id)
$model->design_id = $client->getSetting('quote_design_id');
}
$model->save();