Pkp-lib: Error when viewing a PDF issue galley

Created on 21 Apr 2020  路  12Comments  路  Source: pkp/pkp-lib

From https://forum.pkp.sfu.ca/t/3-2-0-2-php-fatal-errors-citations-style-language-and-getlocalizedfulltitle-on-null/59946:

PHP Fatal error: Uncaught Error: Call to a member function getLocalizedFullTitle() on null in /home/seisense/journal.seisense.com/cache/t_compile/011e5a5c6ec6ee79d574ba236ee5fce1afabbea9^504348cc7222e1110a6019067f9a002726c02324_0.plugins-plugins-generic-pdfJsViewer-generic-pdfJsViewer.display.tpl.php:94
Stack trace:

0 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5e9b3c0dda73d0_86846590(Object(Smarty_Internal_Template))

1 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))

2 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))

3 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smar in /home/seisense/journal.seisense.com/cache/t_compile/011e5a5c6ec6ee79d574ba236ee5fce1afabbea9^504348cc7222e1110a6019067f9a002726c02324_0.plugins-plugins-generic-pdfJsViewer-generic-pdfJsViewer.display.tpl.php on line 94

Bug

Most helpful comment

That commit deals with HTML galleys and I don't think issues support HTML galleys. I think the commit you want to reverse is in pdfJsViewer: https://github.com/pkp/pdfJsViewer/commit/96f3ead5864e55b383437a97f15eacfc547dd1ee.

@thinkbulecount2 I think there are two places in the pdfJsViewer display.tpl template: where it uses $galleyPublication->getData('datePublished') and where it uses $publication->getLocalizedFullTitle().

I think you'll need to look at the issueGalley.tpl and submissionGalley.tpl files to see how they pass in variables to display.tpl. Then pass in those required variables (parent published date and parent title).

All 12 comments

(This issue is caused by the assumption that the PDF view has a $publication object, which isn't the case for issue galleys. See https://github.com/pkp/pkp-lib/issues/5190.)

Users who are encountering this and are waiting for a fix can work around it in the meantime by reversing this change: https://github.com/pkp/ojs/pull/2652/commits/3f04c60a77a3a913b8ede151e185498584ec02d6 [Edit: That's the wrong commit link; see the next comment for the right one.]

That commit deals with HTML galleys and I don't think issues support HTML galleys. I think the commit you want to reverse is in pdfJsViewer: https://github.com/pkp/pdfJsViewer/commit/96f3ead5864e55b383437a97f15eacfc547dd1ee.

@thinkbulecount2 I think there are two places in the pdfJsViewer display.tpl template: where it uses $galleyPublication->getData('datePublished') and where it uses $publication->getLocalizedFullTitle().

I think you'll need to look at the issueGalley.tpl and submissionGalley.tpl files to see how they pass in variables to display.tpl. Then pass in those required variables (parent published date and parent title).

PR here, let me know if this is what you meant, @NateWr!

https://github.com/pkp/pdfJsViewer/pull/53

Yeah, you've got it. Except that in issueGalley.tpl there is no $publication, so you need to use $issue->getIssueIdentification() for the title instead.

Also, look for where $galleyPublication->getData('datePublished') is used. That also needs to be passed in from the submission/issue template.

@NateWr: Do you mind taking a second look? Made the changes based on your comments. Thanks!!!

:+1: Merged! @asmecher what should we do about stable/master for pdfJsViewer. Right now this fix has been merged into master. There is no stable-3_1_2 for this plugin. Do I need to do something to make sure that 3.2.0-3 goes out with this master branch, or port the commit to a stable branch?

Thanks, @NateWr! There is a stable-3_1_2 branch -- I take it you meant stable-3_2_0? I haven't created stable-3_2_0 branches yet for many of the repos because the master branch is still compatible (and likely to remain so through the 3.2.1 release, I expect). I'm OK to update the submodule (where necessary) and stick with the master branch in cases like this.

Great! In that case I think this can be closed.

Hi @NateWr

I still getting error when Full issue PDF view. You can see the error log below in image.

image

@NateWr thanks. Worked fine.

Was this page helpful?
0 / 5 - 0 ratings