ojsde / dnb

OJS plugin that exports full texts and metadata to the Deutsche Nationalbibliothek (DNB)
GNU General Public License v2.0
3 stars 3 forks source link

Blank page when exporting articles without a license url #14

Closed Jannik-Lappe closed 2 years ago

Jannik-Lappe commented 2 years ago

Dear ojsde-Team,

I encountered a Problem with one of our OJS instances. I installed the DNB Plugin for future use, but during testing (exporting an article) i got a blank page. Log:

[Tue Mar 08 13:05:09.195627 2022] [php7:notice] [pid 4140547] [client XXXX] PHP Notice:  Undefined variable: article in /path/ojs/plugins/importexport/dnb/filter/DNBXmlFilter.inc.php on line 245, referer: XXXX

[Tue Mar 08 13:05:09.195852 2022] [php7:error] [pid 4140547] [client XXXX] PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /path/ojs/plugins/importexport/dnb/filter/DNBXmlFilter.inc.php:245
Stack trace:
#0 /path/ojs/lib/pkp/classes/filter/Filter.inc.php(449): DNBXmlFilter->process()
#1 /path/ojs/classes/plugins/PubObjectsExportPlugin.inc.php(366): Filter->execute()
#2 /path/ojs/plugins/importexport/dnb/DNBExportPlugin.inc.php(389): PubObjectsExportPlugin->exportXML()
#3 /path/ojs/plugins/importexport/dnb/DNBExportPlugin.inc.php(290): DNBExportPlugin->getGalleyPackage()
#4 /path/ojs/classes/plugins/PubObjectsExportPlugin.inc.php(171): DNBExportPlugin->executeExportAction()
#5 /path/ojs/plugins/importexport/dnb/DNBExportPlugin.inc.php(80): PubObjectsExportPlugin->display()
#6 /path/ojs/lib/pkp/pages/management/PKPToolsHandler.inc.php(104): DNBExportPlugin->display()
#7 /path/ojs/lib/pkp/classes/core/PKPRouter.inc.php(391): PKPToolsHandler->importexport()
#8 /path/ojs/lib/pkp/classes/ in /path/ojs/plugins/importexport/dnb/filter/DNBXmlFilter.inc.php on line 245, referer: XXXX

In contrast to our other instances, where this plugin works without problem, the published articles don't have an license url attached. The log shows that the variable $article is not set while trying to get the license url from another source. (line 245) https://github.com/ojsde/dnb/blob/3cc859e23bb1ab238ac8ac8a01ce4e625f73378c/filter/DNBXmlFilter.inc.php#L237-L247 Our workaround for now is to just add the license url to every article. Is this a possible bug?

Kind Regards, Jannik Lappe

ronste commented 2 years ago

Hi Jannik,

what OJS version and what version/branch of the DNB plugin do you use?

Best wishes, Ronald

Jannik-Lappe commented 2 years ago

OJS 3.2.1-4 and Version 1.4.1 of the plugin

ronste commented 2 years ago

Ok, it seems I missed that line of code when updating the plugin.

Could you try to edit the code and replace "$article" with "$submission" in line 245 and try again?

Jannik-Lappe commented 2 years ago

That fixed it.

ronste commented 2 years ago

Ok, I will create an official fix.

Thanks for the feedback!

Jannik-Lappe commented 2 years ago

Thanks for the fix!