Skip to content

Commit 5b5170a

Browse files
authored
[Publication] Fix for auto-selecting Project in edit (#9187)
The value expected by the field is the number id, but the fetch statement was returning the name - so I modified the sql statement to fetch the project ID. Fixes #9134
1 parent 65ad4b5 commit 5b5170a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

modules/publication/ajax/getData.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ function getData($db) : array
145145
*/
146146
function getProjectData($db, $user, $id) : array
147147
{
148-
$query = 'SELECT Title, Description, pr.Name as project, datePublication, '.
148+
$query = 'SELECT Title, Description, ' .
149+
'p.project as project, pr.Name as projectName, datePublication, '.
149150
'journal, link, publishingStatus, DateProposed, '.
150151
'pc.Name as LeadInvestigator, pc.Email as LeadInvestigatorEmail, '.
151152
'PublicationStatusID, UserID, RejectedReason '.
@@ -199,6 +200,7 @@ function getProjectData($db, $user, $id) : array
199200
'title' => $title,
200201
'description' => $description,
201202
'project' => $result['project'],
203+
'projectName' => $result['projectName'],
202204
'datePublication' => $datePublication,
203205
'journal' => $journal,
204206
'link' => $link,

modules/publication/jsx/viewProject.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class ViewProject extends React.Component {
110110
title: data.title,
111111
description: data.description,
112112
project: data.project,
113+
projectName: data.projectName,
113114
publishingStatus: data.publishingStatus,
114115
datePublication: data.datePublication,
115116
journal: data.journal,
@@ -304,7 +305,7 @@ class ViewProject extends React.Component {
304305
<StaticElement
305306
name="project"
306307
label="Project"
307-
text={this.state.formData.project}
308+
text={this.state.formData.projectName}
308309
/>
309310
<StaticElement
310311
name="publishingStatus"

0 commit comments

Comments
 (0)