mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 17:34:29 -04:00
Made 'viewable' scope default behavior
This commit is contained in:
parent
c339c66623
commit
0dc9b3fceb
@ -62,7 +62,7 @@ class CreditController extends BaseController
|
||||
'method' => 'POST',
|
||||
'url' => 'credits',
|
||||
'title' => trans('texts.new_credit'),
|
||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('credits.edit', $data);
|
||||
|
@ -94,7 +94,6 @@ class PaymentController extends BaseController
|
||||
public function create(PaymentRequest $request)
|
||||
{
|
||||
$invoices = Invoice::scope()
|
||||
->viewable()
|
||||
->invoiceType(INVOICE_TYPE_STANDARD)
|
||||
->where('is_recurring', '=', false)
|
||||
->where('invoices.balance', '>', 0)
|
||||
@ -111,7 +110,7 @@ class PaymentController extends BaseController
|
||||
'url' => 'payments',
|
||||
'title' => trans('texts.new_payment'),
|
||||
'paymentTypeId' => Input::get('paymentTypeId'),
|
||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(), ];
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ];
|
||||
|
||||
return View::make('payments.edit', $data);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class QuoteController extends BaseController
|
||||
'taxRateOptions' => $options,
|
||||
'defaultTax' => $defaultTax,
|
||||
'countries' => Cache::get('countries'),
|
||||
'clients' => Client::scope()->viewable()->with('contacts', 'country')->orderBy('name')->get(),
|
||||
'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(),
|
||||
'taxRates' => TaxRate::scope()->orderBy('name')->get(),
|
||||
'currencies' => Cache::get('currencies'),
|
||||
'sizes' => Cache::get('sizes'),
|
||||
|
@ -213,7 +213,7 @@ class TaskController extends BaseController
|
||||
private static function getViewModel()
|
||||
{
|
||||
return [
|
||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
'account' => Auth::user()->account,
|
||||
];
|
||||
}
|
||||
@ -302,7 +302,7 @@ class TaskController extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function checkTimezone()
|
||||
{
|
||||
if (!Auth::user()->account->timezone) {
|
||||
|
@ -121,15 +121,6 @@ class EntityModel extends Eloquent
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function scopeViewable($query)
|
||||
{
|
||||
if (Auth::check() && ! Auth::user()->hasPermission('view_all')) {
|
||||
$query->where($this->getEntityType(). 's.user_id', '=', Auth::user()->id);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class UserTableSeeder extends Seeder
|
||||
'account_id' => $account->id,
|
||||
'client_id' => $client->id,
|
||||
'public_id' => 1,
|
||||
'email' => TEST_USERNAME,
|
||||
'email' => env('TEST_EMAIL', TEST_USERNAME),
|
||||
'is_primary' => true,
|
||||
]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user