Skip to content

Commit 590ca46

Browse files
[Publication Module] Duplicate Lead Investigator Email Issue (#9719)
Lead Investigator email should be unique for each publication. Same name can be there; but email should be different to uniquely identify publication. Resolves #9702
1 parent e727978 commit 590ca46

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/publication/ajax/FileUpload.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ function uploadPublication() : void
6868
$leadInvest = $_POST['leadInvestigator'] ?? null;
6969
$leadInvestEmail = $_POST['leadInvestigatorEmail'] ?? null;
7070

71-
// check if lead investigator already exists in collaborator table
71+
// check if lead investigator email already exists in collaborator table
7272
// use ID if exists, else insert
7373
$leadInvID = $db->pselectOne(
7474
'SELECT PublicationCollaboratorID '.
7575
'FROM publication_collaborator '.
76-
'WHERE Name = :n AND Email = :e',
76+
'WHERE Email = :e',
7777
[
78-
'e' => $leadInvestEmail,
79-
'n' => $leadInvest,
78+
'e' => $leadInvestEmail
8079
]
8180
);
8281
if (empty($leadInvID)) {
@@ -89,6 +88,8 @@ function uploadPublication() : void
8988
);
9089

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

0 commit comments

Comments
 (0)