-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Fix wrong sorting of volumes in listview and toc #931
[BUGFIX] Fix wrong sorting of volumes in listview and toc #931
Conversation
|
Is this related to #984? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments above.
@michaelkubina I'd like to add this to the upcoming 5.0 release, but you haven't addressed my remarks above. Could you please tell me how you would like to continue? |
There is a certain relation to #984, where its focused on the as to 1) as to 2)
While true that it can theoretically be also a string or alphanumeric (because the database allows for it), in case of a METS file it should/must not be - or are you thinking of a custom configuration here? The MODS-Schema from the LOC is also clear, that the as to how to proceed)
Would you be more comfortable with this approach, which does not involve typecasting in the sql-query? I have experimented with COLLATIONS, and they have not worked for me resolving this issue, but also it has shown, that it is highly dependend of the database one is using and of the configuration. I have got an error like |
Thank you very much for the explanation! That totally makes sense! |
This PR fixes an issue, where in certain cases volumes get sorted the wrong way in the listview and the toc. The "MODS-Anwendungsprofil" (page 42) specifies in the section for
mods:part
, that theorder
-attribute needs to be a positive integer for sorting-related purposes. This is also considered in theMetadataDefaults.php
with the XPATH forvolume_sorting
retrieving the value from./mods:part[@type="host"]/@order
The quierybuilder requests the value being sorted in ascending order, but since its declared as a
VARCHAR
in the database-table it gets sorted lexicographically. This causes the following order for cases where alphabetical sorting differs from numerical sorting:1
10
11
2
3
4
...
This PR applies a typecast to the querybuilder, that casts the value to an
UNSIGNED
-integer, that is then sorted numerically in ascending order.The (likely better) alternative would be to change the fieldtype in the database layout
ext_tables.sql
to an integer, but would require a DB-migration when upgrading the extension.