1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #8302 from turbo124/v5-develop

Limit per page to 5000
This commit is contained in:
David Bomba 2023-02-24 08:13:02 +11:00 committed by GitHub
commit b1cef2900b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 3 deletions

View File

@ -463,7 +463,7 @@ class CompanySettings extends BaseSettings
public $accept_client_input_quote_approval = false;
public $allow_billable_task_items = false;
public $allow_billable_task_items = true;
public $show_task_item_description = false;

View File

@ -88,4 +88,25 @@ class UserFilters extends QueryFilters
->orderByRaw("{$this->with_property} = ? DESC", [$value])
->where('account_id', auth()->user()->account_id);
}
/**
* Exclude a list of user_ids, can pass multiple
* user IDs by separating them with a comma.
*
* @param string $user_id
* @return Builder
*/
public function without(string $user_id = ''): Builder
{
if (strlen($user_id) == 0) {
return $this->builder;
}
$user_array = $this->transformKeys(explode(',', $user_id));
return $this->builder->where(function ($query) use ($user_array) {
$query->whereNotIn('id', $user_array)
->where('account_id', auth()->user()->account_id);
});
}
}

View File

@ -555,7 +555,8 @@ class BaseController extends Controller
private function resolveQueryLimit(): int
{
if (request()->has('per_page')) {
return abs((int)request()->input('per_page', 20));
return min(abs((int)request()->input('per_page', 20)), 5000);
// return abs((int)request()->input('per_page', 20));
}
return 20;

View File

@ -5000,7 +5000,8 @@ $LANG = array(
'sync_from' => 'Sync From',
'gateway_payment_text' => 'Invoices: :invoices for :amount for client :client',
'gateway_payment_text_no_invoice' => 'Payment with no invoice for amount :amount for client :client',
'click_to_variables' => 'Client here to see all variables.',
'ship_to' => 'Ship to',
);