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
297 stars 442 forks source link

Cannot add new reviewer when assigning submission reviewers #8771

Closed ewhanson closed 1 year ago

ewhanson commented 1 year ago

Describe the bug When assigning a brand new reviewer to a submission already in a review stage, the reviewer creation process encounters a fatal error when clicking "Add Reviewer." The error originates when the email template to send to the new reviewer is not found, resulting in a fatal error.

To Reproduce Steps to reproduce the behavior:

  1. Go to a submission with an active review round.
  2. Click on "Add Reviewer".
  3. Click "Create Reviewer"
  4. Submit form with an email message.
  5. See 500 error in networking console/progress spinner spins indefinitely

What application are you using? OJS 3.4 rc 1

Additional information Error log:

[10-Mar-2023 17:48:06 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getLocalizedData() on null in ./lib/pkp/classes/submission/action/EditorAction.php:118
Stack trace:
#0 ./lib/pkp/controllers/grid/users/reviewer/form/ReviewerForm.php(334): PKP\submission\action\EditorAction->addReviewer(Object(APP\core\Request), Object(APP\submission\Submission), 36, Object(PKP\submission\reviewRound\ReviewRound), '2023-04-07', '2023-04-07', 2)
#1 ./lib/pkp/controllers/grid/users/reviewer/form/CreateReviewerForm.php(175): PKP\controllers\grid\users\reviewer\form\ReviewerForm->execute()
#2 ./lib/pkp/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php(401): PKP\controllers\grid\users\reviewer\form\CreateReviewerForm->execute()
#3 ./lib/pkp/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php(368): PKP\controllers\grid\users\reviewer\PKPReviewerGridHandler->updateReviewer(Array, Object(APP\core\Request))
#4 [internal function]: PKP\controllers\grid\users\reviewer\PKPReviewerGridHandler->createReviewer(Array, Object(APP\core\Request))
#5 ./lib/pkp/classes/core/PKPRouter.php(465): call_user_func(Array, Array, Object(APP\core\Request))
#6 ./lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)
#7 ./lib/pkp/classes/core/Dispatcher.php(163): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))
#8 ./lib/pkp/classes/core/PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#9 ./index.php(21): PKP\core\PKPApplication->execute()
#10 {main}
thrown in ./lib/pkp/classes/submission/action/EditorAction.php on line 118
asmecher commented 1 year ago

@Vitaliy-1, could you have a look at this one?

Vitaliy-1 commented 1 year ago

PR: https://github.com/pkp/pkp-lib/pull/8824 tests: https://github.com/pkp/ojs/pull/3837

Vitaliy-1 commented 1 year ago

Likely one-liner but I see another error as well when saving the form, want to check if it's related before merge.

Vitaliy-1 commented 1 year ago

The second error was:

Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'context_id' cannot be null (SQL: INSERT INTO notifications
                    (user_id, level, date_created, context_id, type, assoc_type, assoc_id)
                VALUES
                    (8, 3, '2023-03-17 18:13:54', ?, 16777227, 517, 33))

and it was already fixed by this commit: https://github.com/pkp/pkp-lib/commit/522d6490bbbdc18563e7db734464a8bae7b05216