marc
September 10, 2021, 1:59pm
1
Description of issue or problem I’m having:
On ojs 3.2.1-4, when I ask for a the article’s report I get a 500 error.
Log shows the following:
PHP Fatal error: Uncaught Error: Call to a member function getLocalizedGivenName() on null in /var/www/html/plugins
/reports/articles/ArticleReportPlugin.inc.php:114\nStack trace:\n#0 /var/www/html/lib/pkp/pages/management/PKPToolsHandler.inc.php(155): ArticleReportPlugin->display(Array, Object(Request))\n#1 /var/www/
html/lib/pkp/pages/management/PKPToolsHandler.inc.php(58): PKPToolsHandler->report(Array, Object(Request))\n#2 /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php(391): PKPToolsHandler->tools(Array, Obj
ect(Request))\n#3 /var/www/html/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#4 /var/www/html/lib/pkp/classes/core
/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#5 /var/www/html/lib/pkp/classes/core/PKPApplication.inc.php(281): Dispatcher->dispatch(Object(Request))\n#6 /var/www/html/index.php(68):
PKPApplication->execute()\n#7 {main}\n thrown in /var/www/html/plugins/reports/articles/ArticleReportPlugin.inc.php on line 114, referer: https://ensciencias.uab.cat/management/tools
I search in the forum and I didn’t found any post related.
Thanks in advance for your help,
m.
Hi @marc ,
This is attempting to call getLocalizedGivenName()
for a user object that doesn’t exist. My best guess is that the user object may be empty because an incorrect or non-existent user ID is being used to get the user. In this case, the user ID is coming from the stage assignment for the submission.
// Load editor and decision information
$stageAssignmentsFactory = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId());
$editors = $editorsById = [];
while ($stageAssignment = $stageAssignmentsFactory->next()) {
$userId = $stageAssignment->getUserId();
if (!in_array($stageAssignment->getUserGroupId(), $editorUserGroupIds)) continue;
if (isset($editors[$userId])) continue;
if (!isset($editorsById[$userId])) {
$editor = $userDao->getById($userId);
$editorsById[$userId] = [
$editor->getLocalizedGivenName(),
$editor->getLocalizedFamilyName(),
$editor->getData('orcid'),
$editor->getEmail(),
];
}
$editors[$userId] = $editorsById[$userId];
$maxEditors = max($maxEditors, count($editors));
}
You could check the stage_assignments
table in the database for any entries in the user_id
column that are empty or null.
Regards,
Erik
PKP Team
1 Like
marc
September 14, 2021, 8:39am
4
Hi Erick,
Thanks for your answer.
I checked the DB and all entries have a user_id:
Then, following your proposal, I though “what if the table referes a non existing user”? And looks like 2 articles are assigned to a non-existing one (this journal was transfered from a different institution, so don’t ask me how is this even possible…).
Let me fix this to see what happens.
Thanks to point me in the right direction,
m.
marc
September 14, 2021, 4:59pm
5
Back to report that assigning those articles of stage_assignments to an existing user_id (ie: directly to user 1 that is admin) did the job.
Thanks a lot @ewhanson for your help.
Cheers,
m.
1 Like
Hi @marc ,
Glad to hear that helped you find the issue!
Regards,
Erik
PKP Team
1 Like
ewhanson
Closed
September 18, 2021, 8:00am
7
This topic was automatically closed after 3 days. New replies are no longer allowed.