diff --git a/app/Http/Requests/Product/UpdateProductRequest.php b/app/Http/Requests/Product/UpdateProductRequest.php index cee8945b0453..a7b2e006080d 100644 --- a/app/Http/Requests/Product/UpdateProductRequest.php +++ b/app/Http/Requests/Product/UpdateProductRequest.php @@ -35,7 +35,7 @@ class UpdateProductRequest extends Request //when updating you need to ignore the column ID return [ - 'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(), + //'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(), 'cost' => 'numeric', 'price' => 'numeric', 'quantity' => 'numeric', diff --git a/app/Models/Company.php b/app/Models/Company.php index 9767210a4edb..84cd7cbed73a 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -51,8 +51,8 @@ class Company extends BaseModel 'city', 'state', 'postal_code', - 'work_phone', - 'work_email', + 'phone', + 'email', 'country_id', 'domain', 'vat_number', @@ -188,7 +188,7 @@ class Company extends BaseModel public function getLogo() { - return $this->logo ? config('ninja.site_url').$this->logo : ''; + return $this->logo ? config('ninja.site_url').$this->logo : null; } /** diff --git a/app/Models/Presenters/CompanyPresenter.php b/app/Models/Presenters/CompanyPresenter.php index fffd698c9ed8..146e6789d3c8 100644 --- a/app/Models/Presenters/CompanyPresenter.php +++ b/app/Models/Presenters/CompanyPresenter.php @@ -48,11 +48,11 @@ class CompanyPresenter extends EntityPresenter if ($country = $company->country) { $str .= e($country->name) . '
'; } - if ($company->work_phone) { - $str .= ctrans('texts.work_phone') . ": ". e($company->work_phone) .'
'; + if ($company->phone) { + $str .= ctrans('texts.work_phone') . ": ". e($company->phone) .'
'; } - if ($company->work_email) { - $str .= ctrans('texts.work_email') . ": ". e($company->work_email) .'
'; + if ($company->email) { + $str .= ctrans('texts.work_email') . ": ". e($company->email) .'
'; } return $str; diff --git a/app/Models/User.php b/app/Models/User.php index cbbbccf639e7..ee4443ebd3c3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -61,8 +61,8 @@ class User extends Authenticatable implements MustVerifyEmail protected $fillable = [ 'first_name', 'last_name', - 'email', - 'phone', + // 'email', + // 'phone', 'signature', 'avatar', 'accepted_terms_version', @@ -89,6 +89,7 @@ class User extends Authenticatable implements MustVerifyEmail 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', + 'last_login' => 'timestamp', ]; public function getHashedIdAttribute() diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php index 8427cd43d7f9..8ffcf2669033 100644 --- a/app/Transformers/ClientTransformer.php +++ b/app/Transformers/ClientTransformer.php @@ -1,3 +1,4 @@ + (float) $client->balance, 'currency_id' => (string)$client->currency_id ?: '', 'paid_to_date' => (float) $client->paid_to_date, - 'last_login' => $client->last_login ?: '', + 'last_login' => (int)$client->last_login, 'address1' => $client->address1 ?: '', 'address2' => $client->address2 ?: '', 'city' => $client->city ?: '', @@ -81,7 +82,6 @@ class ClientTransformer extends EntityTransformer 'shipping_country_id' => $client->shipping_country_id ?: '', 'settings' => $client->settings ?: '', 'is_deleted' => (bool) $client->is_deleted, - 'payment_terms' => (int) $client->payment_terms, 'vat_number' => $client->vat_number ?: '', 'id_number' => $client->id_number ?: '', 'updated_at' => $client->updated_at, diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index f26addffbde1..be5f256a2ea4 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -66,6 +66,7 @@ class CompanyTransformer extends EntityTransformer return [ 'id' => (string)$this->encodePrimaryKey($company->id), 'name' => (string)$company->name ?: '', + 'website' => (string)$company->website ?: '', 'logo_url' => (string)$company->getLogo(), 'company_key' => (string)$company->company_key ?: '', 'address1' => (string)$company->address1 ?: '', @@ -73,8 +74,8 @@ class CompanyTransformer extends EntityTransformer 'city' => (string)$company->city ?: '', 'state' => (string)$company->state ?: '', 'postal_code' => (string)$company->postal_code ?: '', - 'work_phone' => (string)$company->work_phone ?: '', - 'work_email' => (string)$company->work_email ?: '', + 'phone' => (string)$company->phone ?: '', + 'email' => (string)$company->email ?: '', 'country_id' => (string) $company->country_id ?: '', 'vat_number' => (string)$company->vat_number ?: '', 'id_number' => (string)$company->id_number ?: '', diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index f94e0957f200..1701680155c3 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -109,7 +109,7 @@ trait MakesInvoiceValues 'credit_issued_to', 'credit_to', 'your_credit', - 'work_phone', + 'phone', 'invoice_total', 'outstanding', 'invoice_due_date', @@ -212,8 +212,8 @@ trait MakesInvoiceValues $data['$company_state'] = $this->company->state; $data['$company_postal_code'] = $this->company->postal_code; $data['$company_country'] = $this->company->country ? $this->company->country->name : ''; - $data['$company_phone'] = $this->company->work_phone; - $data['$company_email'] = $this->company->work_email; + $data['$company_phone'] = $this->company->phone; + $data['$company_email'] = $this->company->email; $data['$company_vat_number'] = $this->company->vat_number; $data['$company_id_number'] = $this->company->id_number; $data['$company_address'] = $this->company->present()->address(); @@ -234,7 +234,7 @@ trait MakesInvoiceValues $data['$credit_issued_to'] = ; $data['$credit_to'] = ; $data['$your_credit'] = ; - $data['$work_phone'] = ; + $data['$phone'] = ; $data['$invoice_total'] = ; $data['$outstanding'] = ; $data['$invoice_due_date'] = ; diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index 67727aab660d..a162517f2174 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -16,8 +16,8 @@ $factory->define(App\Models\Company::class, function (Faker $faker) { 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => 4, - 'work_phone' => $faker->phoneNumber, - 'work_email' => $faker->safeEmail, + 'phone' => $faker->phoneNumber, + 'email' => $faker->safeEmail, 'logo' => 'https://www.invoiceninja.com/wp-content/themes/invoice-ninja/images/logo.png', ]; }); diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 2db03c80dd05..edf1bae5cc30 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -138,8 +138,8 @@ class CreateUsersTable extends Migration $table->string('city')->nullable(); $table->string('state')->nullable(); $table->string('postal_code')->nullable(); - $table->string('work_phone')->nullable(); - $table->string('work_email')->nullable(); + $table->string('phone')->nullable(); + $table->string('email')->nullable(); $table->unsignedInteger('country_id')->nullable(); $table->string('domain')->nullable(); $table->string('db')->nullable(); @@ -807,6 +807,7 @@ class CreateUsersTable extends Migration $table->unsignedInteger('bank_company_id'); $table->string('account_name')->nullable(); + $table->string('website')->nullable(); $table->string('account_number')->nullable(); $table->timestamps(6);