Bug 4838 - Repeated authority headings break biblio record data entry form
Summary: Repeated authority headings break biblio record data entry form
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: 3.8
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Frédéric Demians
QA Contact: Bugs List
Depends on:
Blocks: 7442
  Show dependency treegraph
Reported: 2010-05-30 07:23 UTC by Frédéric Demians
Modified: 2013-12-05 19:59 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

A screenshot illustrating the problem with repets with no real repets (69.12 KB, image/png)
2011-06-05 18:00 UTC, Janusz Kaczmarek
Proposed patch for 3.8 (and HEAD) (2.39 KB, patch)
2012-06-05 11:03 UTC, Frédéric Demians
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 4838 Fix repeated authorities selection (2.47 KB, patch)
2012-06-10 09:55 UTC, Francois Charbonnier
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Demians 2010-05-30 07:23:02 UTC
If you have an authority, with more than one heading, for example a
UNIMARC multilingual author:

  200 $7 da
      $a 原
      $b 純輔
  200 $7 ba
      $a Hara
      $b Junsuke

In data entry form, you click on ..., you find such an authority, you
click on Choose. The result is messed up. $9 is not copied and $7
content modify $9 code into $ba.
Comment 2 Frédéric Demians 2010-12-09 20:47:38 UTC
I rebased this patch on HEAD:


I need it. It doesn't hurt anything. It's not easy to test because multilingual authorities are required. So I will post a screencast to show how it works.
Comment 3 Frédéric Demians 2010-12-10 06:33:51 UTC
Screencast of bug-solution:

Comment 4 Chris Cormack 2010-12-21 03:52:11 UTC
Pushed to new/bug_4838, please test with both MARC21 and UNIMARC then let me know and I will merge it.
Comment 5 MJ Ray (software.coop) 2011-01-06 10:17:30 UTC
This bug is mentioned in:
Bug 4838 Allow to choose which	authority heading to copy into biblio record http://lists.koha-community.org/pipermail/koha-patches/2010-December/013439.html
Comment 6 Chris Cormack 2011-01-09 20:13:10 UTC
Have tested with MARC21 seems ok, merging please test and mark resolved
Comment 7 Janusz Kaczmarek 2011-06-05 17:59:01 UTC
This patch, beside that it adds some enhancements, introduces also problems with UNIMARC authorities, if summary is defined for UNIMARC authorities according to the standard settings from installation files (e.g. autorites_norme_unimarc.sql) 

Try this (having authorities summaries defined in the standard form, cf. autorites_norme_unimarc.sql or screenshot and subsequent subfields in authority records defined as well):

1. Go: Cataloguing --> New Record
2. Go to a field controlled by authority, of which you know that has has "--" in summary and subfields preceded by "--" defined, e.g. SNC in standard UNICODE situation with x, y or z subfields
3. Click on ...
4. Search for such a term which has x, y or z defined (and a of course)
5. Try to click on 2 next to search result

You should get en error (cf. screenshot).

This is because of the following:  

In the patch 4838 a notion of "repet" is introduced.  In line 77 of auth_finder.pl "--" is used to extract (in fact: guess) the subsequent repets from summary (produced by C4::BuildSummary).  BUT if there is only one heading field in the authority record and by chance this field contains subfields, which--according to the summary template--will be separated by two dashes, then "repets" will be created (whereas should not) and by clicking on 2 you get in troubles in blinddetail-biblio-search.pl, when executing:

    my $field = $fields[$repet];
    for ( $field->subfields ) {

In described scenario, $field is not defined (@fields has only one element), hence you get error.

What can be done?  My ideas about it:  Either one should modify the patch in a way that it will guess "repets" correctly OR change the default summary templates in autorites_norme_unimarc.sql AND (warn people using UNIMARC to modify their existing summaries templates OR make the modification for them in updatedatabase.pl).

BTW changing the template to something like "[250a][ - 250x][ - 250y][ - 250z] [(250b)]" (one dash instead of two) helps, of course.
Comment 8 Janusz Kaczmarek 2011-06-05 18:00:19 UTC Comment hidden (obsolete)
Comment 9 Frédéric Demians 2011-12-02 07:45:50 UTC
> BTW changing the template to something like "[250a][ - 250x][ - 250y][ - 250z]
> [(250b)]" (one dash instead of two) helps, of course.

I confirm the bug, the diagnostic and the above solution (that I prefer to others...). Would you mind sending a patch replacing '--' with '-'?
Comment 10 Frédéric Demians 2012-06-05 10:53:22 UTC
In 3.8, this functionality doesn't work anymore. Recent work on authorities broke the template which was distinguishing authorities repetitions.
Comment 11 Frédéric Demians 2012-06-05 11:03:18 UTC Comment hidden (obsolete)
Comment 12 Francois Charbonnier 2012-06-10 09:54:36 UTC
I tested this patch with Frederic indications and it works fine.
I tested both links, everything was ok.
Comment 13 Francois Charbonnier 2012-06-10 09:55:34 UTC
Created attachment 10066 [details] [review]
[SIGNED-OFF] Bug 4838 Fix repeated authorities selection

How to test:

Create an authority, with more than one heading, for example a
UNIMARC multilingual author:

  200 $7 da
      $a 原
      $b 純輔
  200 $7 ba
      $a Hara
      $b Junsuke

In data entry form, on 700 field, you click on ... Search for the above author.
In auhtority search result page, you just have a 'Choose' link, and so you just
can select the first heading (in Chinesse writing).

Apply the patch. Repeat. Now you have, on result page, you have two links, and
can select one heading or the other.

Signed-off-by: François Charbonnier <francois.charbonnier@biblibre.com>
Comment 14 Paul Poulain 2012-06-10 12:11:48 UTC
QA comment: template only changes that switches from a single display to a loop in case a value is repeated. passed QA
Comment 15 Paul Poulain 2012-06-10 12:12:19 UTC
Lowering severity as the case is quite rare, but it's a bugfix, so valuable in 3.8
Comment 16 Chris Cormack 2012-06-14 06:52:27 UTC
Pushed to 3.8.x will be in 3.8.2