Bug 13980 - Can't call method "fields" on an undefined value at /usr/share/koha/intranet/cgi-bin/cataloguing/additem.pl
Summary: Can't call method "fields" on an undefined value at /usr/share/koha/intranet/...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: PC Linux
: P5 - low major (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-11 20:19 UTC by Bob Ewart
Modified: 2017-06-14 22:10 UTC (History)
5 users (show)

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


Attachments
excerpt from /var/log/koha/koha-error_log (27.94 KB, text/plain)
2015-04-11 20:19 UTC, Bob Ewart
Details
Steps to get "Internal server error" (69.52 KB, image/png)
2016-08-19 08:38 UTC, Marc Véron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Ewart 2015-04-11 20:19:14 UTC
Created attachment 37680 [details]
excerpt from /var/log/koha/koha-error_log

This error occurs when trying to save the following MARC record from the Amicus Z39.50 server:

01800cam  2200349 a 4500
001 000042344666
003 CaOOAMICUS
005 20140203      .0
008 110402s2011    ohu           000 1 eng d
020    $a 9781609282066 (pbk.)
020    $a 160928206X (pbk.)
040    $a CaBVA $b eng
043    $a n-us-ma
100 1  $a Lanyon, Josh.
245 10 $a All she wrote / $c Josh Lanyon.
260    $a Cincinnati, OH : $b Samhain Pub., $c c2011.
300    $a 270 p. ; $c 22 cm.
490 1  $a Holmes & Moriarity ; $v book 2
520    $a A murderous fall down icy stairs is nearly the death of Anna Hitchcock, the much-beloved "American Agatha Christie" and Christopher Holmes' former mentor. Anna's plea for him to host her annual winter writing retreat touches all Kit's sore spots-- traveling, teaching writing classes, and separation from his new lover, J.X. Moriarity. For J.X., Kit's cancellation of yet another romantic weekend is the death knell of a relationship that has been limping along for months. Soon Kit is snooping around Anna's elegant, snowbound mansion in the Berkshires for clues as to who's trying to kill her. Unfortunately, a clever killer is one step ahead. And it may be too late for J.X. to ride to the rescue.
650  0 $a Holmes, Christopher (Fictitious character) $v Fiction.
650  0 $a Moriarity, J. X. (Fictitious character) $v Fiction.
650  0 $a Private investigators $v Fiction.
650  0 $a Authors $v Fiction.
650 00 $a Ex-police officers as detectives $v Fiction.
650  0 $a Gay men $v Fiction.
650  0 $a Murderers $v Fiction.
651  0 $a Berkshire Hills (Mass.) $v Fiction.
655  4 $a Mystery fiction.
655  4 $a Gay fiction.
655  4 $a Erotic stories.
800 1  $a Lanyon, Josh. $t Holmes & Moriarity  ; $v bk. 2 ; $v bk. 2.
852    $9 1 $a CaBVA $z ILL: yes

Do a Z39.50 search on author 'lanyon, josh' and import the record for 'All she wrote'.  It fails when trying to save the record on Koha 3.18.05 running on openSUSE built from a tarball.

It works on Koha 3.18.04 running on Debian 7 installed from koha-common.
Comment 1 Bob Ewart 2015-04-13 15:12:14 UTC
Looks like this may be a duplicate of bug 5377 
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5377

At any rate changing the isbn/issn fields in biblioitems fixes the problem.
Comment 2 Joonas Kylmälä 2015-08-25 08:43:51 UTC
I get this error still:
Can't call method "fields" on an undefined value at /home/koha/kohaclone/cataloguing/additem.pl line 703.

I was importing a new item and I koha said that there is duplicate record, I clicked then: Yes, edit existing items and this error popped up. I guess there was a problem with zebra indexing, but I think we should fix this error, maybe just show a message which could suggest what is wrong.
Comment 3 Jonathan Druart 2015-08-25 13:27:48 UTC
Could you please give more details, I don't get the error.
What values did you choose for the following params?
Record matching rule
Action if matching record found
Action if no match is found

and on the next screen.
Comment 4 Joonas Kylmälä 2015-08-25 13:52:57 UTC
(In reply to Jonathan Druart from comment #3)
> Could you please give more details, I don't get the error.
> What values did you choose for the following params?
> Record matching rule
> Action if matching record found
> Action if no match is found
> 
> and on the next screen.

The error comes most likely if you do as follows:
1. Delete all item records from database / delete the whole database and create it again.
2. Zebra/something leaves indexes there and you can still find the items in search.
3. Now go to cataloguing -> New from Z39.50.
4. Find a same record you have already in Koha (the one that you can find with search but it really isn't there).
5. Import that record.
6. Now I think it says that it has detected a duplicate of the record.
7. Press the button which merges / does something with those duplicates (the button on the left!)

The record I experienced this issue was from Z39.50, With a title of "Free running /" and data of "c2013.".
Comment 5 Joonas Kylmälä 2015-08-25 14:04:21 UTC
(In reply to Joonas Kylmälä from comment #4)
> (In reply to Jonathan Druart from comment #3)
> > Could you please give more details, I don't get the error.
> > What values did you choose for the following params?
> > Record matching rule
> > Action if matching record found
> > Action if no match is found
> > 
> > and on the next screen.
> 
> The error comes most likely if you do as follows:
> 1. Delete all item records from database / delete the whole database and
> create it again.
> 2. Zebra/something leaves indexes there and you can still find the items in
> search.
> 3. Now go to cataloguing -> New from Z39.50.
> 4. Find a same record you have already in Koha (the one that you can find
> with search but it really isn't there).
> 5. Import that record.
> 6. Now I think it says that it has detected a duplicate of the record.
> 7. Press the button which merges / does something with those duplicates (the
> button on the left!)
> 
> The record I experienced this issue was from Z39.50, With a title of "Free
> running /" and data of "c2013.".

not data, date :)
Comment 6 Jonathan Druart 2015-08-25 14:57:41 UTC
I should have read the description of the bug...
Comment 7 Jonathan Druart 2015-08-25 15:42:17 UTC
I am not sure it's relevant.
The Zebra index is supposed to be up-to-date, the indexer processes the zebraqueue every minute.
Comment 8 Marc Véron 2016-08-18 13:20:33 UTC
I can reproduce the error with a tweaked URL:

http://192.168.1.29:8080/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=50123&itemnumber=22&searchid=#edititem

...where biblionumber 50123 does not exist

Result:
Can't call method "fields" on an undefined value at /usr/share/koha/intranet/cgi-bin/cataloguing/additem.pl line 742
Comment 9 Marc Véron 2016-08-18 19:28:41 UTC
To reproduce without tweaking the URL (can happen to users):

- Edit an item
- Save
- You are on .../cgi-bin/koha/cataloguing/additem.pl
- In header menu, right-click on any menu item, in context menu choose "Open link in new tab"
Result: New tab opens, "Internal Server Error", URL is .../cgi-bin/koha/cataloguing/additem.pl#
Comment 10 Jonathan Druart 2016-08-19 08:11:14 UTC
marc, I do not recreate. On which link do you click?
Comment 11 Marc Véron 2016-08-19 08:38:14 UTC
Created attachment 54597 [details]
Steps to get "Internal server error"

To reproduce:

- Add (not edit) a new item
- Right click e.g. on "Search" in the top menu bar
- Status line shows .../cgi-bin/koha/cataloguing/additem.pl#
- In context menu, choose "Open link in new tab"
Result: New tab opens with "Internal server error"
Comment 12 Marc Véron 2016-08-19 08:41:28 UTC
plack_error.log:
Can't call method "fields" on an undefined value at /home/marc/koha/cataloguing/additem.pl line 742.
 at /home/marc/koha/circ/returns.pl line 34.
Comment 13 Jonathan Druart 2016-08-22 12:41:46 UTC
Closing this bug as the original bug is certainly fixed.
Comment 14 Marc Véron 2016-08-22 17:10:54 UTC
(In reply to Marc Véron from comment #11)
> Created attachment 54597 [details]
> Steps to get "Internal server error"
> 
> To reproduce:
> 
> - Add (not edit) a new item
> - Right click e.g. on "Search" in the top menu bar
> - Status line shows .../cgi-bin/koha/cataloguing/additem.pl#
> - In context menu, choose "Open link in new tab"
> Result: New tab opens with "Internal server error"

Fixed by Bug 17157