Bug 5333

Summary: Undefined value stops import from z39.50
Product: Koha Reporter: Dafydd Crosby <dtcrsby>
Component: MARC Bibliographic record staging/importAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: normal    
Priority: P5 - low CC: chris, eb, jonathan.druart, judit, koha.sekjal, martin.renvoize, td-koha-bugs, tomascohen
Version: Main   
Hardware: All   
OS: Linux   
Change sponsored?: Sponsored Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 5333 - z3950 normalization should apply only on UNIMARC
Bug 5333 - z3950 normalization should apply only on UNIMARC
Bug 5333 - z3950 normalization should apply only on UNIMARC

Description Dafydd Crosby 2010-11-01 01:00:07 UTC
I'm having problems importing some records from z39.50. I had the issue with 3.00.01.005, so I updated to the git HEAD, but still having problems. The error I get is:

"Software error:

Can't call method "add_subfields" on an undefined value at /home/koha/kohaclone/cataloguing/addbiblio.pl line 142."

I've got a few records that should reproduce the problem (they're from AMICUS)

The MARC data of one book:
LDR 01554cam a22003854a 4500
001       2005281191
003     DLC
005     20091006      .0
008     050826s2005    cc            001 0 eng  
010    _a  2005281191
020    _a0596007973
040    _aDLC
       _beng
       _cDLC
       _dDLC
042    _apcc
050 00 _aQA76.73.P98
       _bP95 2005
082 00 _a005.13/3
       _222
245 00 _aPython cookbook /
       _cedited by Alex Martelli, Anna Martelli Ravenscroft, and David Ascher.
250    _a2nd ed.
260    _aBeijing ;
       _aSebastopol, CA :
       _bO'Reilly,
       _cc2005.
300    _axxxiii, 807 p. ;
       _c24 cm.
500    _a"Recipes from the Python community"--Cover.
500    _aIncludes index.
650  0 _aPython (Computer program language)
700 1  _aAscher, David.
700 1  _aMartelli, Alex.
700 1  _aMartelli Ravenscroft, Anna.
852    _91
       _aCaBVAS
       _hQA 76.73 P98 P983 2005
       _zILL: yes
852    _92
       _aCaNFSM
       _hQA 76.73 P98 P95 2005
       _zILL: yes
852    _93
       _aCaNSLAL
       _hQA 76.73 P98 P95 2005
       _zILL: yes
852    _94
       _aCaOOU
       _hQA 76.73 .P98 P95 2005      
       _zILL: yes
852    _95
       _aCaOPAL
       _hQA 76.73 P98P95 2005
       _zILL: yes
852    _96
       _aCaSPANI
       _hQA76.73.P98.P95 2005
       _zILL: yes
852    _97
       _aCaSRRE
       _hQA 76.73 P98 M3 2005
       _zILL: yes
856 42 _3Publisher description
       _uhttp://www.loc.gov/catdir/enhancements/fy0715/2005281191-d.html
856 42 _3Contributor biographical information
       _uhttp://www.loc.gov/catdir/enhancements/fy0912/2005281191-b.html
856 41 _3Table of contents only
       _uhttp://www.loc.gov/catdir/enhancements/fy1001/2005281191-t.html 


The MARC data of a CD:
LDR 01118cjm a2200265Ka 4500
001     000034984704
003     CaOOAMICUS
005     20090609      .0
007     sd fsngnnmmneu
008     080514s2008    xx   n              zxx d
024 8  _a00602517671836
024 1  _a602517671836
028 02 _aB0011135-02
       _bDGC/Interscope Records
040    _aCaBVA
       _beng
       _cBTCTA
       _dJBU
110 2  _aWeezer (Musical group)
245 10 _aWeezer
       _h[sound recording].
246 1  _iAlso known as:
       _aRed album
       _h[sound recording]
260    _aSanta Monica, CA :
       _bDGC/Interscope Records,
       _cp2008.
300    _a1 sound disc :
       _bdigital, stereo ;
       _c4 3/4 in.
500    _aRock songs, chiefly by Rivers Cuomo.
505 00 _tTroublemaker
       _g(2:44) --
       _tGreatest man that ever lived (Variations on a Shaker hymn)
       _g(5:52) --
       _tPork and beans
       _g(3:09) --
       _tHeart songs
       _g(4:05) --
       _tEverybody get dangerous
       _g(4:02) --
       _tDreamin'
       _g(5:11) --
       _tThought I knew
       _g(3:01) --
       _tCold dark world
       _g(3:51) --
       _tAutomatic
       _g(3:078) --
       _tAngel and the one
       _g(6:46).
538    _aCompact disc.
650  0 _aRock music
       _y2001-2010.
700 1  _aCuomo, Rivers.
852    _91
       _aCaBVA
       _zILL: no
Comment 1 Judit 2011-10-24 23:33:17 UTC
We have encountered this issue again in Koha 3.4.5 at
cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=0&z3950=1&breedingid=433

The message now is: Can't call method "add_subfields" on an undefined value at /usr/share/koha/intranet/cgi-bin/cataloguing/addbiblio.pl line 145.

We applied the solution at : http://koha.1045719.n5.nabble.com/Can-t-import-MARC-records-td3283577.html, which is to set the sys pref z3950NormalizeAuthor z3950AuthorAuthFields to 'Don't copy'.  However this sys pref is only relevant to Unimarc and we are using MARC21.

The default value is 'Don't copy' so its only a problem is this gets changed.
Comment 2 Tomás Cohen Arazi (tcohen) 2012-09-20 17:27:37 UTC
Still present on 3.8.x. This code should be removed and the related preferences too, until we have proper crosswalks to do this well.
Comment 3 Elaine Bradtke 2013-01-31 00:07:09 UTC
Also in 3.10.0
 set the sys pref z3950NormalizeAuthor z3950AuthorAuthFields to 'Don't copy' fixed it.
Comment 4 Martin Renvoize (ashimema) 2013-02-27 10:55:05 UTC
Really.. we should add a patch that disables changing that pref if MARC21 is in use.
Comment 5 Tomás Cohen Arazi (tcohen) 2013-02-27 13:49:47 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2013-02-27 21:20:04 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize (ashimema) 2013-02-28 09:22:47 UTC
Nice work, I was about to do a similar fix when I found you'd already implemented it.. and it's even been signed off to boot!

Great work guys!
Comment 8 Jonathan Druart 2013-02-28 09:30:46 UTC
QA comment:

Looks good to me (but I am not a MARC21 user).
According to the comment, the author normalization is unimarc specific.

Marked as Passed QA.
Comment 9 Jonathan Druart 2013-02-28 09:32:15 UTC
Created attachment 15755 [details] [review]
Bug 5333 - z3950 normalization should apply only on UNIMARC

It's been a while since this bug is around. This normalization is only
used for UNIMARC and yields a fatal error when those variables are set
on (at least) MARC21 setups.

Regards
To+

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: update comment
Comment 10 Jared Camins-Esakov 2013-03-01 00:11:38 UTC
This patch has been pushed to master.
Comment 11 Chris Cormack 2013-03-11 09:06:29 UTC
Pushed to 3.10.x and 3.8.x will be in 3.10.4 and 3.8.11