2 # script that rebuild thesaurus from biblio table.
7 use MARC::File::USMARC;
12 use C4::AuthoritiesMarc;
13 use Time::HiRes qw(gettimeofday);
16 my ( $input_marc_file, $number) = ('',0);
17 my ($version,$confirm);
23 if ($version || ($confirm eq '')) {
25 Script that compare the datas in the DB and the setting of MARC structure
26 It show all fields/subfields that are in the MARC DB but NOT in any tab (= fields used but not visible) Usually, this means you made an error in your MARC editor. Sometimes, this is something normal.
28 Enter $0 -c to run this script (the -c being here only to "confirm"
34 my $dbh = C4::Context->dbh;
36 my $sth = $dbh->prepare("SELECT count(*), tag, subfieldcode, frameworkcode FROM marc_subfield_table, marc_biblio WHERE marc_biblio.bibid = marc_subfield_table.bibid group by frameworkcode,tag,subfieldcode");
38 my $sth2 = $dbh->prepare("select tab,liblibrarian,kohafield from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?");
39 while (my ($total,$tag,$subfield,$frameworkcode) = $sth->fetchrow) {
40 $sth2->execute($tag,$subfield,$frameworkcode);
41 my ($tab,$liblibrarian,$kohafield) = $sth2->fetchrow;
42 if ($tab eq -1 && $kohafield ne "biblio.biblionumber" && $kohafield ne "biblioitems.biblioitemnumber" && $kohafield ne "items.itemnumber") {
43 print "Tab ignore for framework $frameworkcode, $tag\$$subfield - $liblibrarian (used $total times)\n";