Bug 37434 - Lists are incorrectly sorted in UNIMARC
Summary: Lists are incorrectly sorted in UNIMARC
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Baptiste Wojtkowski (bwoj)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-23 14:53 UTC by Baptiste Wojtkowski (bwoj)
Modified: 2025-02-13 15:20 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.03 KB, patch)
2024-07-31 12:48 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.27 KB, patch)
2024-07-31 13:07 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.27 KB, patch)
2024-07-31 13:16 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.28 KB, patch)
2024-07-31 13:17 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.28 KB, patch)
2024-07-31 14:04 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (1.04 KB, patch)
2024-07-31 14:05 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.11 KB, patch)
2024-08-02 11:53 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.56 KB, patch)
2024-08-02 12:03 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.62 KB, patch)
2024-08-22 19:30 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.61 KB, patch)
2025-02-06 14:19 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.61 KB, patch)
2025-02-06 14:31 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.62 KB, patch)
2025-02-06 14:32 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.72 KB, patch)
2025-02-07 07:43 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.67 KB, patch)
2025-02-07 11:37 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC (3.67 KB, patch)
2025-02-10 12:53 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Wojtkowski (bwoj) 2024-07-23 14:53:11 UTC
In UNIMARC, when creating a list using sort by copyrightdate, it sorts using the MARC21 field "copyrightdate", which is not existing in UNIMARC.

Note: the inventory search uses the field publicationyear to sort, which is the correct field to use here.
Comment 1 Baptiste Wojtkowski (bwoj) 2024-07-31 12:48:25 UTC Comment hidden (obsolete)
Comment 2 Baptiste Wojtkowski (bwoj) 2024-07-31 13:07:39 UTC Comment hidden (obsolete)
Comment 3 Baptiste Wojtkowski (bwoj) 2024-07-31 13:16:25 UTC Comment hidden (obsolete)
Comment 4 Baptiste Wojtkowski (bwoj) 2024-07-31 13:17:55 UTC Comment hidden (obsolete)
Comment 5 Baptiste Wojtkowski (bwoj) 2024-07-31 14:04:28 UTC Comment hidden (obsolete)
Comment 6 Baptiste Wojtkowski (bwoj) 2024-07-31 14:05:36 UTC Comment hidden (obsolete)
Comment 7 Baptiste Wojtkowski (bwoj) 2024-08-02 11:53:22 UTC Comment hidden (obsolete)
Comment 8 Baptiste Wojtkowski (bwoj) 2024-08-02 12:03:21 UTC
Created attachment 169998 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.
Comment 9 Roman Dolny 2024-08-22 19:30:47 UTC
Created attachment 170614 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 10 Jonathan Druart 2025-01-23 13:17:18 UTC
Why not display "Publication year" then?
Comment 11 Baptiste Wojtkowski (bwoj) 2025-01-23 14:41:23 UTC
Setting to minor since this is a bug not an enhancement
Comment 12 Baptiste Wojtkowski (bwoj) 2025-01-23 15:30:35 UTC Comment hidden (obsolete)
Comment 13 Marcel de Rooy 2025-01-24 10:29:31 UTC
Do you need these changes:
+                                    [% ELSIF shelf.sortfield == "publicationyear" %]
+                                        <option value="publicationyear" selected="selected">Copyrightdate</option>

and also twice
+        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate publicationyear itemcallnumber dateadded );

Is the test on copyrightdate and UNIMARC not sufficient ?
Comment 14 Baptiste Wojtkowski (bwoj) 2025-01-24 13:07:17 UTC
(In reply to Jonathan Druart from comment #10)
> Why not display "Publication year" then?

Oh I missinterpreted your comment, I got it, yeah, I'll change it
Comment 15 Baptiste Wojtkowski (bwoj) 2025-01-24 13:15:39 UTC
Hum, I think this needs a rework, setting back to Assigned
Comment 16 Baptiste Wojtkowski (bwoj) 2025-02-06 14:19:08 UTC
Created attachment 177576 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 17 Baptiste Wojtkowski (bwoj) 2025-02-06 14:26:50 UTC
(In reply to Marcel de Rooy from comment #13)
> Do you need these changes:
> +                                    [% ELSIF shelf.sortfield ==
> "publicationyear" %]
> +                                        <option value="publicationyear"
> selected="selected">Copyrightdate</option>
> 
> and also twice
> +        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title
> author copyrightdate publicationyear itemcallnumber dateadded );
> 
> Is the test on copyrightdate and UNIMARC not sufficient ?

In fact, they are not used the same way : "copyrightdate" is de facto the name used in database to sort by date of publication, in MARC21, "copyrightdate" and in UNIMARC 'publicationyear'. This is why we need to tell the template "I need to sort by publicationyear"
The code added in the template is just the corresponding entry for the sortfield publicationyear, as there is one for each possible sortfield.

Or you mean you want to do the test directly on the template ? I don't feel like it would make it more clean, do you ?
Comment 18 Baptiste Wojtkowski (bwoj) 2025-02-06 14:31:21 UTC
Created attachment 177580 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 19 Baptiste Wojtkowski (bwoj) 2025-02-06 14:32:25 UTC
Created attachment 177581 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 20 Marcel de Rooy 2025-02-07 07:43:19 UTC
(In reply to Baptiste Wojtkowski (bwoj) from comment #17)
> 
> In fact, they are not used the same way : "copyrightdate" is de facto the
> name used in database to sort by date of publication, in MARC21,
> "copyrightdate" and in UNIMARC 'publicationyear'. This is why we need to
> tell the template "I need to sort by publicationyear"
> The code added in the template is just the corresponding entry for the
> sortfield publicationyear, as there is one for each possible sortfield.
> 
> Or you mean you want to do the test directly on the template ? I don't feel
> like it would make it more clean, do you ?

Looks better now.
Too bad that Koha makes this distinction. It is a potential source of confusion and bugs.
Will pass QA now.
Comment 21 Marcel de Rooy 2025-02-07 07:43:45 UTC
Created attachment 177611 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 22 Marcel de Rooy 2025-02-07 07:48:09 UTC
Oops minor detail: Publication Year in wrong case style..
Comment 23 Baptiste Wojtkowski (bwoj) 2025-02-07 11:37:34 UTC Comment hidden (obsolete)
Comment 24 Baptiste Wojtkowski (bwoj) 2025-02-07 11:38:14 UTC
Removed the capital, Idk if you also wanted to remove the space, tell me :)
Comment 25 Baptiste Wojtkowski (bwoj) 2025-02-10 12:53:00 UTC
Created attachment 177677 [details] [review]
Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC

TEST PLAN (on an UNIMARC machine):
1 - Create a list with items with different publicationyear if you do not have one.
2 - Edit the list and select "copyrightdate as date"
3 - See they are not sorted by date
4 - Apply patch
5 - See they are now sorted by date.

Note: The transformation of copyrightdate before loading the template is
only useful if the list is sorted by copyrightdate, which is quite
inconsistent but is actual for every Kohas at the moment.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 26 Baptiste Wojtkowski (bwoj) 2025-02-10 12:53:55 UTC
Looks like I did not publish any modification in last upload
Comment 27 Katrin Fischer 2025-02-13 15:16:17 UTC
I think we might want to just use "Publication year" for MARC21 too, but that can be for later:

                             [% END %]
                             [% IF shelf.sortfield == "copyrightdate" %]
                                 <option value="copyrightdate" selected="selected">Copyrightdate</option>
+                            [% ELSIF shelf.sortfield == "publicationyear" %]
+                                <option value="publicationyear" selected="selected">Publication year</option>
                             [% ELSE %]
Comment 28 Katrin Fischer 2025-02-13 15:20:24 UTC
Pushed for 25.05!

Well done everyone, thank you!