kitodo-presentation icon indicating copy to clipboard operation
kitodo-presentation copied to clipboard

[BUGFIX] Add `sorting` key to metadata

Open csidirop opened this issue 2 years ago • 7 comments

See #1183

I added the missing entries in MetadataDefaults.php and added a call in addMetadataAction() so that it is saved in the metadata object. But it is not stored in the DB, where the value for the sorting key is still 0.

Any idea?

csidirop avatar Mar 05 '24 16:03 csidirop

According to documentation sorting should be handled by the DataHandler without any need for manually setting values in the database. It should be sufficient to set sortby in the TCA (which we did) and TYPO3 should do the rest. I have no idea why it doesn't work...

sebastian-meyer avatar Mar 07 '24 15:03 sebastian-meyer

Okay, thanks for checking the documentation. Thats really weird than

csidirop avatar Mar 12 '24 08:03 csidirop

According to documentation sorting should be handled by the DataHandler without any need for manually setting values in the database. It should be sufficient to set sortby in the TCA (which we did) and TYPO3 should do the rest. I have no idea why it doesn't work...

Currently DataHandler is not used to insert metadata. I was writing about it here https://github.com/kitodo/kitodo-presentation/issues/1147#issuecomment-1961467931 :

Extbase directly writes to the database, and thus bypasses DataHandler. DataHandler is actually the one which is responsible for the localization of records.

beatrycze-volk avatar Mar 12 '24 16:03 beatrycze-volk

Extbase directly writes to the database, and thus bypasses DataHandler. DataHandler is actually the one which is responsible for the localization of records.

But that's by choice, not by design, isn't it? I don't see a reason not to revert to using the DataHandler with Extbase (at least in backend context). The DataHandler is still available in TYPO3 v12. The old implementation (Extbase + DataHandler) can be seen here: https://github.com/kitodo/kitodo-presentation/blob/1ff03fc4c3ab4dfdc0102d5d98837f1e72f57103/Classes/Controller/NewTenantController.php

sebastian-meyer avatar Mar 13 '24 19:03 sebastian-meyer

Oh, I just saw that you already suggested restoring the old method using the DataHandler in #1147... Sorry, I missed that!

But yes, I think that's the way we should proceed!

sebastian-meyer avatar Mar 13 '24 19:03 sebastian-meyer

But yes, I think that's the way we should proceed!

Ok, then I will revert it.

beatrycze-volk avatar Mar 14 '24 16:03 beatrycze-volk

@csidirop As I'm still working on DataHandler usage and can't give the prediction when it will work (basic save works but no localization) ,I have found workaround for sorting problem: https://github.com/beatrycze-volk/kitodo-presentation/commit/6e02b6ec83eaf96f6bc1a7f0dbe6ca2335c2c3dc

It is necessary to add to tx_dlf_metadata.php:

        'sorting' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],

@sebastian-meyer Are you ok with this solution?

beatrycze-volk avatar Mar 28 '24 14:03 beatrycze-volk

It is necessary to add to tx_dlf_metadata.php:

        'sorting' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],

@sebastian-meyer Are you ok with this solution?

Yes, that's fine! Thank you!

sebastian-meyer avatar May 07 '24 10:05 sebastian-meyer

Merging this as a temporary workaround (see #1209).

sebastian-meyer avatar May 23 '24 11:05 sebastian-meyer