Bug 22969 - fix biblionumber on 001 in UNIMARC XSLT
Summary: fix biblionumber on 001 in UNIMARC XSLT
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic data support (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Marcel de Rooy
URL:
Keywords:
: 18369 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-23 05:54 UTC by Fridolin Somers
Modified: 2021-12-13 21:09 UTC (History)
6 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:
20.05.00, 19.11.05, 19.05.10


Attachments
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT (3.89 KB, patch)
2019-05-23 05:57 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT (4.46 KB, patch)
2020-03-05 00:37 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT (4.58 KB, patch)
2020-03-06 07:48 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2019-05-23 05:54:41 UTC
In UNIMARC default configuration the 001 is linked to biblio.biblionumber.
In some XSLT files, 090$a is used.
This is by default biblioitems.biblionumber so it usually works but it may not be the same and var biblionumber is used to create hyperlinks to record detail page.
Comment 1 Fridolin Somers 2019-05-23 05:57:34 UTC
Created attachment 89994 [details] [review]
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT

In UNIMARC default configuration the 001 is linked to biblio.biblionumber.
In some XSLT files, 090$a is used.
This is by default biblioitems.biblionumber so it usually works but it may not be the same and var biblionumber is used to create hyperlinks to record detail page.

Test plan :
1) Use UNIMARC database
2) Set default in all XSLT system preferences
3) At OPAC, perform a search and click on a result
4) Check displayed page shows the correct biblio record
5) Same at intranet
Comment 2 Andreas Roussos 2019-05-23 17:08:37 UTC
Hi Fridolin,

(In reply to Fridolin SOMERS from comment #0)
> In UNIMARC default configuration the 001 is linked to biblio.biblionumber.
> In some XSLT files, 090$a is used.
> This is by default biblioitems.biblionumber so it usually works but it may
> not be the same and var biblionumber is used to create hyperlinks to record
> detail page.
I think 090$a is linked to biblioitems.biblioitemnumber in UNIMARC default
configuration for English (see lines 75-76 of installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql).

While trying to sign off your patch I realised that in my test UNIMARC DB
with just four records the values for biblionumber and biblioitemnumber
are the same in the SQL tables that I checked:

MariaDB [koha_test]> SELECT biblionumber FROM biblio ;
+--------------+
| biblionumber |
+--------------+
|            1 |
|            3 |
|            4 |
|            5 |
+--------------+

MariaDB [koha_test]> SELECT biblionumber, biblioitemnumber FROM biblioitems ;
+--------------+------------------+
| biblionumber | biblioitemnumber |
+--------------+------------------+
|            1 |                1 |
|            3 |                3 |
|            4 |                4 |
|            5 |                5 |
+--------------+------------------+

MariaDB [koha_test]> SELECT biblionumber, biblioitemnumber FROM items ;
+--------------+------------------+
| biblionumber | biblioitemnumber |
+--------------+------------------+
|            1 |                1 |
|            3 |                3 |
|            3 |                3 |
|            4 |                4 |
|            4 |                4 |
|            5 |                5 |
+--------------+------------------+

When I set all XSLT system preferences to 'default', the hyperlinks in
the search results work OK (without the patch applied).

So, under what circumstances does this problem occur?
How can I create a record that has biblionumber != biblioitemnumber?
Comment 3 Fridolin Somers 2019-05-27 12:14:07 UTC
(In reply to Andreas Roussos from comment #2)
> 
> So, under what circumstances does this problem occur?
> How can I create a record that has biblionumber != biblioitemnumber?

Hi, indeed it should usually not occur.
I think it sometimes appears when some insert in catalog fail to insert in biblio but create a row in biblioitems. In this case autoincrement of biblioitems.biblioitemnumber is higher than biblio.biblionumber.

You may try a modification in direct SQL :
UPDATE biblioitems SET biblioitemnumber = 6 WHERE biblioitemnumber=5;

Only for a test database !
Comment 4 Bernardo Gonzalez Kriegel 2020-03-05 00:37:54 UTC
Created attachment 100158 [details] [review]
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT

In UNIMARC default configuration the 001 is linked to biblio.biblionumber.
In some XSLT files, 090$a is used.
This is by default biblioitems.biblionumber so it usually works but it may not be the same and var biblionumber is used to create hyperlinks to record detail page.

Test plan :
1) Use UNIMARC database
2) Set default in all XSLT system preferences
3) At OPAC, perform a search and click on a result
4) Check displayed page shows the correct biblio record
5) Same at intranet

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested on clean UNIMARC install.
Before insert new records: "alter table biblioitems AUTO_INCREMENT = 5"
Added two records, with result:
+--------------+------------------+
| biblionumber | biblioitemnumber |
+--------------+------------------+
|            1 |                5 |
|            2 |                6 |
+--------------+------------------+
Without patch, OPAC results shows for first record
  http://opac/cgi-bin/koha/opac-detail.pl?biblionumber=5, Wrong!
with patch result is correct

Works, no errors
Comment 5 Marcel de Rooy 2020-03-06 07:48:02 UTC
Created attachment 100213 [details] [review]
Bug 22969: fix biblionumber on 001 in UNIMARC XSLT

In UNIMARC default configuration the 001 is linked to biblio.biblionumber.
In some XSLT files, 090$a is used.
This is by default biblioitems.biblionumber so it usually works but it may not be the same and var biblionumber is used to create hyperlinks to record detail page.

Test plan :
1) Use UNIMARC database
2) Set default in all XSLT system preferences
3) At OPAC, perform a search and click on a result
4) Check displayed page shows the correct biblio record
5) Same at intranet

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested on clean UNIMARC install.
Before insert new records: "alter table biblioitems AUTO_INCREMENT = 5"
Added two records, with result:
+--------------+------------------+
| biblionumber | biblioitemnumber |
+--------------+------------------+
|            1 |                5 |
|            2 |                6 |
+--------------+------------------+
Without patch, OPAC results shows for first record
  http://opac/cgi-bin/koha/opac-detail.pl?biblionumber=5, Wrong!
with patch result is correct

Works, no errors

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Martin Renvoize 2020-03-06 10:04:47 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 7 Joy Nelson 2020-04-01 22:26:14 UTC
Backported to 19.11.x for 19.11.05
Comment 8 Lucas Gass 2020-04-09 20:12:35 UTC
backported to 19.05.x for 19.05.10
Comment 9 Hayley Pelham 2020-04-20 00:01:44 UTC
Minor/normal patch will not be backported to 18.11.x series
Comment 10 George Veranis 2020-06-12 22:08:10 UTC
*** Bug 18369 has been marked as a duplicate of this bug. ***