From 3c5e68f740528ef7dab45a2a87116892bc938350 Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Tue, 24 Dec 2024 09:55:15 -0500 Subject: [PATCH] pkp/pkp-lib#10178 Allow search by DOI in DOI manager --- classes/submission/Collector.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/classes/submission/Collector.php b/classes/submission/Collector.php index 48c799229e..535e6cab73 100644 --- a/classes/submission/Collector.php +++ b/classes/submission/Collector.php @@ -1,4 +1,5 @@ selectRaw('NULL AS submission_id')->whereRaw('1 = 0'); + + $q->whereIn('s.submission_id', function (Builder $query) { + $context = Application::get()->getRequest()->getContext(); + + $query->when($context->isDoiTypeEnabled(Repo::doi()::TYPE_REPRESENTATION), function (Builder $q) { + $q->select('p.submission_id') + ->from('publication_galleys AS g') + ->join('dois AS d', 'g.doi_id', '=', 'd.doi_id') + ->join('publications AS p', 'g.publication_id', '=', 'p.publication_id') + ->whereLike('d.doi', "{$this->searchPhrase}%"); + }) + ->when($context->isDoiTypeEnabled(Repo::doi()::TYPE_PUBLICATION), function (Builder $q) { + $q->union(function (Builder $query) { + $query->select('p.submission_id') + ->from('publications AS p') + ->join('dois AS d', 'p.doi_id', '=', 'd.doi_id') + ->whereLike('d.doi', "{$this->searchPhrase}%"); + }); + }); + }); + } }