Bug 11399: batch Rebuild Items Tables
authorStéphane Delaune <stephane.delaune@biblibre.com>
Tue, 17 Dec 2013 11:46:39 +0000 (12:46 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 23 Apr 2015 15:46:28 +0000 (12:46 -0300)
commitb1b0265f73f8a0f9f51b6fb0c02fcfc8e6e323f5
treed9559546efd79c5ed2366d8e3f6dcef37ac62b44
parenta510a4515c9a62ad6005f2eb997496d403dd4247
Bug 11399: batch Rebuild Items Tables

You can/must use it when you change items mapping.
this script rebuilds the non-MARC DB items table from the MARC values

usage : batchRebuildItemsTables.pl [ -h ][ -c ][ -t ][ -where ]

Options:
   -h --help       (or without arguments) shows this help message
   -c              Confirm: rebuild non marc DB (may be long)
   -t              test only, change nothing in DB
   --where         add where condition on default query
                   (eg. -where 'biblio.biblionumber<100')

(copied test plan)
to test it :

create a test item (eg on biblionumber 3) with a non mapped subfield with a test value.
check real items DB row ( SELECT * from items where biblionumber=3 ) => non mapped value is in more_subfields_xml
map the non mapped subfield with unused items column
re-check in Db that nothing changes
run ./batchRebuildItemsTables.pl -c --where 'biblio.biblionumber=3'
check real items DB row ( SELECT * from items where biblionumber=3 ) => new mapped value is not in more_subfields_xml anymore but in the mapped column

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors.
Add a new item to record, save with value in unmapped subfield ('x')
Change mapping, run script, value on newly mapped column

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
misc/batchRebuildItemsTables.pl [new file with mode: 0755]