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

View File

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

View File

@ -286,12 +286,15 @@ class RecurringInvoice extends BaseModel
case RecurringInvoice::FREQUENCY_TWO_YEARS: case RecurringInvoice::FREQUENCY_TWO_YEARS:
return ctrans('texts.freq_two_years'); return ctrans('texts.freq_two_years');
break; break;
case RecurringInvoice::RECURS_INDEFINITELY:
return ctrans('texts.freq_indefinitely');
break;
default: default:
# code... # code...
break; 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('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'); Route::resource('company_gateways', 'CompanyGatewayController');