kitodo / kitodo-presentation

Kitodo.Presentation is a feature-rich framework for building a METS- or IIIF-based digital library. It is part of the Kitodo Digital Library Suite.
https://kitodo.org
GNU General Public License v3.0
38 stars 44 forks source link

Unable to create working page with Collection plugin in Typo3 8.7 #343

Closed jmechnich closed 5 years ago

jmechnich commented 5 years ago

Steps to reproduce

Expected behaviour

After pointing the Startingpoint to the correct data folder and setting the Target Page to the page containing the List View plugin, available collections should show up for selection.

Actual behaviour

The correct Solr Core is selected, but no available collections are shown. After pressing the save button for a second time, the available collections are displayed but the selected Solr Core vanishes and the drop-down list is empty. After this it is not possible to save again as no Core can be manually selected.

The following error shows up in system and dev log after the first save:

Core: Error handler (BE): PHP Warning: Invalid argument supplied for foreach() in /var/www/typo3/CmsBaseDistribution/public/typo3conf/ext/dlf/Classes/Hooks/FormEngine.php line 57

System configuration

ghost commented 5 years ago

Hi Jörg, first of all: dlf presentation 3 is beta and it has still a lot of bugs. It is not yet suitable for a productive use.

We worked around this issue by patching FormEngine.php on line 195 (function itemsProcFunc_solrList) from $page = $params['row']['pages']; to $page = $params['row']['pages'][0]['uid']; to get the following DB select Query for the solr core label & uid working.

I would leave this issue open, so the maintainers can care about it, if they have the time for it. Keep going the good work, dont give up, there is a lot more still to come.

BFallert commented 5 years ago

This workaround works! I can now save a page with a Collection plugin.

sebastian-meyer commented 5 years ago

I provided a pull request which tries to fix this problem for all itemsProcFunc_*. Could you please verify that fix #344 works as expected?

ghost commented 5 years ago

My Test failed. Problem still persists.

Setup:

Indexing to Solr & Typo3 DB succeeded, 2 solr cores active, 2 collections active, 2 documents active, but no solr-core is selectable in Flexform for Collection Plugin Config and no Collections are shown in Collection Available Items. Page cannot be saved due to "Require" Restrictions.

This Warning is in TYPO3 Log: Core: Error handler (BE): PHP Warning: Invalid argument supplied for foreach() in /var/www/kitpres8-test/public/typo3conf/ext/dlf/Classes/Hooks/FormEngine.php line 120

Debugger indicates following call (itemsProcFunc_solrList) returns NULL: $this->itemsProcFunc_generateList( $params, 'label,uid', 'tx_dlf_solrcores', 'label', 'OR pid=0', FALSE );

In my testcase FormEngine.php line 117 $pages = $params['row']['pages'] is neither array nor object, but string: 1 char: '3' (uid of data folder)

jmechnich commented 5 years ago

We introduced a helper function to check if $pages is an array or a string to fix this issue, see https://github.com/jmechnich/kitodo-presentation/commit/61d6617f9b001ae137e64a53d5e9ad3a1cad1f00

Maybe this can be combined with Sebastians patch ? I am a bit confused though why the type of $pages is not always an array in the first place.

sebastian-meyer commented 5 years ago

Thank you for your contribution! I updated #344 accordingly. Could you please test again?

BFallert commented 5 years ago

I tested it again, now its possible to create working page with Collection plugin!

So the problem is fixed now! Thanks for that!

ghost commented 5 years ago

Yes. Tested dcb5120 and saving a Collection Plugin Page works now.