mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add projects to all entities - fixes for gateway casts
This commit is contained in:
parent
60c29a95c9
commit
3dca6ff171
@ -25,6 +25,7 @@ use App\Repositories\ProjectRepository;
|
||||
use App\Transformers\ProjectTransformer;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
@ -34,6 +35,7 @@ use Illuminate\Support\Facades\Cache;
|
||||
class ProjectController extends BaseController
|
||||
{
|
||||
use MakesHash;
|
||||
use SavesDocuments;
|
||||
|
||||
protected $entity_type = Project::class;
|
||||
|
||||
|
@ -33,7 +33,7 @@ class StoreProjectRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
//$rules['name'] ='required|unique:projects,name,null,null,company_id,'.auth()->user()->companyId();
|
||||
$rules['name'] ='required|unique:projects,name,null,null,company_id,'.auth()->user()->companyId();
|
||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
return $rules;
|
||||
|
@ -40,6 +40,7 @@ class Credit extends BaseModel
|
||||
|
||||
protected $fillable = [
|
||||
'assigned_user_id',
|
||||
'project_id',
|
||||
'number',
|
||||
'discount',
|
||||
'po_number',
|
||||
|
@ -43,6 +43,7 @@ class Expense extends BaseModel
|
||||
'tax_name3',
|
||||
'payment_date',
|
||||
'payment_type_id',
|
||||
'project_id',
|
||||
'transaction_reference',
|
||||
'invoice_documents',
|
||||
'should_be_invoiced',
|
||||
|
@ -25,7 +25,8 @@ class Gateway extends StaticModel
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'default_gateway_type_id' => 'string',
|
||||
'fields' => 'json',
|
||||
// 'fields' => 'json',
|
||||
'fields' => 'object',
|
||||
'options' => 'array',
|
||||
];
|
||||
|
||||
@ -35,21 +36,21 @@ class Gateway extends StaticModel
|
||||
|
||||
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @deprecated 5.0.17 No longer needs as we are removing omnipay dependence
|
||||
*/
|
||||
public function getFields()
|
||||
{
|
||||
if ($this->isCustom()) {
|
||||
return [
|
||||
'name' => '',
|
||||
'text' => '',
|
||||
];
|
||||
} else {
|
||||
return Omnipay::create($this->provider)->getDefaultParameters();
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * @return mixed
|
||||
// * @deprecated 5.0.17 No longer needs as we are removing omnipay dependence
|
||||
// */
|
||||
// public function getFields()
|
||||
// {
|
||||
// if ($this->isCustom()) {
|
||||
// return [
|
||||
// 'name' => '',
|
||||
// 'text' => '',
|
||||
// ];
|
||||
// } else {
|
||||
// return Omnipay::create($this->provider)->getDefaultParameters();
|
||||
// }
|
||||
// }
|
||||
|
||||
public function getOptionsAttribute()
|
||||
{
|
||||
|
@ -86,6 +86,7 @@ class Invoice extends BaseModel
|
||||
'footer',
|
||||
'partial',
|
||||
'partial_due_date',
|
||||
'project_id',
|
||||
'custom_value1',
|
||||
'custom_value2',
|
||||
'custom_value3',
|
||||
|
@ -54,6 +54,7 @@ class Quote extends BaseModel
|
||||
'terms',
|
||||
'public_notes',
|
||||
'private_notes',
|
||||
'project_id',
|
||||
'invoice_type_id',
|
||||
'tax_name1',
|
||||
'tax_rate1',
|
||||
|
@ -63,6 +63,7 @@ class RecurringInvoice extends BaseModel
|
||||
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'project_id',
|
||||
'number',
|
||||
'discount',
|
||||
'is_amount_discount',
|
||||
|
@ -84,6 +84,7 @@ class CreditTransformer extends EntityTransformer
|
||||
return [
|
||||
'id' => $this->encodePrimaryKey($credit->id),
|
||||
'user_id' => $this->encodePrimaryKey($credit->user_id),
|
||||
'project_id' => $this->encodePrimaryKey($credit->project_id),
|
||||
'assigned_user_id' => $this->encodePrimaryKey($credit->assigned_user_id),
|
||||
'amount' => (float) $credit->amount,
|
||||
'balance' => (float) $credit->balance,
|
||||
|
@ -87,6 +87,7 @@ class ExpenseTransformer extends EntityTransformer
|
||||
'updated_at' => (int) $expense->updated_at,
|
||||
'archived_at' => (int) $expense->deleted_at,
|
||||
'created_at' => (int) $expense->created_at,
|
||||
'project_id' => $this->encodePrimaryKey($expense->project_id),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ class InvoiceTransformer extends EntityTransformer
|
||||
return [
|
||||
'id' => $this->encodePrimaryKey($invoice->id),
|
||||
'user_id' => $this->encodePrimaryKey($invoice->user_id),
|
||||
'project_id' => $this->encodePrimaryKey($invoice->project_id),
|
||||
'assigned_user_id' => $this->encodePrimaryKey($invoice->assigned_user_id),
|
||||
'amount' => (float) $invoice->amount,
|
||||
'balance' => (float) $invoice->balance,
|
||||
|
@ -137,6 +137,7 @@ class QuoteTransformer extends EntityTransformer
|
||||
'line_items' => $quote->line_items ?: (array) [],
|
||||
'entity_type' => 'quote',
|
||||
'exchange_rate' => (float) $quote->exchange_rate,
|
||||
'project_id' => $this->encodePrimaryKey($quote->project_id),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
||||
return [
|
||||
'id' => $this->encodePrimaryKey($invoice->id),
|
||||
'user_id' => $this->encodePrimaryKey($invoice->user_id),
|
||||
'project_id' => $this->encodePrimaryKey($invoice->project_id),
|
||||
'assigned_user_id' => $this->encodePrimaryKey($invoice->assigned_user_id),
|
||||
'amount' => (float) $invoice->amount,
|
||||
'balance' => (float) $invoice->balance,
|
||||
|
@ -90,7 +90,7 @@ class CreateUsersTable extends Migration
|
||||
$table->string('site_url', 200)->nullable();
|
||||
$table->boolean('is_offsite')->default(false);
|
||||
$table->boolean('is_secure')->default(false);
|
||||
$table->mediumText('fields')->nullable();
|
||||
$table->longText('fields')->nullable();
|
||||
$table->unsignedInteger('default_gateway_type_id')->default(1);
|
||||
$table->timestamps(6);
|
||||
});
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ProjectIdsToEntities extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->unsignedInteger('project_id')->nullable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user