1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Fixes for demo data

This commit is contained in:
David Bomba 2020-07-01 21:33:42 +10:00
parent 907e5ca0a7
commit 302c98e08b
5 changed files with 20 additions and 13 deletions

View File

@ -82,7 +82,7 @@ class DemoMode extends Command
private function createSmallAccount()
{
$this->count = 10;
$this->count = 100;
$this->info('Creating Small Account and Company');
@ -236,7 +236,7 @@ class DemoMode extends Command
$client->id_number = $this->getNextClientNumber($client);
$settings = $client->settings;
$settings->currency_id = (string)rand(1,79);
$settings->currency_id = (string)rand(1,3);
$client->settings = $settings;
$country = Country::all()->random();
@ -326,8 +326,8 @@ class DemoMode extends Command
$invoice->tax_rate3 = 5;
}
$invoice->custom_value1 = $faker->date;
$invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
// $invoice->custom_value1 = $faker->date;
// $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
$invoice->save();
@ -361,7 +361,11 @@ class DemoMode extends Command
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
$dateable = Carbon::now()->subDays(rand(0, 90));
if((bool)rand(0,1))
$dateable = Carbon::now()->subDays(rand(0, 90));
else
$dateable = Carbon::now()->addDays(rand(0, 90));
$credit->date = $dateable;
$credit->line_items = $this->buildLineItems(rand(1, 10));

View File

@ -89,8 +89,8 @@ class PreviewController extends BaseController
{
if (request()->has('entity') &&
request()->has('entity_id') &&
strlen(request()->input('entity')) > 1 &&
strlen(request()->input('entity_id')) > 1 &&
!empty(request()->input('entity')) &&
!empty(request()->input('entity_id')) &&
request()->has('body')) {
$design_object = json_decode(json_encode(request()->input('design')));

View File

@ -483,8 +483,8 @@ class Import implements ShouldQueue
throw new ResourceDependencyMissing('Processing invoices failed, because of missing dependency - clients.');
}
$modified['client_id'] = $this->transformId('clients', $resource['client_id']);
$modified['user_id'] = $this->processUserId($resource);
$modified['client_id'] = $this->transformId('clients', $resource['client_id']);
$modified['user_id'] = $this->processUserId($resource);
$modified['company_id'] = $this->company->id;
$modified['line_items'] = $this->cleanItems($modified['line_items']);

View File

@ -286,12 +286,15 @@ class RecurringInvoice extends BaseModel
case RecurringInvoice::FREQUENCY_TWO_YEARS:
return ctrans('texts.freq_two_years');
break;
case RecurringInvoice::RECURS_INDEFINITELY:
return ctrans('texts.freq_indefinitely');
break;
default:
# code...
break;
}
}
public function recurringDates()
{
//send back a list of the next send dates and due dates
}
}

View File

@ -103,7 +103,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit
Route::resource('tokens', 'TokenController');// name = (tokens. index / create / show / update / destroy / edit
Route::resource('tokens', 'TokenController')->middleware('password_protected');// name = (tokens. index / create / show / update / destroy / edit
Route::resource('company_gateways', 'CompanyGatewayController');