At 08:32 PM 3/6/2015 -0500, Christopher Nighswonger wrote:
On Fri, Mar 6, 2015 at 8:20 PM, Paul A <<mailto:pau...@navalmarinearchive.com>pau...@navalmarinearchive.com> wrote:
[snip] All these marc(xml) errors originate back in 2011 (some 3.2, some 3.4 according to items.datelastseen.)

Have a look at this script:

<http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=misc/maintenance/remove_items_from_biblioitems.pl;h=9f30db05f36c127da0d7d6ea50971e6b03dff35e;hb=HEAD>http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=misc/maintenance/remove_items_from_biblioitems.pl;h=9f30db05f36c127da0d7d6ea50971e6b03dff35e;hb=HEAD

Maybe it will help you clean things up.

Chris -- just what the doctor ordered, thank you much indeed. This has solved the problem of advanced search picking up erroneous shelving locations. For the completeness of the record, here are my notes:

*** a) determine if biblioitems.marc(xml) includes item data

mysql> SELECT items.biblioitemnumber AS BiblioNum,items.barcode AS BarCode,items.datelastseen AS Date,items.location AS Shelf952c, ExtractValue(marcxml,'//datafield[@tag="952"]/subfield[@code="c"]') AS ShelfMARCxml FROM items LEFT JOIN biblioitems ON (items.biblioitemnumber=biblioitems.biblioitemnumber) WHERE ExtractValue(marcxml,'//datafield[@tag="952"]/subfield[@code="c"]') != '' ORDER BY Date;
+-----------+---------------+------------+-----------------------+------------------+
| BiblioNum | BarCode | Date | Shelf952c | ShelfMARCxml |
+-----------+---------------+------------+-----------------------+------------------+
| 43 | 1MESL09120001 | 2011-03-10 | merchant | box_rr24 | | 460 | 1MEGN09120015 | 2011-03-10 | merchant | box_rr39 | | 470 | 1MEGN09100005 | 2011-03-10 | box_rr_fl3 | box_rr_fl3 | | 476 | 1NVUS00070001 | 2011-03-10 | navy RCN | navy | | 486 | 1BIOL03010001 | 2011-03-10 | oceanography | biology marine | | 490 | 1181200090002 | 2011-03-10 | 2fl_rare | rare |
/.../
+-----------+---------------+------------+-----------------------+------------------+
8337 rows in set (0.91 sec)

*** b) optionally, manually verify a few biblios

N.B.  Formats better for fast check as a Koha saved report:
SELECT * FROM biblio
RIGHT JOIN biblioitems ON biblio.biblionumber=biblioitems.biblionumber
LEFT JOIN items ON biblio.biblionumber=items.biblionumber
WHERE items.biblionumber = <<Pick your biblio number>>

or CLI (well snipped):

mysql> SELECT marc,marcxml FROM biblioitems WHERE biblionumber=43;
+----------/.../---+
| 00667nam a2200193Ia 450000100030000000300090000300800410001202000150005304000240006810000200009225000060011226000330011830000130015165000390016494200100020324500800021395201690029399900110046243CaOPIACS110310t19781978xx 000 0 und d a0395264499 aOPIACSbENGcOPIACS1 aAdkins, Jan999 a1 bHoughton Mifflinc1978g1978 bb/w 3hb 7aMerchant ships - sail2OPIACS9101 cBK2z10aWooden Ship :bthe building of a wooden sailing vessel in 1870cAdkins, Jan 40xvg/vg/mylar ex-liberr00943bOPIACS10d20091215zjunior: good pencil sketches, construction of an imaginary whaler8merch_sail71cbox_rr24g30.00yBKaOPIACS c43d43 | <?xml version="1.0" encoding="UTF-8"?>
<record
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
/.../
  <datafield tag="952" ind1=" " ind2=" ">
    <subfield code="4">0</subfield>
    <subfield code="x">vg/vg/mylar ex-lib</subfield>
    <subfield code="e">rr</subfield>
    <subfield code="0">0</subfield>
    <subfield code="9">43</subfield>
    <subfield code="b">OPIACS</subfield>
    <subfield code="1">0</subfield>
    <subfield code="d">20091215</subfield>
<subfield code="z">junior: good pencil sketches, construction of an imaginary whaler</subfield>
    <subfield code="8">merch_sail</subfield>
    <subfield code="7">1</subfield>
    <subfield code="c">box_rr24</subfield>
    <subfield code="g">30.00</subfield>
    <subfield code="y">BK</subfield>
    <subfield code="a">OPIACS</subfield>
  </datafield>
  <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="c">43</subfield>
    <subfield code="d">43</subfield>
  </datafield>
</record>
 |
+----------/.../---+
1 row in set (0.00 sec)

*** c) Remove item data from biblioitems.marc(xml)

koha@hood:/usr/share/koha/bin/maintenance$ ./remove_items_from_biblioitems.pl --run

*** d) Verify:

mysql> SELECT items.biblioitemnumber AS BiblioNum,items.barcode AS BarCode,items.datelastseen AS Date,items.location AS Shelf952c, ExtractValue(marcxml,'//datafield[@tag="952"]/subfield[@code="c"]') AS ShelfMARCxml FROM items LEFT JOIN biblioitems ON (items.biblioitemnumber=biblioitems.biblioitemnumber) WHERE ExtractValue(marcxml,'//datafield[@tag="952"]/subfield[@code="c"]') != '' ORDER BY Date;
Empty set (0.55 sec)

Again, many thanks and best regards,
Paul

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to