Merge pull request #6454 from turbo124/v5-develop

v5.2.18
This commit is contained in:
David Bomba 2021-08-14 15:11:42 +10:00 committed by GitHub
commit 81cf9ace95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 4 deletions

View File

@ -1 +1 @@
5.2.17 5.2.18

View File

@ -54,6 +54,7 @@ class StoreClientRequest extends Request
/* Ensure we have a client name, and that all emails are unique*/ /* Ensure we have a client name, and that all emails are unique*/
//$rules['name'] = 'required|min:1'; //$rules['name'] = 'required|min:1';
$rules['settings'] = new ValidClientGroupSettingsRule(); $rules['settings'] = new ValidClientGroupSettingsRule();
$rules['contacts'] = 'array';
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email'; $rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
$rules['contacts.*.password'] = [ $rules['contacts.*.password'] = [
'nullable', 'nullable',

View File

@ -62,6 +62,7 @@ class UpdateClientRequest extends Request
$rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id)->ignore($this->client->id); $rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id)->ignore($this->client->id);
$rules['settings'] = new ValidClientGroupSettingsRule(); $rules['settings'] = new ValidClientGroupSettingsRule();
$rules['contacts'] = 'array';
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email'; $rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
$rules['contacts.*.password'] = [ $rules['contacts.*.password'] = [
'nullable', 'nullable',

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.2.17', 'app_version' => '5.2.18',
'app_tag' => '5.2.17', 'app_tag' => '5.2.18',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),

View File

@ -3,7 +3,7 @@
<head> <head>
<!-- Source: https://github.com/invoiceninja/invoiceninja --> <!-- Source: https://github.com/invoiceninja/invoiceninja -->
<!-- Version: {{ config('ninja.app_version') }} --> <!-- Version: {{ config('ninja.app_version') }} -->
<base href="/"> <base href="{{ $_SERVER['REQUEST_URI'] }}">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}"> <meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
<link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}"> <link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}">

View File

@ -263,6 +263,63 @@ class ClientTest extends TestCase
$this->assertEquals($this->client->contacts->count(), 3); $this->assertEquals($this->client->contacts->count(), 3);
} }
public function testClientCreationWithIllegalContactObject()
{
$account = Account::factory()->create();
$company = Company::factory()->create([
'account_id' => $account->id,
]);
$account->default_company_id = $company->id;
$account->save();
$user = User::factory()->create([
'account_id' => $account->id,
'confirmation_code' => $this->createDbHash(config('database.default')),
'email' => 'whiz@gmail.com',
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 1,
'is_admin' => 1,
'notifications' => CompanySettings::notificationDefaults(),
'permissions' => '',
'settings' => '',
'is_locked' => 0,
]);
$company_token = new CompanyToken;
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;
$company_token->name = $user->first_name.' '.$user->last_name;
$company_token->token = Str::random(64);
$company_token->save();
$this->token = $company_token->token;
$data = [
'name' => 'A loyal Client',
'contacts' => $this->faker->unique()->safeEmail,
];
try{
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/clients/', $data);
}catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1);
$this->assertNotNull($message);
}
}
public function testCreatingClientAndContacts() public function testCreatingClientAndContacts()
{ {
$account = Account::factory()->create(); $account = Account::factory()->create();