mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Set unique on Group Settings Name
This commit is contained in:
parent
f5eecf0eb6
commit
3083ab6237
@ -51,23 +51,13 @@ class SystemLogFilters extends QueryFilters
|
||||
*/
|
||||
public function filter(string $filter = '') : Builder
|
||||
{
|
||||
|
||||
if (strlen($filter) == 0) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
return $this->builder;
|
||||
|
||||
// return $this->builder->where(function ($query) use ($filter) {
|
||||
// $query->where('vendors.name', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendors.id_number', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendor_contacts.first_name', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendor_contacts.email', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%')
|
||||
// ->orWhere('vendors.custom_value4', 'like', '%'.$filter.'%');
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,8 +92,6 @@ class SystemLogFilters extends QueryFilters
|
||||
*/
|
||||
public function entityFilter()
|
||||
{
|
||||
|
||||
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
||||
return $this->builder->company();
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,10 @@ class SystemLogController extends BaseController
|
||||
{
|
||||
$system_logs = SystemLog::filter($filters);
|
||||
|
||||
return $this->listResponse($system_logs);
|
||||
if(auth()->user()->isAdmin())
|
||||
return $this->listResponse($system_logs);
|
||||
|
||||
return $this->listResponse(SystemLog::query());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,9 @@ class StoreGroupSettingRequest extends Request
|
||||
|
||||
public function rules()
|
||||
{
|
||||
$rules['name'] = 'required';
|
||||
|
||||
$rules['name'] = 'required|unique:group_settings,name,null,null,company_id,'.auth()->user()->companyId();
|
||||
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
|
||||
return $rules;
|
||||
|
@ -34,6 +34,8 @@ class UpdateGroupSettingRequest extends Request
|
||||
{
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
|
||||
$rules['name'] = 'unique:group_settings,name,'.$this->id.',id,company_id,'.$this->group_setting->company_id;
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class GroupSettingTest extends TestCase
|
||||
$settings->currency_id = 1;
|
||||
|
||||
$data = [
|
||||
'name' => 'test',
|
||||
'name' => 'testX',
|
||||
'settings' => $settings,
|
||||
];
|
||||
|
||||
@ -50,7 +50,7 @@ class GroupSettingTest extends TestCase
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals('test', $arr['data']['name']);
|
||||
$this->assertEquals('testX', $arr['data']['name']);
|
||||
$this->assertEquals(0, $arr['data']['archived_at']);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class GroupSettingTest extends TestCase
|
||||
$settings->currency_id = 1;
|
||||
|
||||
$data = [
|
||||
'name' => 'test',
|
||||
'name' => 'testY',
|
||||
'settings' => $settings,
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user