Skip to content

Commit cb45405

Browse files
authored
Merge pull request #1164 from bozana/11887
pkp/pkp-lib#11887 list all submissions on the DOIs management page
2 parents 7f08a4e + c4b918d commit cb45405

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

classes/submission/Collector.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use APP\core\Application;
1818
use APP\facades\Repo;
19+
use APP\publication\Publication;
1920
use Illuminate\Database\Query\Builder;
2021

2122
class Collector extends \PKP\submission\Collector
@@ -104,6 +105,41 @@ protected function addHasDoisFilterToQuery(Builder $q)
104105
});
105106
}
106107

108+
/**
109+
* APP-specific filtering for submissions that should be listed on the DOI management page.
110+
* Those are:
111+
* submissions in the workflow production stage,
112+
* submissions that have a published publication, and
113+
* submissions whose sub objects have a DOI.
114+
*/
115+
protected function addOnDoiPageFilterToQuery(Builder $q)
116+
{
117+
$q->where(function (Builder $q) {
118+
$q->whereIn('s.stage_id', [WORKFLOW_STAGE_ID_PRODUCTION])
119+
->orWhereIn('s.submission_id', function (Builder $q) {
120+
$q->select('pOnDoiPage.submission_id')
121+
->from('publications as pOnDoiPage')
122+
->where('pOnDoiPage.status', '=', Publication::STATUS_PUBLISHED);
123+
$q->when(in_array(Repo::doi()::TYPE_PUBLICATION, $this->enabledDoiTypes), function (Builder $q) {
124+
$q->orWhereNotNull('pOnDoiPage.doi_id');
125+
});
126+
$q->when(in_array(Repo::doi()::TYPE_REPRESENTATION, $this->enabledDoiTypes), function (Builder $q) {
127+
$q->leftJoin('publication_galleys as pgOnDoiPage', 'pgOnDoiPage.publication_id', '=', 'pOnDoiPage.publication_id')
128+
->orWhereNotNull('pgOnDoiPage.doi_id');
129+
});
130+
});
131+
});
132+
}
133+
134+
/** @copydoc PKP/classes/submission/Collector::getAllowedDoiTypes() */
135+
protected function getAllowedDoiTypes(): array
136+
{
137+
return [
138+
Repo::doi()::TYPE_PUBLICATION,
139+
Repo::doi()::TYPE_REPRESENTATION,
140+
];
141+
}
142+
107143
/** @copydoc PKP/classes/submission/Collector::addFilterByAssociatedDoiIdsToQuery() */
108144
protected function addFilterByAssociatedDoiIdsToQuery(Builder $q)
109145
{

pages/dois/DoisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function getAppStateComponents(\APP\core\Request $request, array $enab
4040
[
4141
'apiUrl' => $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $context->getPath(), 'submissions'),
4242
'getParams' => [
43-
'stageIds' => [WORKFLOW_STAGE_ID_PUBLISHED, WORKFLOW_STAGE_ID_PRODUCTION],
43+
'onDoiPage' => true,
4444
],
4545
'itemType' => 'submission'
4646
]

0 commit comments

Comments
 (0)