mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:24: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',
|
'method' => 'POST',
|
||||||
'url' => 'credits',
|
'url' => 'credits',
|
||||||
'title' => trans('texts.new_credit'),
|
'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);
|
return View::make('credits.edit', $data);
|
||||||
|
@ -94,7 +94,6 @@ class PaymentController extends BaseController
|
|||||||
public function create(PaymentRequest $request)
|
public function create(PaymentRequest $request)
|
||||||
{
|
{
|
||||||
$invoices = Invoice::scope()
|
$invoices = Invoice::scope()
|
||||||
->viewable()
|
|
||||||
->invoiceType(INVOICE_TYPE_STANDARD)
|
->invoiceType(INVOICE_TYPE_STANDARD)
|
||||||
->where('is_recurring', '=', false)
|
->where('is_recurring', '=', false)
|
||||||
->where('invoices.balance', '>', 0)
|
->where('invoices.balance', '>', 0)
|
||||||
@ -111,7 +110,7 @@ class PaymentController extends BaseController
|
|||||||
'url' => 'payments',
|
'url' => 'payments',
|
||||||
'title' => trans('texts.new_payment'),
|
'title' => trans('texts.new_payment'),
|
||||||
'paymentTypeId' => Input::get('paymentTypeId'),
|
'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);
|
return View::make('payments.edit', $data);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class QuoteController extends BaseController
|
|||||||
'taxRateOptions' => $options,
|
'taxRateOptions' => $options,
|
||||||
'defaultTax' => $defaultTax,
|
'defaultTax' => $defaultTax,
|
||||||
'countries' => Cache::get('countries'),
|
'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(),
|
'taxRates' => TaxRate::scope()->orderBy('name')->get(),
|
||||||
'currencies' => Cache::get('currencies'),
|
'currencies' => Cache::get('currencies'),
|
||||||
'sizes' => Cache::get('sizes'),
|
'sizes' => Cache::get('sizes'),
|
||||||
|
@ -213,7 +213,7 @@ class TaskController extends BaseController
|
|||||||
private static function getViewModel()
|
private static function getViewModel()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -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')) {
|
if (Auth::check() && ! Auth::user()->hasPermission('view_all')) {
|
||||||
$query->where($this->getEntityType(). 's.user_id', '=', Auth::user()->id);
|
$query->where($this->getEntityType(). 's.user_id', '=', Auth::user()->id);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class UserTableSeeder extends Seeder
|
|||||||
'account_id' => $account->id,
|
'account_id' => $account->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'public_id' => 1,
|
'public_id' => 1,
|
||||||
'email' => TEST_USERNAME,
|
'email' => env('TEST_EMAIL', TEST_USERNAME),
|
||||||
'is_primary' => true,
|
'is_primary' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user