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

[Publication Module] Duplicate Lead Investigator Email Issue #9719

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions modules/publication/ajax/FileUpload.php
Original file line number Diff line number Diff line change
@@ -68,15 +68,14 @@ function uploadPublication() : void
$leadInvest = $_POST['leadInvestigator'] ?? null;
$leadInvestEmail = $_POST['leadInvestigatorEmail'] ?? null;

// check if lead investigator already exists in collaborator table
// check if lead investigator email already exists in collaborator table
// use ID if exists, else insert
$leadInvID = $db->pselectOne(
'SELECT PublicationCollaboratorID '.
'FROM publication_collaborator '.
'WHERE Name = :n AND Email = :e',
'WHERE Email = :e',
[
'e' => $leadInvestEmail,
'n' => $leadInvest,
'e' => $leadInvestEmail
]
);
if (empty($leadInvID)) {
@@ -89,6 +88,8 @@ function uploadPublication() : void
);

$leadInvID = $db->getLastInsertId();
} else {
showPublicationError('Lead Investigator email already exists', 400);
}
if (!isset($desc, $leadInvest, $leadInvestEmail)) {
showPublicationError('A mandatory field is missing!', 400);