mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-17 10:04:35 -04:00
Add 'resume task' to task list actions
This commit is contained in:
parent
cf02cdc163
commit
a2e9d343f2
@ -253,11 +253,9 @@ class TaskController extends BaseController
|
||||
$action = Input::get('action');
|
||||
$ids = Input::get('public_id') ?: (Input::get('id') ?: Input::get('ids'));
|
||||
|
||||
if ($action == 'stop') {
|
||||
if (in_array($action, ['resume', 'stop'])) {
|
||||
$this->taskRepo->save($ids, ['action' => $action]);
|
||||
Session::flash('message', trans('texts.stopped_task'));
|
||||
|
||||
return Redirect::to('tasks');
|
||||
return Redirect::to('tasks')->withMessage(trans($action == 'stop' ? 'texts.stopped_task' : 'texts.resumed_task'));
|
||||
} elseif ($action == 'invoice' || $action == 'add_to_invoice') {
|
||||
$tasks = Task::scope($ids)->with('client')->orderBy('project_id', 'id')->get();
|
||||
$clientPublicId = false;
|
||||
|
@ -88,6 +88,15 @@ class TaskDatatable extends EntityDatatable
|
||||
return $model->invoice_number && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->invoice_user_id]);
|
||||
},
|
||||
],
|
||||
[
|
||||
trans('texts.resume_task'),
|
||||
function ($model) {
|
||||
return "javascript:submitForm_task('resume', {$model->public_id})";
|
||||
},
|
||||
function ($model) {
|
||||
return ! $model->is_running && Auth::user()->can('editByOwner', [ENTITY_TASK, $model->user_id]);
|
||||
},
|
||||
],
|
||||
[
|
||||
trans('texts.stop_task'),
|
||||
function ($model) {
|
||||
@ -103,7 +112,7 @@ class TaskDatatable extends EntityDatatable
|
||||
return "javascript:submitForm_task('invoice', {$model->public_id})";
|
||||
},
|
||||
function ($model) {
|
||||
return ! $model->invoice_number && (! $model->deleted_at || $model->deleted_at == '0000-00-00') && Auth::user()->can('create', ENTITY_INVOICE);
|
||||
return ! $model->is_running && ! $model->invoice_number && (! $model->deleted_at || $model->deleted_at == '0000-00-00') && Auth::user()->can('create', ENTITY_INVOICE);
|
||||
},
|
||||
],
|
||||
];
|
||||
|
@ -2252,6 +2252,8 @@ $LANG = array(
|
||||
'invoiceplane_import' => 'Use :link to migrate your data from InvoicePlane.',
|
||||
'duplicate_expense_warning' => 'Warning: This :link may be a duplicate',
|
||||
'expense_link' => 'expense',
|
||||
'resume_task' => 'Resume Task',
|
||||
'resumed_task' => 'Successfully resumed task',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user