Bug 14636

Summary: Sorting and searching by publication year in item search doesn't work correctly
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ToolsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: f.demians, fridolin.somers, julian.maurice, kyle
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14908
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 23970    
Attachments: Bug 14636: Item search - fix search and sort by publication date for MARC21
Bug 14636: Item search - improving display
[SIGNED-OFF] Bug 14636: Item search - fix search and sort by publication date for MARC21
[SIGNED-OFF] Bug 14636: Item search - improving display
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate
Bug 14636: Follow-up - fix typo in system preference name
Bug 14636: Item search - fix search and sort by publication date for MARC21
Bug 14636: Item search - improving display
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate
Bug 14636: Follow-up - fix typo in system preference name
Bug 14636: Item search - fix search and sort by publication date for MARC21
Bug 14636: Item search - improving display
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate
Bug 14636: Follow-up - fix typo in system preference name
Bug 14636: Remove debug message

Description Katrin Fischer 2015-08-03 09:43:19 UTC
I am not sure if this is only a problem for MARC21 - it might.

If you limit an item search by Year, using the pull down field and by call number, the reults are not correct.

The shown publication year doesn't match what was searched for, the call number is correct in my example. 

Sorting the column for copyright year gives wrong results - the list changes, but the sorting is incorrect.
Comment 1 Katrin Fischer 2015-11-21 20:40:30 UTC
*** Bug 14823 has been marked as a duplicate of this bug. ***
Comment 2 Katrin Fischer 2015-11-21 21:46:26 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2015-11-21 21:46:28 UTC Comment hidden (obsolete)
Comment 4 Owen Leonard 2015-11-24 14:18:09 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2015-11-24 14:25:47 UTC Comment hidden (obsolete)
Comment 6 Owen Leonard 2015-11-24 14:26:54 UTC
I left this as 'needs signoff' because I think it requires a test by a UNIMARC user as well.
Comment 7 Fridolin Somers 2015-11-25 15:50:16 UTC
Even without this patch, in UNIMARC, item search by publication date does not work.
It is because there is in itemsearch.tt publicationdate instead of publicationyear.

May I provide a patch here ?
Comment 8 Fridolin Somers 2015-11-25 16:06:50 UTC Comment hidden (obsolete)
Comment 9 Fridolin Somers 2015-11-25 16:29:29 UTC Comment hidden (obsolete)
Comment 10 Katrin Fischer 2015-11-25 17:02:23 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2015-11-25 17:02:35 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2015-11-25 17:08:56 UTC
Hi Fridolin - thx to your testing we found 2 more bugs. I added another follow-up and retested all patches together in MARC21 and UNIMARC. Can you please test again?
Comment 13 Fridolin Somers 2015-12-02 08:07:28 UTC Comment hidden (obsolete)
Comment 14 Fridolin Somers 2015-12-02 08:07:43 UTC Comment hidden (obsolete)
Comment 15 Fridolin Somers 2015-12-02 08:07:53 UTC Comment hidden (obsolete)
Comment 16 Fridolin Somers 2015-12-02 08:08:01 UTC Comment hidden (obsolete)
Comment 17 Fridolin Somers 2015-12-02 08:09:45 UTC
I signoff for UNIMARC, works perfect
Comment 18 Jonathan Druart 2015-12-02 11:39:02 UTC
Created attachment 45315 [details] [review]
Bug 14636: Item search - fix search and sort by publication date for MARC21

Problem: MARC21/NORMARC stores the publication
date in biblio.copyrightdate, but UNIMARC uses
biblioitems.publicationyear.

To test:
- Without patch in a MARC21 installation:
- Search by publication date
- Verify that the results don't match the
  publication year you searched for.
- Try sorting the table by publication year.
- Verify that the sort doesn't work.
- Apply patch.
- Repeat both, search and sort.
- Verify both work correctly now.
- Repeat tests on a UNIMARC installation.
- Verify both still work.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Tested searching and sorting successfully in a MARC21 installation. DID
NOT test in UNIMARC.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 19 Jonathan Druart 2015-12-02 11:39:05 UTC
Created attachment 45316 [details] [review]
Bug 14636: Item search - improving display

- Changes "Publication Date" to "Publication date"
  in the CSV export
- Fixes 'no JavaScript fallback' display to match
  the normal display
  - only show 'by' when it's UNIMARC and an author
    exist
  - show copyrightdate if publicationyear is empty

To test:
- Turn of Javascript in your browser before you
  item search. This will activate the alternative
  display.
- For MARC21:
  - Verify that the author displays when existing
    and no 'by' is shown.
  - Verify that the publication date is now shown.
- For UNIMARC:
  - Verify that 'by' only displays when there is
    an author to display.
  - Verify that the publication date is still
    shown.
- Try the CSV export.
- Verify that the CSV header now reads 'Publication date'.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Successfully tested non-JS behavior and CSV export. DID NOT test
UNIMARC.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 20 Jonathan Druart 2015-12-02 11:39:10 UTC
Created attachment 45317 [details] [review]
Bug 14636: Item search - biblioitems column is publicationyear not publicationdate

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Thx for the follow-up!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 21 Jonathan Druart 2015-12-02 11:39:13 UTC
Created attachment 45318 [details] [review]
Bug 14636: Follow-up - fix typo in system preference name

The preference is named "marcflavour" not "marcflavor".

Without this change, search will always use "copyrightyear"
and break search by publication date for UNIMARC.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Jonathan Druart 2015-12-02 11:39:16 UTC
Created attachment 45319 [details] [review]
Bug 14636: Remove debug message

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Kyle M Hall 2015-12-30 12:50:32 UTC
Pushed to master! Thanks Katrin, Frido and Jonathan!
Comment 24 Julian Maurice 2015-12-31 09:33:04 UTC
Patches pushed to 3.22.x, will be in 3.22.2
Comment 25 Frédéric Demians 2015-12-31 18:30:56 UTC
This patch has been pushed to 3.20.x, will be in 3.20.8.