Have an issue with OJS (3.4.0.3) and OpenAIRE plugin(latest, 2023 version).
An ajax error is returned when I try to create a new section in Journal → Sections → Create Section:
Uncaught TypeError: PKP\section\Repository::get(): Argument #1 ($id) must be of type int, null given, called in C:\xampp_latest\htdocs\OJS\plugins\generic\openAIRE\OpenAIREPlugin.php on line 112 and defined in C:\xampp_latest\htdocs\OJS\lib\pkp\classes\section\Repository.php:58
After investigating I found that there are some rows in OpenAIREPlugin.php:
$section = Repo::section()->get($sectionForm->getSectionId());
And in this case getSectionId is null. As a result everything is crushed.
As walkaround I added a if:
if ($sectionForm->getSectionId()) {
$section = Repo::section()->get($sectionForm->getSectionId());
if ($section) $sectionForm->setData('resourceType', $section->getData('resourceType'));\
}
However I want to ask if there are more official way to fix this problem?
Thanks.