mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for update expenses
This commit is contained in:
parent
c8e2d94b3f
commit
73b3c11d80
@ -46,16 +46,7 @@ class UpdateExpenseRequest extends Request
|
||||
$rules['number'] = 'unique:expenses,number,'.$this->id.',id,company_id,'.$this->expense->company_id;
|
||||
}
|
||||
|
||||
$contacts = request('contacts');
|
||||
|
||||
if (is_array($contacts)) {
|
||||
// for ($i = 0; $i < count($contacts); $i++) {
|
||||
// // $rules['contacts.' . $i . '.email'] = 'nullable|email|unique:client_contacts,email,' . isset($contacts[$i]['id'].',company_id,'.$this->company_id);
|
||||
// //$rules['contacts.' . $i . '.email'] = 'nullable|email';
|
||||
// }
|
||||
}
|
||||
|
||||
return $rules;
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
public function messages()
|
||||
@ -72,6 +63,8 @@ class UpdateExpenseRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class StoreProjectRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
//$rules['name'] ='required|unique:projects,name,null,null,company_id,'.auth()->user()->companyId();
|
||||
$rules['name'] = 'required';
|
||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
@ -48,7 +47,6 @@ class StoreProjectRequest extends Request
|
||||
if (array_key_exists('client_id', $input) && is_string($input['client_id'])) {
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ class UpdateProjectRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('client_id', $input) && is_string($input['client_id'])) {
|
||||
unset($input['client_id']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class Request extends FormRequest
|
||||
|
||||
private function vendor_id($rules)
|
||||
{
|
||||
$rules['vendor_id'] = 'bail|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id;
|
||||
$rules['vendor_id'] = 'bail|nullable|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use Laracasts\Presenter\PresentableTrait;
|
||||
*/
|
||||
class Project extends BaseModel
|
||||
{
|
||||
// Expense Categories
|
||||
|
||||
use SoftDeletes;
|
||||
use PresentableTrait;
|
||||
use Filterable;
|
||||
|
@ -144,6 +144,9 @@ class CompanyTransformer extends EntityTransformer
|
||||
'enable_shop_api' => (bool) $company->enable_shop_api,
|
||||
'mark_expenses_invoiceable'=> (bool) $company->mark_expenses_invoiceable,
|
||||
'mark_expenses_paid' => (bool) $company->mark_expenses_paid,
|
||||
'invoice_expense_documents' => (bool) $company->invoice_expense_documents,
|
||||
'invoice_task_timelog' => (bool) $company->invoice_task_timelog,
|
||||
'auto_start_tasks' => (bool) $company->auto_start_tasks,
|
||||
'use_credits_payment' => (string) $company->use_credits_payment,
|
||||
];
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CompanyTableFields extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('companies', function(Blueprint $table){
|
||||
$table->boolean('invoice_task_timelog')->default(true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user