diff --git a/app/DataMapper/ClientRegistrationFields.php b/app/DataMapper/ClientRegistrationFields.php index 242cd7ac0a27..f56252f6fd70 100644 --- a/app/DataMapper/ClientRegistrationFields.php +++ b/app/DataMapper/ClientRegistrationFields.php @@ -19,12 +19,83 @@ class ClientRegistrationFields $data = [ [ - 'key' => 'name', - 'value' => 'name', + 'key' => 'first_name', 'required' => true ], - - + [ + 'key' => 'last_name', + 'required' => true + ], + [ + 'key' => 'email', + 'required' => true + ], + [ + 'key' => 'phone', + 'required' => true + ], + [ + 'key' => 'password', + 'required' => true + ], + [ + 'key' => 'name', + 'required' => false + ], + [ + 'key' => 'website', + 'required' => false + ], + [ + 'key' => 'address1', + 'required' => false + ], + [ + 'key' => 'address2', + 'required' => false + ], + [ + 'key' => 'city', + 'required' => false + ], + [ + 'key' => 'state', + 'required' => false + ], + [ + 'key' => 'postal_code', + 'required' => false + ], + [ + 'key' => 'country_id', + 'required' => false + ], + [ + 'key' => 'custom_value1', + 'required' => false + ], + [ + 'key' => 'custom_value2', + 'required' => false + ], + [ + 'key' => 'custom_value3', + 'required' => false + ], + [ + 'key' => 'custom_value4', + 'required' => false + ], + [ + 'key' => 'public_notes', + 'required' => false + ], + [ + 'key' => 'vat_number', + 'required' => false + ], ]; + + return $data; } -} +} \ No newline at end of file diff --git a/app/Factory/CompanyFactory.php b/app/Factory/CompanyFactory.php index 7043bbdba023..4f62bca9fdc4 100644 --- a/app/Factory/CompanyFactory.php +++ b/app/Factory/CompanyFactory.php @@ -11,6 +11,7 @@ namespace App\Factory; +use App\DataMapper\ClientRegistrationFields; use App\DataMapper\CompanySettings; use App\Libraries\MultiDB; use App\Models\Company; @@ -35,7 +36,8 @@ class CompanyFactory $company->db = config('database.default'); //$company->custom_fields = (object) ['invoice1' => '1', 'invoice2' => '2', 'client1'=>'3']; $company->custom_fields = (object) []; - + $company->client_registration_fields = ClientRegistrationFields::generate(); + if(Ninja::isHosted()) $company->subdomain = MultiDB::randomSubdomainGenerator(); else diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index 609876cbe5ee..d89561baeef6 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -44,6 +44,7 @@ class UpdateCompanyRequest extends Request $rules['size_id'] = 'integer|nullable'; $rules['country_id'] = 'integer|nullable'; $rules['work_email'] = 'email|nullable'; + // $rules['client_registration_fields'] = 'array'; if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'sometimes|url'; diff --git a/app/Jobs/Company/CreateCompany.php b/app/Jobs/Company/CreateCompany.php index ca3624ec443d..cbb6a1afe157 100644 --- a/app/Jobs/Company/CreateCompany.php +++ b/app/Jobs/Company/CreateCompany.php @@ -11,6 +11,7 @@ namespace App\Jobs\Company; +use App\DataMapper\ClientRegistrationFields; use App\DataMapper\CompanySettings; use App\Libraries\MultiDB; use App\Models\Company; @@ -62,7 +63,8 @@ class CreateCompany $company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : ''; $company->custom_fields = new \stdClass; $company->default_password_timeout = 1800000; - + $company->client_registration_fields = ClientRegistrationFields::generate(); + if(Ninja::isHosted()) $company->subdomain = MultiDB::randomSubdomainGenerator(); else diff --git a/app/Models/Company.php b/app/Models/Company.php index d131e401b044..86554fe5001e 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -96,6 +96,7 @@ class Company extends BaseModel 'show_task_end_date', 'use_comma_as_decimal_place', 'report_include_drafts', + 'client_registration_fields', ]; protected $hidden = [ @@ -111,6 +112,7 @@ class Company extends BaseModel 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', + 'client_registration_fields' => 'array', ]; protected $with = [ diff --git a/app/Transformers/InvoiceHistoryTransformer.php b/app/Transformers/InvoiceHistoryTransformer.php index 6b9ad6af8427..fd2547af0966 100644 --- a/app/Transformers/InvoiceHistoryTransformer.php +++ b/app/Transformers/InvoiceHistoryTransformer.php @@ -34,8 +34,8 @@ class InvoiceHistoryTransformer extends EntityTransformer return [ 'id' => '', 'activity_id' => '', - 'json_backup' => (string) '', - 'html_backup' => (string) '', + // 'json_backup' => (string) '', + // 'html_backup' => (string) '', 'amount' => (float) 0, 'created_at' => (int) 0, 'updated_at' => (int) 0, @@ -46,8 +46,8 @@ class InvoiceHistoryTransformer extends EntityTransformer return [ 'id' => $this->encodePrimaryKey($backup->id), 'activity_id' => $this->encodePrimaryKey($backup->activity_id), - 'json_backup' => (string) $backup->json_backup ?: '', - 'html_backup' => (string) $backup->html_backup ?: '', + // 'json_backup' => (string) $backup->json_backup ?: '', + // 'html_backup' => (string) $backup->html_backup ?: '', 'amount' => (float) $backup->amount, 'created_at' => (int) $backup->created_at, 'updated_at' => (int) $backup->updated_at, diff --git a/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php b/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php new file mode 100644 index 000000000000..436f503b0142 --- /dev/null +++ b/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php @@ -0,0 +1,30 @@ +mediumText('client_registration_fields')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}