pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
307 stars 447 forks source link

Reviewer grid crashes on authorDashboard for accepted open review #10453

Open jardakotesovec opened 1 month ago

jardakotesovec commented 1 month ago

Describe the bug In specific scenario when the open review is accepted, but not finished - it fails to load the reviewer grid on author dashboard.

To Reproduce Steps to reproduce the behavior:

  1. as Editor, assign reviewer using the open review
  2. as Reviewer, confirm the review
  3. as author open authorDashboard
  4. See error, php backend crashes with:
[Thu Sep 19 14:47:25 2024] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/cache/t_compile/5197b8667749b842e36e42c3e995b091ded9f661^13079afb8321a2a0363ebe7d6bab5378471300e1_0.app.controllersgridgridCellContents.tpl.php:65
Stack trace:
#0 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6620c8fae5bdb0_07686382(Object(Smarty_Internal_Template))
#1 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(384): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/cache/t_compile/5197b8667749b842e36e42c3e995b091ded9f661^9c21c2c8343ac7bc03f5ced212a192438a7e111c_0.app.controllersgridgridCell.tpl.php(32): Smarty_Internal_Template->_subTemplateRender('app:controllers...', NULL, '5197b8667749b84...', 0, 3600, Array, 0, false)
#4 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6620c8fae4d876_89519690(Object(Smarty_Internal_Template))
#5 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#6 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#7 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render(false, 0)
#8 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, '5197b8667749b84...', NULL, 0)
#9 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/template/PKPTemplateManager.php(1205): Smarty_Internal_TemplateBase->fetch('controllers/gri...', NULL, '5197b8667749b84...', NULL)
#10 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridCellProvider.php(72): PKP\template\PKPTemplateManager->fetch('controllers/gri...')
#11 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(1262): PKP\controllers\grid\GridCellProvider->render(Object(APP\core\Request), Object(PKP\controllers\grid\users\reviewer\AuthorReviewerGridRow), Object(PKP\controllers\grid\GridColumn))
#12 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(1163): PKP\controllers\grid\GridHandler->_renderCellInternally(Object(APP\core\Request), Object(PKP\controllers\grid\users\reviewer\AuthorReviewerGridRow), Object(PKP\controllers\grid\GridColumn))
#13 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(1138): PKP\controllers\grid\GridHandler->renderRowInternally(Object(APP\core\Request), Object(PKP\controllers\grid\users\reviewer\AuthorReviewerGridRow))
#14 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(1188): PKP\controllers\grid\GridHandler->renderRowsInternally(Object(APP\core\Request), Array)
#15 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(1063): PKP\controllers\grid\GridHandler->renderGridBodyPartsInternally(Object(APP\core\Request))
#16 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/controllers/grid/GridHandler.php(735): PKP\controllers\grid\GridHandler->doSpecificFetchGridActions(Array, Object(APP\core\Request), Object(APP\template\TemplateManager))
#17 [internal function]: PKP\controllers\grid\GridHandler->fetchGrid(Array, Object(APP\core\Request))
#18 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/core/PKPRouter.php(334): call_user_func(Array, Array, Object(APP\core\Request))
#19 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)
#20 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))
#21 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#22 /Users/jarda/git/pkp/pkp-3_4_0/ojs-3_4_0/index.php(21): PKP\core\PKPApplication->execute()
#23 {main}

What application are you using? OJS, OMP or OPS version 3.3, 3.4 and 3.5

Additional information

Screenshot 2024-09-19 at 14 52 07
jardakotesovec commented 1 month ago

In AuthorReviewerGridCellProvider:

        if ($columnId == 'actions') {
            switch ($this->getCellState($row, $column)) {
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_COMPLETE:
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_THANKED:
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_RECEIVED:
                    $user = $request->getUser();
                    return [new ReviewNotesLinkAction($request, $reviewAssignment, $submission, $user, 'grid.users.reviewer.AuthorReviewerGridHandler', true)];
                default:
                    return null;
            }
        }

Needs to change to, as template expects array.

        if ($columnId == 'actions') {
            switch ($this->getCellState($row, $column)) {
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_COMPLETE:
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_THANKED:
                case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_RECEIVED:
                    $user = $request->getUser();
                    return [new ReviewNotesLinkAction($request, $reviewAssignment, $submission, $user, 'grid.users.reviewer.AuthorReviewerGridHandler', true)];
                default:
                    return [];
            }
        }