[Koha-devel] 001 in 3.8.x

Paul paul.a at aandc.org
Thu Oct 11 23:33:47 CEST 2012


We are - perhaps erroneously - coming to the conclusion that a part (major? 
minor?) of our "authorities" and possibly "other" problems in 3.8.4/5 is 
due to field 001.  Error messages such as "Can't call method "data" on an 
undefined value at /usr/share/koha/lib/C4/AuthoritiesMarc.pm line 335" lead 
to 'my $authid=$authrecord->field('001')->data();'

Philosophically - again perhaps erroneously - the definition of 001 does 
not require absolute uniqueness, but, taken in conjunction with 003 they 
should be [1]. We (unfortunately and for whatever reasons) have several 
hundred "duplicates" all with our 003 CaOPIACS attached.  Our cataloguers 
are having a lengthy discussion about "our" responsibility, "original 
agency", "transcribing agency", "modifying agency" without any firm 
conclusion. So I'm left with the IT side of things ;={

Without major risk to the sql db, I am looking for a way to correct these, 
but will probably end up "editing" using the Koha interface -- but I am 
running into trouble and would appreciate some advice.

We can't ask the cataloguers to "remember" the last number used, so in 
3.6.1 I wrote a "plugin" called by field 001 from addbiblio based 
(extremely closely) on callnumber.pl that served us well. The only relevant 
changed line is:

     my $dbh = C4::Context->dbh;
     # If the textbox is empty, we return a simple incremented callnumber
     if ( $code eq "" ) {
     #  my $sth = $dbh->prepare("SELECT MAX(CAST(itemcallnumber AS SIGNED)) 
FROM items");
     #################
     # replaced with #
     #################
     	my $sth = $dbh->prepare("SELECT 
MAX(CAST(TRIM(EXTRACTVALUE(marcxml,'//controlfield[\@tag=\"001\"]')) AS 
UNSIGNED)) from biblioitems where 
EXTRACTVALUE(marcxml,'//controlfield[\@tag=\"003\"]') = 'CaOPIACS'");

         $sth->execute;

         if ( my $max = $sth->fetchrow ) {
             $template->param(
                 return => $max+1,
             );
         }

It works well *if* the cataloguer (after clicking on the 003 to bring it to 
our framework default, books, fastadd, etc of 'CaOPIACS') remembers to 
delete the 001 and click on the icon.

Could this be automated? i.e. IF {003 has changed} THEN {blank out 001} END 
IF  (note I have made 001 mandatory, so records will not save with a blank 
entry.)  I am just not savvy enough with the intracicies of perl to mysql 
to template, etc, coding. Or maybe a js guru could find something for 
addbiblio.js which seems to be empty...?

Also (my dream to avoid manually editing hundreds of records), could any of 
you possibly come up with some mysql code to replace duplicates (I can 
define the starting number for replacement values).  Or, maybe, (I'm sure 
there must have been a good reason not to use biblionumber for indexing 
zebra) just replace duplicate 001s with biblionumber (in my case, not 
necessarily true for anyone else, all out biblionumbers are less than 7 
digits, and our 001s (and as far as I can see other major libraries via 
Z39.50) are at least 8 digits

Many thanks and best regards,
Paul

Note [1]: from LoC <http://www.loc.gov/marc/bibliographic/bd001.html>
001 - Control Number (NR)
MARC 21 Bibliographic - Full
FIELD DEFINITION AND SCOPE
Contains the control number assigned by the organization creating, using, 
or distributing the record. For interchange purposes, documentation of the 
structure of the control number and input conventions should be provided to 
exchange partners by the organization initiating the interchange. The MARC 
code identifying whose system control number is present in field 001 is 
contained in field 003 (Control Number Identifier).



More information about the Koha-devel mailing list