Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/FOUR-21804: Error 404 on Available Columns in Launchpad settings #7992

Merged
merged 8 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions ProcessMaker/Http/Controllers/ProcessesCatalogueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +26,7 @@
class ProcessesCatalogueController extends Controller
{
use HasControllerAddons;
use TaskControllerIndexMethods;

public function index(Request $request, Process $process = null)
{
Expand Down Expand Up @@ -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;
}
}
6 changes: 5 additions & 1 deletion ProcessMaker/Http/Controllers/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 = '')
Expand Down
23 changes: 23 additions & 0 deletions ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ProcessMaker\Traits;

use Auth;
use DB;
use Illuminate\Database\QueryException;
use Illuminate\Support\Arr;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}
Loading
Loading