diff --git a/app/Console/Commands/DemoMode.php b/app/Console/Commands/DemoMode.php index 202a5073ca..9182289145 100644 --- a/app/Console/Commands/DemoMode.php +++ b/app/Console/Commands/DemoMode.php @@ -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)); diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 555fc7e6a2..c800d3a02f 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -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'))); diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 3986ea1497..a0cb64afc8 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -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']); diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 89d89724d4..ff816bfd1c 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -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 + } + } diff --git a/routes/api.php b/routes/api.php index 8c5cb8695e..e61a9ddad0 100644 --- a/routes/api.php +++ b/routes/api.php @@ -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');