mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Default client registration fields
This commit is contained in:
parent
43822fbfdd
commit
4fdd709e99
@ -19,12 +19,83 @@ class ClientRegistrationFields
|
|||||||
$data =
|
$data =
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'key' => 'name',
|
'key' => 'first_name',
|
||||||
'value' => 'name',
|
|
||||||
'required' => true
|
'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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Factory;
|
namespace App\Factory;
|
||||||
|
|
||||||
|
use App\DataMapper\ClientRegistrationFields;
|
||||||
use App\DataMapper\CompanySettings;
|
use App\DataMapper\CompanySettings;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@ -35,7 +36,8 @@ class CompanyFactory
|
|||||||
$company->db = config('database.default');
|
$company->db = config('database.default');
|
||||||
//$company->custom_fields = (object) ['invoice1' => '1', 'invoice2' => '2', 'client1'=>'3'];
|
//$company->custom_fields = (object) ['invoice1' => '1', 'invoice2' => '2', 'client1'=>'3'];
|
||||||
$company->custom_fields = (object) [];
|
$company->custom_fields = (object) [];
|
||||||
|
$company->client_registration_fields = ClientRegistrationFields::generate();
|
||||||
|
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted())
|
||||||
$company->subdomain = MultiDB::randomSubdomainGenerator();
|
$company->subdomain = MultiDB::randomSubdomainGenerator();
|
||||||
else
|
else
|
||||||
|
@ -44,6 +44,7 @@ class UpdateCompanyRequest extends Request
|
|||||||
$rules['size_id'] = 'integer|nullable';
|
$rules['size_id'] = 'integer|nullable';
|
||||||
$rules['country_id'] = 'integer|nullable';
|
$rules['country_id'] = 'integer|nullable';
|
||||||
$rules['work_email'] = 'email|nullable';
|
$rules['work_email'] = 'email|nullable';
|
||||||
|
// $rules['client_registration_fields'] = 'array';
|
||||||
|
|
||||||
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
|
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
|
||||||
$rules['portal_domain'] = 'sometimes|url';
|
$rules['portal_domain'] = 'sometimes|url';
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Jobs\Company;
|
namespace App\Jobs\Company;
|
||||||
|
|
||||||
|
use App\DataMapper\ClientRegistrationFields;
|
||||||
use App\DataMapper\CompanySettings;
|
use App\DataMapper\CompanySettings;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@ -62,7 +63,8 @@ class CreateCompany
|
|||||||
$company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : '';
|
$company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : '';
|
||||||
$company->custom_fields = new \stdClass;
|
$company->custom_fields = new \stdClass;
|
||||||
$company->default_password_timeout = 1800000;
|
$company->default_password_timeout = 1800000;
|
||||||
|
$company->client_registration_fields = ClientRegistrationFields::generate();
|
||||||
|
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted())
|
||||||
$company->subdomain = MultiDB::randomSubdomainGenerator();
|
$company->subdomain = MultiDB::randomSubdomainGenerator();
|
||||||
else
|
else
|
||||||
|
@ -96,6 +96,7 @@ class Company extends BaseModel
|
|||||||
'show_task_end_date',
|
'show_task_end_date',
|
||||||
'use_comma_as_decimal_place',
|
'use_comma_as_decimal_place',
|
||||||
'report_include_drafts',
|
'report_include_drafts',
|
||||||
|
'client_registration_fields',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
@ -111,6 +112,7 @@ class Company extends BaseModel
|
|||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'created_at' => 'timestamp',
|
'created_at' => 'timestamp',
|
||||||
'deleted_at' => 'timestamp',
|
'deleted_at' => 'timestamp',
|
||||||
|
'client_registration_fields' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [
|
||||||
|
@ -34,8 +34,8 @@ class InvoiceHistoryTransformer extends EntityTransformer
|
|||||||
return [
|
return [
|
||||||
'id' => '',
|
'id' => '',
|
||||||
'activity_id' => '',
|
'activity_id' => '',
|
||||||
'json_backup' => (string) '',
|
// 'json_backup' => (string) '',
|
||||||
'html_backup' => (string) '',
|
// 'html_backup' => (string) '',
|
||||||
'amount' => (float) 0,
|
'amount' => (float) 0,
|
||||||
'created_at' => (int) 0,
|
'created_at' => (int) 0,
|
||||||
'updated_at' => (int) 0,
|
'updated_at' => (int) 0,
|
||||||
@ -46,8 +46,8 @@ class InvoiceHistoryTransformer extends EntityTransformer
|
|||||||
return [
|
return [
|
||||||
'id' => $this->encodePrimaryKey($backup->id),
|
'id' => $this->encodePrimaryKey($backup->id),
|
||||||
'activity_id' => $this->encodePrimaryKey($backup->activity_id),
|
'activity_id' => $this->encodePrimaryKey($backup->activity_id),
|
||||||
'json_backup' => (string) $backup->json_backup ?: '',
|
// 'json_backup' => (string) $backup->json_backup ?: '',
|
||||||
'html_backup' => (string) $backup->html_backup ?: '',
|
// 'html_backup' => (string) $backup->html_backup ?: '',
|
||||||
'amount' => (float) $backup->amount,
|
'amount' => (float) $backup->amount,
|
||||||
'created_at' => (int) $backup->created_at,
|
'created_at' => (int) $backup->created_at,
|
||||||
'updated_at' => (int) $backup->updated_at,
|
'updated_at' => (int) $backup->updated_at,
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddRequiredClientRegistrationFields extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
$table->mediumText('client_registration_fields')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user