From 532b21dbcc59859d4f537a1c1ec99927230a81c8 Mon Sep 17 00:00:00 2001 From: Saagar Arya Date: Thu, 28 Mar 2024 15:09:53 -0400 Subject: [PATCH 1/4] [Publication] Fix for autoselecting Project in edit --- modules/publication/jsx/viewProject.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/publication/jsx/viewProject.js b/modules/publication/jsx/viewProject.js index b479ba224f9..84e0981c10a 100644 --- a/modules/publication/jsx/viewProject.js +++ b/modules/publication/jsx/viewProject.js @@ -103,13 +103,16 @@ class ViewProject extends React.Component { }); return; } + let projectKey = Object.keys(data.projectOptions).find( + key => data.projectOptions[key] === data.project + ); response.json().then( (data) => { let formData = { title: data.title, description: data.description, - project: data.project, + project: projectKey, publishingStatus: data.publishingStatus, datePublication: data.datePublication, journal: data.journal, From ca5bde9bbaa82567df8e5f6fad1c69d4b7071505 Mon Sep 17 00:00:00 2001 From: Saagar Arya Date: Thu, 28 Mar 2024 15:15:54 -0400 Subject: [PATCH 2/4] Move change from jsx to php --- modules/publication/ajax/getData.php | 4 +--- modules/publication/jsx/viewProject.js | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/publication/ajax/getData.php b/modules/publication/ajax/getData.php index 3fd0dfd8752..6d2f0cf87de 100644 --- a/modules/publication/ajax/getData.php +++ b/modules/publication/ajax/getData.php @@ -145,15 +145,13 @@ function getData($db) : array */ function getProjectData($db, $user, $id) : array { - $query = 'SELECT Title, Description, pr.Name as project, datePublication, '. + $query = 'SELECT Title, Description, p.project as project, datePublication, '. 'journal, link, publishingStatus, DateProposed, '. 'pc.Name as LeadInvestigator, pc.Email as LeadInvestigatorEmail, '. 'PublicationStatusID, UserID, RejectedReason '. 'FROM publication p '. 'LEFT JOIN publication_collaborator pc '. 'ON p.LeadInvestigatorID = pc.PublicationCollaboratorID '. - 'LEFT JOIN Project pr '. - 'ON p.project = pr.ProjectID '. 'WHERE p.PublicationID=:pid '; $result = $db->pselectRow( $query, diff --git a/modules/publication/jsx/viewProject.js b/modules/publication/jsx/viewProject.js index 84e0981c10a..b479ba224f9 100644 --- a/modules/publication/jsx/viewProject.js +++ b/modules/publication/jsx/viewProject.js @@ -103,16 +103,13 @@ class ViewProject extends React.Component { }); return; } - let projectKey = Object.keys(data.projectOptions).find( - key => data.projectOptions[key] === data.project - ); response.json().then( (data) => { let formData = { title: data.title, description: data.description, - project: projectKey, + project: data.project, publishingStatus: data.publishingStatus, datePublication: data.datePublication, journal: data.journal, From 2ac4fe6101b563d621cbff665b007347a3705146 Mon Sep 17 00:00:00 2001 From: Saagar Arya Date: Tue, 16 Apr 2024 10:17:21 -0400 Subject: [PATCH 3/4] Publication project showing in edit/view --- modules/publication/ajax/getData.php | 5 ++++- modules/publication/jsx/viewProject.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/publication/ajax/getData.php b/modules/publication/ajax/getData.php index 6d2f0cf87de..6e45826c9cf 100644 --- a/modules/publication/ajax/getData.php +++ b/modules/publication/ajax/getData.php @@ -145,13 +145,15 @@ function getData($db) : array */ function getProjectData($db, $user, $id) : array { - $query = 'SELECT Title, Description, p.project as project, datePublication, '. + $query = 'SELECT Title, Description, p.project as project, pr.Name as projectName, datePublication, '. 'journal, link, publishingStatus, DateProposed, '. 'pc.Name as LeadInvestigator, pc.Email as LeadInvestigatorEmail, '. 'PublicationStatusID, UserID, RejectedReason '. 'FROM publication p '. 'LEFT JOIN publication_collaborator pc '. 'ON p.LeadInvestigatorID = pc.PublicationCollaboratorID '. + 'LEFT JOIN Project pr '. + 'ON p.project = pr.ProjectID '. 'WHERE p.PublicationID=:pid '; $result = $db->pselectRow( $query, @@ -197,6 +199,7 @@ function getProjectData($db, $user, $id) : array 'title' => $title, 'description' => $description, 'project' => $result['project'], + 'projectName' => $result['projectName'], 'datePublication' => $datePublication, 'journal' => $journal, 'link' => $link, diff --git a/modules/publication/jsx/viewProject.js b/modules/publication/jsx/viewProject.js index b479ba224f9..5775b1102cd 100644 --- a/modules/publication/jsx/viewProject.js +++ b/modules/publication/jsx/viewProject.js @@ -105,11 +105,13 @@ class ViewProject extends React.Component { } response.json().then( + (data) => { let formData = { title: data.title, description: data.description, project: data.project, + projectName: data.projectName, publishingStatus: data.publishingStatus, datePublication: data.datePublication, journal: data.journal, @@ -304,7 +306,7 @@ class ViewProject extends React.Component { Date: Tue, 16 Apr 2024 10:24:37 -0400 Subject: [PATCH 4/4] Fix for checks --- modules/publication/ajax/getData.php | 3 ++- modules/publication/jsx/viewProject.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/publication/ajax/getData.php b/modules/publication/ajax/getData.php index 6e45826c9cf..942a7a7ca00 100644 --- a/modules/publication/ajax/getData.php +++ b/modules/publication/ajax/getData.php @@ -145,7 +145,8 @@ function getData($db) : array */ function getProjectData($db, $user, $id) : array { - $query = 'SELECT Title, Description, p.project as project, pr.Name as projectName, datePublication, '. + $query = 'SELECT Title, Description, ' . + 'p.project as project, pr.Name as projectName, datePublication, '. 'journal, link, publishingStatus, DateProposed, '. 'pc.Name as LeadInvestigator, pc.Email as LeadInvestigatorEmail, '. 'PublicationStatusID, UserID, RejectedReason '. diff --git a/modules/publication/jsx/viewProject.js b/modules/publication/jsx/viewProject.js index 5775b1102cd..6c9401fce06 100644 --- a/modules/publication/jsx/viewProject.js +++ b/modules/publication/jsx/viewProject.js @@ -105,7 +105,6 @@ class ViewProject extends React.Component { } response.json().then( - (data) => { let formData = { title: data.title,