From 3b178595de4f2798eae2190c2614720fb85ada1e Mon Sep 17 00:00:00 2001 From: CamilleBeau Date: Tue, 23 Nov 2021 13:49:55 -0500 Subject: [PATCH 1/3] [bvl_feedback][dashboard] Add project/site specs to widget --- modules/bvl_feedback/php/module.class.inc | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/bvl_feedback/php/module.class.inc b/modules/bvl_feedback/php/module.class.inc index 31f3868eb05..47760c148f0 100644 --- a/modules/bvl_feedback/php/module.class.inc +++ b/modules/bvl_feedback/php/module.class.inc @@ -68,16 +68,31 @@ class Module extends \Module $last_login = $user->getLastLogin($DB); - $bvl_feedback = $DB->pselect( - "SELECT fbt.Name, fbe.Testdate, fbe.Comment, fbth.FieldName, + // Base query + $query = "SELECT fbt.Name, fbe.Testdate, fbe.Comment, fbth.FieldName, fbth.CommentID, fbth.SessionID, fbth.CandID, fbth.Feedback_level FROM feedback_bvl_entry fbe JOIN feedback_bvl_thread fbth USING (FeedbackID) JOIN feedback_bvl_type fbt USING (Feedback_type) - WHERE fbth.Status='opened' AND fbth.Active='Y' - ORDER BY Testdate DESC LIMIT 4", - [] + JOIN session s ON s.ID=fbth.SessionID + WHERE fbth.Status='opened' AND fbth.Active='Y'"; + + // Add centerID restriction if needed + if (!$user->hasPermission('access_all_profiles')) { + $site_arr = implode(",",$user->getCenterIDs()); + $query .= " AND s.CenterID IN ({$site_arr}) "; + } + + // Add project restriction & order BY + $project_arr = implode(",",$user->getProjectIDs()); + $query .= " AND s.ProjectID IN ({$project_arr}) + ORDER BY Testdate DESC LIMIT 4"; + + $bvl_feedback = $DB->pselect( + $query, + array() ); + $frontend_feedback = []; foreach ($bvl_feedback as $row) { if (new \DateTime($row['Testdate']) > $last_login) { From 50e8ff2de55b2ba710661f1dc977987689688959 Mon Sep 17 00:00:00 2001 From: CamilleBeau Date: Tue, 23 Nov 2021 13:56:38 -0500 Subject: [PATCH 2/3] Change log & phpcs --- CHANGELOG.md | 1 + modules/bvl_feedback/php/module.class.inc | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d6f16e4c4..918e1438d55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,6 +121,7 @@ multi-echo aquisitions (PR #7515). from the `psc` table. The default value of `CenterID` is `NULL`. Previously, the default for `Center_name` was `AAAA` or `ZZZZ`. (PR #7525) - The statistics displayed in the dashboard was changed to only show the data relevant to the user's site(s). (PR #8132) +- BVL Feedback widget only shows notifications for the users sites / projects (PR #7848) #### Bug Fixes - A LINST instrument Date field name now appears correctly (not truncated) on the diff --git a/modules/bvl_feedback/php/module.class.inc b/modules/bvl_feedback/php/module.class.inc index 47760c148f0..c02c9351f4d 100644 --- a/modules/bvl_feedback/php/module.class.inc +++ b/modules/bvl_feedback/php/module.class.inc @@ -79,18 +79,18 @@ class Module extends \Module // Add centerID restriction if needed if (!$user->hasPermission('access_all_profiles')) { - $site_arr = implode(",",$user->getCenterIDs()); - $query .= " AND s.CenterID IN ({$site_arr}) "; + $site_arr = implode(",", $user->getCenterIDs()); + $query .= " AND s.CenterID IN ({$site_arr}) "; } // Add project restriction & order BY - $project_arr = implode(",",$user->getProjectIDs()); - $query .= " AND s.ProjectID IN ({$project_arr}) + $project_arr = implode(",", $user->getProjectIDs()); + $query .= " AND s.ProjectID IN ({$project_arr}) ORDER BY Testdate DESC LIMIT 4"; - $bvl_feedback = $DB->pselect( + $bvl_feedback = $DB->pselect( $query, - array() + [] ); $frontend_feedback = []; From d1aefdd0931883604217170d7dcd1990c7eaa86b Mon Sep 17 00:00:00 2001 From: CamilleBeau Date: Mon, 12 Dec 2022 11:44:59 -0500 Subject: [PATCH 3/3] Fix changelog --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 918e1438d55..9c65b86da8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ changes in the following format: PR #1234*** - Rename subproject to Cohort (PR #7817) - Create new CohortData and CohortController classes to use as data access model and transfer object (PR #7817) -- +- BVL Feedback widget only shows notifications for the users sites / projects (PR #7848) #### Bug Fixes - placeholder @@ -121,7 +121,6 @@ multi-echo aquisitions (PR #7515). from the `psc` table. The default value of `CenterID` is `NULL`. Previously, the default for `Center_name` was `AAAA` or `ZZZZ`. (PR #7525) - The statistics displayed in the dashboard was changed to only show the data relevant to the user's site(s). (PR #8132) -- BVL Feedback widget only shows notifications for the users sites / projects (PR #7848) #### Bug Fixes - A LINST instrument Date field name now appears correctly (not truncated) on the