mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
filter for recurring invoice filters
This commit is contained in:
parent
b43a4ec866
commit
4dedfd616b
@ -133,6 +133,10 @@ class RecurringInvoiceFilters extends QueryFilters
|
||||
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
|
||||
}
|
||||
|
||||
if($sort_col[0] == 'next_send_datetime'){
|
||||
$sort_col[0] = 'next_send_date';
|
||||
}
|
||||
|
||||
return $this->builder->orderBy($sort_col[0], $dir);
|
||||
}
|
||||
|
||||
|
@ -258,6 +258,16 @@ class ClientController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
if($action == 'bulk_update' && $user->can('edit', $clients->first())){
|
||||
|
||||
$clients = Client::withTrashed()
|
||||
->company()
|
||||
->whereIn('id', $request->ids);
|
||||
|
||||
$this->client_repo->bulkUpdate($clients, $request->column, $request->new_value);
|
||||
|
||||
}
|
||||
|
||||
$clients->each(function ($client) use ($action, $user) {
|
||||
if ($user->can('edit', $client)) {
|
||||
$this->client_repo->{$action}($client);
|
||||
|
@ -19,6 +19,17 @@ class BulkClientRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
private array $bulk_update_columns = [
|
||||
'public_notes',
|
||||
'industry_id',
|
||||
'size_id',
|
||||
'country_id',
|
||||
'custom_value1',
|
||||
'custom_value2',
|
||||
'custom_value3',
|
||||
'custom_value4',
|
||||
];
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
@ -35,12 +46,14 @@ class BulkClientRequest extends Request
|
||||
$user = auth()->user();
|
||||
|
||||
return [
|
||||
'action' => 'required|string|in:archive,restore,delete,template,assign_group',
|
||||
'action' => 'required|string|in:archive,restore,delete,template,assign_group,bulk_update',
|
||||
'ids' => ['required','bail','array',Rule::exists('clients', 'id')->where('company_id', $user->company()->id)],
|
||||
'template' => 'sometimes|string',
|
||||
'template_id' => 'sometimes|string',
|
||||
'group_settings_id' => ['required_if:action,assign_group',Rule::exists('group_settings', 'id')->where('company_id', $user->company()->id)],
|
||||
'send_email' => 'sometimes|bool'
|
||||
'send_email' => 'sometimes|bool',
|
||||
'column' => ['required_if:action,bulk_update','string', Rule::in($this->client_bulk_update_columns)],
|
||||
'new_value' => ['required_id:action,bulk_update|string'],
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -379,4 +379,9 @@ class BaseRepository
|
||||
|
||||
return $model->fresh();
|
||||
}
|
||||
|
||||
public function bulkUpdate(\Illuminate\Database\Eloquent\Builder $model, string $column, mixed $new_value) :void
|
||||
{
|
||||
$model->update([$column => $new_value]);
|
||||
}
|
||||
}
|
||||
|
@ -5296,6 +5296,8 @@ $lang = array(
|
||||
'flutter_web_warning' => 'We recommend using the new web app or the desktop app for the best performance',
|
||||
'rappen_rounding' => 'Rappen Rounding',
|
||||
'rappen_rounding_help' => 'Round amount to 5 cents',
|
||||
'always_show_required_fields' => 'Always display required fields',
|
||||
'always_show_required_fields_help' => 'Will show the form regards if the fields are filled or not'
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
Loading…
x
Reference in New Issue
Block a user