diff --git a/ProcessMaker/Http/Controllers/ProcessesCatalogueController.php b/ProcessMaker/Http/Controllers/ProcessesCatalogueController.php index f80fef8b9b..b55c89698b 100644 --- a/ProcessMaker/Http/Controllers/ProcessesCatalogueController.php +++ b/ProcessMaker/Http/Controllers/ProcessesCatalogueController.php @@ -15,6 +15,7 @@ use ProcessMaker\Models\ProcessLaunchpad; use ProcessMaker\Package\SavedSearch\Models\SavedSearch; use ProcessMaker\Traits\HasControllerAddons; +use ProcessMaker\Traits\TaskControllerIndexMethods; /** * @param Request $request @@ -25,6 +26,7 @@ class ProcessesCatalogueController extends Controller { use HasControllerAddons; + use TaskControllerIndexMethods; public function index(Request $request, Process $process = null) { @@ -54,23 +56,4 @@ public function index(Request $request, Process $process = null) return view('processes-catalogue.index', compact('process', 'currentUser', 'manager', 'userConfiguration', 'defaultSavedSearch')); } - - /** - * Get the ID of the default saved search for tasks. - * - * @return int|null - */ - private function getDefaultSavedSearchId() - { - $id = null; - if (class_exists(SavedSearch::class)) { - $savedSearch = SavedSearch::firstSystemSearchFor( - Auth::user(), - SavedSearch::KEY_TASKS, - ); - $id = $savedSearch->id; - } - - return $id; - } } diff --git a/ProcessMaker/Http/Controllers/TaskController.php b/ProcessMaker/Http/Controllers/TaskController.php index 04b14ce302..5179230de5 100755 --- a/ProcessMaker/Http/Controllers/TaskController.php +++ b/ProcessMaker/Http/Controllers/TaskController.php @@ -28,11 +28,13 @@ use ProcessMaker\Nayra\Contracts\Bpmn\ScriptTaskInterface; use ProcessMaker\Traits\HasControllerAddons; use ProcessMaker\Traits\SearchAutocompleteTrait; +use ProcessMaker\Traits\TaskControllerIndexMethods; class TaskController extends Controller { use SearchAutocompleteTrait; use HasControllerAddons; + use TaskControllerIndexMethods; private static $dueLabels = [ 'open' => 'Due', @@ -66,7 +68,9 @@ public function index() $currentUser = Auth::user(); - return view('tasks.index', compact('title', 'userFilter', 'defaultColumns', 'taskDraftsEnabled', 'userConfiguration', 'showOldTaskScreen', 'currentUser', 'selectedProcess')); + $defaultSavedSearchId = $this->getDefaultSavedSearchId(); + + return view('tasks.index', compact('title', 'userFilter', 'defaultColumns', 'taskDraftsEnabled', 'userConfiguration', 'showOldTaskScreen', 'currentUser', 'selectedProcess', 'defaultSavedSearchId')); } public function edit(ProcessRequestToken $task, string $preview = '') diff --git a/ProcessMaker/Traits/TaskControllerIndexMethods.php b/ProcessMaker/Traits/TaskControllerIndexMethods.php index d0a351478f..4d02caf314 100644 --- a/ProcessMaker/Traits/TaskControllerIndexMethods.php +++ b/ProcessMaker/Traits/TaskControllerIndexMethods.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Traits; +use Auth; use DB; use Illuminate\Database\QueryException; use Illuminate\Support\Arr; @@ -12,6 +13,7 @@ use ProcessMaker\Models\ProcessRequest; use ProcessMaker\Models\ProcessRequestToken; use ProcessMaker\Models\User; +use ProcessMaker\Package\SavedSearch\Models\SavedSearch; use ProcessMaker\Query\SyntaxError; trait TaskControllerIndexMethods @@ -347,4 +349,25 @@ public function applyProcessManager($query, $user) ->where('process_request_tokens.status', 'ACTIVE'); }); } + + /** + * Get the ID of the default saved search for tasks. + * + * @return int|null + */ + private function getDefaultSavedSearchId() + { + $id = null; + if (class_exists(SavedSearch::class)) { + $savedSearch = SavedSearch::firstSystemSearchFor( + Auth::user(), + SavedSearch::KEY_TASKS, + ); + if ($savedSearch) { + $id = $savedSearch->id; + } + } + + return $id; + } } diff --git a/resources/js/components/shared/LaunchpadSettingsModal.vue b/resources/js/components/shared/LaunchpadSettingsModal.vue index 10dda3e785..165a8a135c 100755 --- a/resources/js/components/shared/LaunchpadSettingsModal.vue +++ b/resources/js/components/shared/LaunchpadSettingsModal.vue @@ -10,17 +10,18 @@ :custom-buttons="customModalButtons" @saveModal="saveModal" @closeModal="closeModal" - > + >