Skip to content

Commit 300e2d2

Browse files
NateWrasmecher
authored andcommitted
pkp/pkp-lib#7191 Fix use of subeditor assignments method
1 parent 2805c14 commit 300e2d2

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

classes/press/Series.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
namespace APP\press;
1919

2020
use APP\core\Application;
21+
use APP\facades\Repo;
2122
use PKP\context\PKPSection;
2223
use PKP\context\SubEditorsDAO;
2324
use PKP\db\DAORegistry;
25+
use stdClass;
2426

2527
class Series extends PKPSection
2628
{
@@ -326,7 +328,16 @@ public function setSortOption($sortOption)
326328
public function getEditorsString()
327329
{
328330
$subEditorsDao = DAORegistry::getDAO('SubEditorsDAO'); /** @var SubEditorsDAO $subEditorsDao */
329-
$editors = $subEditorsDao->getBySubmissionGroupIds([$this->getId()], Application::ASSOC_TYPE_SECTION, $this->getPressId());
331+
$assignments = $subEditorsDao->getBySubmissionGroupIds([$this->getId()], Application::ASSOC_TYPE_SECTION, $this->getPressId());
332+
$editors = Repo::user()
333+
->getCollector()
334+
->filterByUserIds(
335+
$assignments
336+
->map(fn (stdClass $assignment) => $assignment->userId)
337+
->filter()
338+
->toArray()
339+
)
340+
->getMany();
330341

331342
$separator = ', ';
332343
$str = '';

controllers/grid/settings/series/SeriesGridHandler.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use APP\controllers\grid\settings\series\form\SeriesForm;
1919
use APP\core\Application;
20+
use APP\facades\Repo;
2021
use APP\notification\NotificationManager;
2122
use PKP\context\SubEditorsDAO;
2223
use PKP\controllers\grid\feature\OrderGridItemsFeature;
@@ -28,6 +29,7 @@
2829
use PKP\linkAction\LinkAction;
2930
use PKP\linkAction\request\AjaxModal;
3031
use PKP\security\Role;
32+
use stdClass;
3133

3234
class SeriesGridHandler extends SetupGridHandler
3335
{
@@ -81,7 +83,16 @@ public function initialize($request, $args = null)
8183
}
8284

8385
// Get the series editors data for the row
84-
$assignedSeriesEditors = $subEditorsDao->getBySubmissionGroupIds([$series->getId()], Application::ASSOC_TYPE_SECTION, $press->getId());
86+
$assignments = $subEditorsDao->getBySubmissionGroupIds([$series->getId()], Application::ASSOC_TYPE_SECTION, $press->getId());
87+
$assignedSeriesEditors = Repo::user()
88+
->getCollector()
89+
->filterByUserIds(
90+
$assignments
91+
->map(fn (stdClass $assignment) => $assignment->userId)
92+
->filter()
93+
->toArray()
94+
)
95+
->getMany();
8596
if ($assignedSeriesEditors->empty()) {
8697
$editorsString = __('common.none');
8798
} else {

0 commit comments

Comments
 (0)