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 =
|
||||
[
|
||||
[
|
||||
'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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
@ -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 = [
|
||||
|
@ -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,
|
||||
|
@ -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