Hi Koha-devel group, I just ran some SQL queries that changed the biblioitems.marcxml blob, but did not change the biblioitems.marc blob. What are the implications of this, and how can I fix this?
It seems like I should be able to just do this to 'resync' these two fields: for each biblio, call biblio = GetBiblio call ModBiblio (biblio) Can someone please confirm? (or is there a better way to do this?) (Scroll down for more background info) Thanks, Pete. Background: During the bulk import process some of our biblios were imported with incorrect 952$8 Collection code (should be in CCODE authorised values list), and 952$c Shelving Location Code (should be in LOC authorised values list). E.g. "military o/s", should be "military o_s" which maps to "Military oversized" in the CCODE list. For this discussion let's assume that both 952$8, and 952$c need to be changed from "military o/s" to "military o_s". I thought I was being clever and used SQL directly to replace "miltary o/s" with "military o_s" in 4 places: 1. items.location 2. biblioitems.marcxml : field 952$c 3. items.ccode 4. biblioitems.marcxml : field 952$8 Sample SQL queries: # items.location UPDATE items SET items.location = REPLACE(items.location, 'o/s', 'o_s') WHERE items.location LIKE '%o/s%'; # marcxml blob 952$c UPDATE biblioitems SET marcxml = REPLACE(marcxml, 'rare/box', 'rare_box') WHERE extractvalue(biblioitems.marcxml,'//datafield[@tag="952"]/subfield[@code="c"]') = 'rare/box'; # items.ccode UPDATE items SET items.ccode = REPLACE(items.ccode, 'catalog', 'catalogue') WHERE items.ccode = 'catalog'; # marc blob: 952$8 UPDATE biblioitems SET marcxml = REPLACE(marcxml, 'catalog', 'catalogue') WHERE extractvalue(biblioitems.marcxml,'//datafield[@tag="952"]/subfield[@code="8"]') = 'catalog'; Then I realized that there is a second marc blob (biblioitems.marc) in addition to the marcxml blob (biblioitems.marcxml) - which looks like compiled marc? - that I did not change - yikes! When I look in lib/C4 it looks like GetBiblio (which calls GetBiblioMarc) uses the $marcxml to compose a Biblio $record. Biblio.pm@GetBiblioMarc: $record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour') ) }; And it seems that ModBiblio (which calls ModBiblioMarc) compiles the $record into both formats, the marcxml blob, and the us_marc blob (compiled MARC?). Biblio.pm@ModBiblioMarc: $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?"); $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber ); $sth->finish; There are also the following functions in Record.pm that look promising: Record.pm@{marc2marcxml,marcxml2marc, changeEncoding} It seems that generally biblioitems.marcxml is used more than the biblioitems.marc blob. It seems like I should be able to just, for each biblio, call GetBiblio followed by ModBiblio to 'resync' these two fields. Can someone please confirm? _______________________________________________ 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/