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

pkp/pkp-lib#10178 Allow search by DOI in DOI manager #830

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions classes/submission/Collector.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file classes/submission/Collector.php
*
Expand All @@ -13,6 +14,7 @@

namespace APP\submission;

use APP\core\Application;
use APP\facades\Repo;
use Illuminate\Database\Query\Builder;

Expand Down Expand Up @@ -101,4 +103,33 @@ protected function addHasDoisFilterToQuery(Builder $q)
});
});
}

/** @copydoc PKP/classes/submission/Collector::addFilterByAssociatedDoiIdsToQuery() */
protected function addFilterByAssociatedDoiIdsToQuery(Builder $q)
{
// Does two things:
// 1 - Defaults to empty result when no DOIs are enabled.
// 2 - Ensures that the union clause can be safely used if a query with a union clause is the only one that is executed.
$q->selectRaw('NULL AS submission_id')->whereRaw('1 = 0');

$q->whereIn('s.submission_id', function (Builder $query) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment from OJS about limiting to enabled types.

$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}%");
});
});
});
}
}
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 18 files
+64 −79 api/v1/invitations/InvitationController.php
+15 −0 classes/doi/Doi.php
+6 −1 classes/invitation/core/CreateInvitationController.php
+12 −7 classes/invitation/core/Invitation.php
+5 −1 classes/invitation/core/InvitationActionRedirectController.php
+1 −1 classes/invitation/invitations/changeProfileEmail/handlers/ChangeProfileEmailInviteRedirectController.php
+1 −1 classes/invitation/invitations/registrationAccess/handlers/RegistrationAccessInviteRedirectController.php
+1 −1 classes/invitation/invitations/reviewerAccess/handlers/ReviewerAccessInviteRedirectController.php
+26 −1 classes/invitation/invitations/userRoleAssignment/UserRoleAssignmentInvite.php
+12 −4 classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php
+54 −1 classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php
+2 −1 classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentReceiveController.php
+5 −1 classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php
+93 −0 classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php
+62 −0 classes/invitation/invitations/userRoleAssignment/resources/UserRoleAssignmentInviteManagerDataResource.php
+6 −53 classes/invitation/invitations/userRoleAssignment/resources/UserRoleAssignmentInviteResource.php
+16 −5 classes/submission/Collector.php
+3 −0 locale/en/invitation.po
Loading