Bug 17118 - Regression: Bug 15381 triggers error when trying to clear a linked authority
Summary: Regression: Bug 15381 triggers error when trying to clear a linked authority
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 15381
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-12 16:28 UTC by Owen Leonard
Modified: 2017-12-07 22:17 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 17118: (follow-up 15381) Fix regression when clearing a linked authority (2.43 KB, patch)
2016-08-19 15:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17118: (follow-up 15381) Fix regression when clearing a linked authority (2.50 KB, patch)
2016-08-22 04:36 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[PASSED QA] Bug 17118: (follow-up 15381) Fix regression when clearing a linked authority (2.55 KB, patch)
2016-08-28 19:20 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2016-08-12 16:28:28 UTC
To reproduce:

1. Edit a record which has a field linked to an 
   authority record (100a for instance).
2. Click the link which triggers the tag editor.
   A pop-up window should be displayed.
3. In the pop-up window, click the "Clear field"
   button.
4. A second pop-up window opens and displays an error:

Can't call method "authtypecode" on an undefined value at /authorities/blinddetail-biblio-search.pl line 61.
Comment 1 Jonathan Druart 2016-08-19 15:15:22 UTC Comment hidden (obsolete)
Comment 2 Aleisha Amohia 2016-08-22 04:36:23 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2016-08-28 19:20:29 UTC
Created attachment 54956 [details] [review]
[PASSED QA] Bug 17118: (follow-up 15381) Fix regression when clearing a linked authority

Changes made on bug 15381 assumed that the authid was always set.
But if the user wants to clear the field of the authority, the script is
called with authid=0 (FIXME...)

To fix this issue, it's better to move the new calls to
  Koha::Authorities->find($authid)->authtypecode
and
  Koha::Authority::Types->find($authtypecode);
at the correct place

Test plan:
1. Edit a record which has a field linked to an
   authority record (100a for instance).
2. Click the link which triggers the tag editor.
   A pop-up window should be displayed.
3. In the pop-up window, click the "Clear field"
   button.
=> Without this patch A second pop-up window opens and displays an error:
  Can't call method "authtypecode" on an undefined value at /authorities/blinddetail-biblio-search.pl line 61.
=> With this patch applied the field is correctly cleared.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 4 Kyle M Hall 2016-09-02 15:01:40 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 5 Frédéric Demians 2016-09-08 19:35:02 UTC
Pushed in 16.05. Will be in 16.05.04.