2 # script that rebuild thesaurus from biblio table.
4 # delete FROM `marc_subfield_table` WHERE tag = "606" AND subfieldcode = 9;
6 #use warnings; FIXME - Bug 2505
11 use C4
::AuthoritiesMarc
;
12 use Time
::HiRes
qw(gettimeofday);
15 my ( $fields, $number,$language) = ('',0);
16 my ($version, $verbose, $test_parameter, $field,$delete,$subfields);
20 't' => \
$test_parameter,
26 if ($version or !$fields) {
28 Small script to recreate the LANG list in authorised values from existing langs in the catalogue.
29 This script is useful when you migrate your datas with bulkmarcimport.pl as it populates parameters tables that are not modified by bulkmarcimport.
32 \th : this version/help screen
33 \ts : the field or field list where the lang codes are stored.
34 \td : delete every entry of LANG category before doing work.
35 \tl : the language of the language list (fr or en for instance)
37 The table is populated with iso codes and meaning (in french).
38 If the complete language name is unknown, the code is used instead and you will be warned by the script
41 ./buildLANG -d -s "('101a','101b')"
57 'mul' => 'multilingue',
63 'ang' => 'anglo-saxon (ca. 450-1100)',
77 'dum' => 'néerlandais moyen (ca. 1050-1350)',
78 'dut' => 'néerlandais',
83 'fra' => 'français ancien',
85 'frm' => 'français moyen (ca. 1400-1600)',
86 'fro' => 'français ancien (842-ca. 1400)',
87 'gmh' => 'allemand, moyen haut (ca. 1050-1500)',
89 'grc' => 'grec classique',
90 'gre' => 'grec moderne',
94 'ind' => 'indonésien',
95 'ine' => 'indo-européennes, autres',
100 'lan' => 'occitan (post 1500)',
102 'map' => 'malayo-polynésiennes, autres',
104 'nic' => 'nigéro-congolaises, autres',
105 'nor' => 'norvégien',
107 'pro' => 'provencal ancien (jusqu\'à 1500)',
109 'por' => 'portugais',
113 'sam' => 'samaritain',
115 'scr' => 'serbo-croate',
116 'sem' => 'sémitique, autres langues',
118 'sla' => 'slave, autres langues',
124 'uga' => 'ougaritique',
128 ) if $language eq 'fr';
130 my $dbh = C4
::Context
->dbh;
132 print "deleting lang list\n";
133 $dbh->do("delete from authorised_values where category='LANG'");
136 if ($test_parameter) {
137 print "TESTING MODE ONLY\n DOING NOTHING\n===============\n";
139 my $starttime = gettimeofday
;
141 my $sth = $dbh->prepare("SELECT DISTINCT subfieldvalue FROM marc_subfield_table WHERE tag + subfieldcode IN $fields order by subfieldvalue");
146 print "=========================\n";
147 my $sth2 = $dbh->prepare("insert into authorised_values (category, authorised_value, lib) values (?,?,?)");
148 while (my ($langue) = $sth->fetchrow) {
149 $sth2->execute('LANG',$langue,$langue?
$codesiso{$langue}:$langue);
150 print "lang : $langue is unknown is iso list\n" unless $codesiso{$langue};
152 print "=========================\n";