Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
3 |
|
4 |
return { |
5 |
bug_number => "39418", |
6 |
description => "Adds RDA Carrier, Content, & Media Vocabularies", |
7 |
up => sub { |
8 |
my ($args) = @_; |
9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
10 |
|
11 |
# Carrier terms |
12 |
my $category = 'RDACARRIER'; |
13 |
my ($result) = $dbh->selectrow_array( |
14 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
15 |
undef, $category |
16 |
); |
17 |
if ($result) { |
18 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
19 |
} else { |
20 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
21 |
say $out "Added new authorised value category $category"; |
22 |
$dbh->do( |
23 |
qq| |
24 |
INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) |
25 |
VALUES |
26 |
('$category', 'audio cartridge', 'audio cartridge', 'audio cartridge'), |
27 |
('$category', 'audio belt', 'audio belt', 'audio belt'), |
28 |
('$category', 'audio cylinder', 'audio cylinder', 'audio cylinder'), |
29 |
('$category', 'audio disc', 'audio disc', 'audio disc'), |
30 |
('$category', 'sound track reel', 'sound track reel', 'sound track reel'), |
31 |
('$category', 'audio roll', 'audio roll', 'audio roll'), |
32 |
('$category', 'audio wire reel', 'audio wire reel', 'audio wire reel'), |
33 |
('$category', 'audiocassette', 'audiocassette', 'audiocassette'), |
34 |
('$category', 'audiotape reel', 'audiotape reel', 'audiotape reel'), |
35 |
('$category', 'computer card', 'computer card', 'computer card'), |
36 |
('$category', 'computer chip cartridge', 'computer chip cartridge', 'computer chip cartridge'), |
37 |
('$category', 'computer disc', 'computer disc', 'computer disc'), |
38 |
('$category', 'computer disc cartridge', 'computer disc cartridge', 'computer disc cartridge'), |
39 |
('$category', 'computer tape cartridge', 'computer tape cartridge', 'computer tape cartridge'), |
40 |
('$category', 'computer tape cassette', 'computer tape cassette', 'computer tape cassette'), |
41 |
('$category', 'computer tape reel', 'computer tape reel', 'computer tape reel'), |
42 |
('$category', 'online resource', 'online resource', 'online resource'), |
43 |
('$category', 'aperture card', 'aperture card', 'aperture card'), |
44 |
('$category', 'microfiche', 'microfiche', 'microfiche'), |
45 |
('$category', 'microfiche cassette', 'microfiche cassette', 'microfiche cassette'), |
46 |
('$category', 'microfilm cartridge', 'microfilm cartridge', 'microfilm cartridge'), |
47 |
('$category', 'microfilm cassette', 'microfilm cassette', 'microfilm cassette'), |
48 |
('$category', 'microfilm reel', 'microfilm reel', 'microfilm reel'), |
49 |
('$category', 'microfilm roll', 'microfilm roll', 'microfilm roll'), |
50 |
('$category', 'microfilm slip', 'microfilm slip', 'microfilm slip'), |
51 |
('$category', 'microopaque', 'microopaque', 'microopaque'), |
52 |
('$category', 'microscope slide', 'microscope slide', 'microscope slide'), |
53 |
('$category', 'film cartridge', 'film cartridge', 'film cartridge'), |
54 |
('$category', 'film cassette', 'film cassette', 'film cassette'), |
55 |
('$category', 'film reel', 'film reel', 'film reel'), |
56 |
('$category', 'film roll', 'film roll', 'film roll'), |
57 |
('$category', 'filmslip', 'filmslip', 'filmslip'), |
58 |
('$category', 'filmstrip', 'filmstrip', 'filmstrip'), |
59 |
('$category', 'filmstrip cartridge', 'filmstrip cartridge', 'filmstrip cartridge'), |
60 |
('$category', 'overhead transparency', 'overhead transparency', 'overhead transparency'), |
61 |
('$category', 'slide', 'slide', 'slide'), |
62 |
('$category', 'stereograph card', 'stereograph card', 'stereograph card'), |
63 |
('$category', 'stereograph disc', 'stereograph disc', 'stereograph disc'), |
64 |
('$category', 'card', 'card', 'card'), |
65 |
('$category', 'flipchart', 'flipchart', 'flipchart'), |
66 |
('$category', 'roll', 'roll', 'roll'), |
67 |
('$category', 'sheet', 'sheet', 'sheet'), |
68 |
('$category', 'volume', 'volume', 'volume'), |
69 |
('$category', 'object', 'object', 'object'), |
70 |
('$category', 'video cartridge', 'video cartridge', 'video cartridge'), |
71 |
('$category', 'videocassette', 'videocassette', 'videocassette'), |
72 |
('$category', 'videodisc', 'videodisc', 'videodisc'), |
73 |
('$category', 'videotape reel', 'videotape reel', 'videotape reel'), |
74 |
('$category', 'unspecified', 'unspecified', 'unspecified'), |
75 |
('$category', 'other', 'other', 'other') |
76 |
| |
77 |
); |
78 |
say $out "Added new authorised values for $category category"; |
79 |
} |
80 |
|
81 |
# Carrier codes |
82 |
$category = 'RDACARRIER_CODE'; |
83 |
($result) = $dbh->selectrow_array( |
84 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
85 |
undef, $category |
86 |
); |
87 |
if ($result) { |
88 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
89 |
} else { |
90 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
91 |
say $out "Added new authorised value category $category"; |
92 |
$dbh->do( |
93 |
qq| |
94 |
INSERT INTO authorised_values(category, authorised_value, lib, lib_opac) |
95 |
VALUES |
96 |
('$category', 'sg', 'audio cartridge', 'audio cartridge'), |
97 |
('$category', 'sb', 'audio belt', 'audio belt'), |
98 |
('$category', 'se', 'audio cylinder', 'audio cylinder'), |
99 |
('$category', 'sd', 'audio disc', 'audio disc'), |
100 |
('$category', 'si', 'sound track reel', 'sound track reel'), |
101 |
('$category', 'sq', 'audio roll', 'audio roll'), |
102 |
('$category', 'sw', 'audio wire reel', 'audio wire reel'), |
103 |
('$category', 'ss', 'audiocassette', 'audiocassette'), |
104 |
('$category', 'st', 'audiotape reel', 'audiotape reel'), |
105 |
('$category', 'sz', 'other (audio)', 'other (audio)'), |
106 |
('$category', 'ck', 'computer card', 'computer card'), |
107 |
('$category', 'cb', 'computer chip cartridge', 'computer chip cartridge'), |
108 |
('$category', 'cd', 'computer disc', 'computer disc'), |
109 |
('$category', 'ce', 'computer disc cartridge', 'computer disc cartridge'), |
110 |
('$category', 'ca', 'computer tape cartridge', 'computer tape cartridge'), |
111 |
('$category', 'cf', 'computer tape cassette', 'computer tape cassette'), |
112 |
('$category', 'ch', 'computer tape reel', 'computer tape reel'), |
113 |
('$category', 'cr', 'online resource', 'online resource'), |
114 |
('$category', 'cz', 'other (computer)', 'other (computer)'), |
115 |
('$category', 'ha', 'aperture card', 'aperture card'), |
116 |
('$category', 'he', 'microfiche', 'microfiche'), |
117 |
('$category', 'hf', 'microfiche cassette', 'microfiche cassette'), |
118 |
('$category', 'hb', 'microfilm cartridge', 'microfilm cartridge'), |
119 |
('$category', 'hc', 'microfilm cassette', 'microfilm cassette'), |
120 |
('$category', 'hd', 'microfilm reel', 'microfilm reel'), |
121 |
('$category', 'hj', 'microfilm roll', 'microfilm roll'), |
122 |
('$category', 'hh', 'microfilm slip', 'microfilm slip'), |
123 |
('$category', 'hg', 'microopaque', 'microopaque'), |
124 |
('$category', 'hz', 'other (microform)', 'other (microform)'), |
125 |
('$category', 'pp', 'microscope slide', 'microscope slide'), |
126 |
('$category', 'pz', 'other (microscopic)', 'other (microscopic)'), |
127 |
('$category', 'mc', 'film cartridge', 'film cartridge'), |
128 |
('$category', 'mf', 'film cassette', 'film cassette'), |
129 |
('$category', 'mr', 'film reel', 'film reel'), |
130 |
('$category', 'mo', 'film roll', 'film roll'), |
131 |
('$category', 'gd', 'filmslip', 'filmslip'), |
132 |
('$category', 'gf', 'filmstrip', 'filmstrip'), |
133 |
('$category', 'gc', 'filmstrip cartridge', 'filmstrip cartridge'), |
134 |
('$category', 'gt', 'overhead transparency', 'overhead transparency'), |
135 |
('$category', 'gs', 'slide', 'slide'), |
136 |
('$category', 'mz', 'other (projected image)', 'other (projected image)'), |
137 |
('$category', 'eh', 'stereograph card', 'stereograph card'), |
138 |
('$category', 'es', 'stereograph disc', 'stereograph disc'), |
139 |
('$category', 'ez', 'other (stereographic carriers)', 'other (stereographic carriers)'), |
140 |
('$category', 'no', 'card', 'card'), |
141 |
('$category', 'nn', 'flipchart', 'flipchart'), |
142 |
('$category', 'na', 'roll', 'roll'), |
143 |
('$category', 'nb', 'sheet', 'sheet'), |
144 |
('$category', 'nc', 'volume', 'volume'), |
145 |
('$category', 'nr', 'object', 'object'), |
146 |
('$category', 'nz', 'other (unmediated)', 'other (unmediated)'), |
147 |
('$category', 'vc', 'video cartridge', 'video cartridge'), |
148 |
('$category', 'vf', 'videocassette', 'videocassette'), |
149 |
('$category', 'vd', 'videodisc', 'videodisc'), |
150 |
('$category', 'vr', 'videotape reel', 'videotape reel'), |
151 |
('$category', 'vz', 'other (video)', 'other (video)'), |
152 |
('$category', 'zu', 'unspecified', 'unspecified') |
153 |
| |
154 |
); |
155 |
say $out "Added new authorised values for $category category"; |
156 |
} |
157 |
|
158 |
# Content terms |
159 |
$category = 'RDACONTENT'; |
160 |
($result) = $dbh->selectrow_array( |
161 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
162 |
undef, $category |
163 |
); |
164 |
if ($result) { |
165 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
166 |
} else { |
167 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
168 |
say $out "Added new authorised value category $category"; |
169 |
$dbh->do( |
170 |
qq| |
171 |
INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) |
172 |
VALUES |
173 |
('$category', 'cartographic dataset', 'cartographic dataset', 'cartographic dataset'), |
174 |
('$category', 'cartographic image', 'cartographic image', 'cartographic image'), |
175 |
('$category', 'cartographic moving image', 'cartographic moving image', 'cartographic moving image'), |
176 |
('$category', 'cartographic tactile image', 'cartographic tactile image', 'cartographic tactile image'), |
177 |
('$category', 'cartographic tactile three-dimensional form', 'cartographic tactile three-dimensional form', 'cartographic tactile three-dimensional form'), |
178 |
('$category', 'cartographic three-dimensional form', 'cartographic three-dimensional form', 'cartographic three-dimensional form'), |
179 |
('$category', 'computer dataset', 'computer dataset', 'computer dataset'), |
180 |
('$category', 'computer program', 'computer program', 'computer program'), |
181 |
('$category', 'notated movement', 'notated movement', 'notated movement'), |
182 |
('$category', 'notated music', 'notated music', 'notated music'), |
183 |
('$category', 'performed music', 'performed music', 'performed music'), |
184 |
('$category', 'sounds', 'sounds', 'sounds'), |
185 |
('$category', 'spoken word', 'spoken word', 'spoken word'), |
186 |
('$category', 'still image', 'still image', 'still image'), |
187 |
('$category', 'tactile image', 'tactile image', 'tactile image'), |
188 |
('$category', 'tactile notated music', 'tactile notated music', 'tactile notated music'), |
189 |
('$category', 'tactile notated movement', 'tactile notated movement', 'tactile notated movement'), |
190 |
('$category', 'tactile text', 'tactile text', 'tactile text'), |
191 |
('$category', 'tactile three-dimensional form', 'tactile three-dimensional form', 'tactile three-dimensional form'), |
192 |
('$category', 'text', 'text', 'text'), |
193 |
('$category', 'three-dimensional form', 'three-dimensional form', 'three-dimensional form'), |
194 |
('$category', 'three-dimensional moving image', 'three-dimensional moving image', 'three-dimensional moving image'), |
195 |
('$category', 'two-dimensional moving image', 'two-dimensional moving image', 'two-dimensional moving image'), |
196 |
('$category', 'other', 'other', 'other'), |
197 |
('$category', 'unspecified', 'unspecified', 'unspecified') |
198 |
| |
199 |
); |
200 |
say $out "Added new authorised values for $category category"; |
201 |
} |
202 |
|
203 |
# Content codes |
204 |
$category = 'RDACONTENT_CODE'; |
205 |
($result) = $dbh->selectrow_array( |
206 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
207 |
undef, $category |
208 |
); |
209 |
if ($result) { |
210 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
211 |
} else { |
212 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
213 |
say $out "Added new authorised value category $category"; |
214 |
$dbh->do( |
215 |
qq| |
216 |
INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) |
217 |
VALUES |
218 |
('$category', 'crd', 'cartographic dataset', 'cartographic dataset'), |
219 |
('$category', 'cri', 'cartographic image', 'cartographic image'), |
220 |
('$category', 'crm', 'cartographic moving image', 'cartographic moving image'), |
221 |
('$category', 'crt', 'cartographic tactile image', 'cartographic tactile image'), |
222 |
('$category', 'crn', 'cartographic tactile three-dimensional form', 'cartographic tactile three-dimensional form'), |
223 |
('$category', 'crf', 'cartographic three-dimensional form', 'cartographic three-dimensional form'), |
224 |
('$category', 'cod', 'computer dataset', 'computer dataset'), |
225 |
('$category', 'cop', 'computer program', 'computer program'), |
226 |
('$category', 'ntv', 'notated movement', 'notated movement'), |
227 |
('$category', 'ntm', 'notated music', 'notated music'), |
228 |
('$category', 'prm', 'performed music', 'performed music'), |
229 |
('$category', 'snd', 'sounds', 'sounds'), |
230 |
('$category', 'spw', 'spoken word', 'spoken word'), |
231 |
('$category', 'sti', 'still image', 'still image'), |
232 |
('$category', 'tci', 'tactile image', 'tactile image'), |
233 |
('$category', 'tcm', 'tactile notated music', 'tactile notated music'), |
234 |
('$category', 'tcn', 'tactile notated movement', 'tactile notated movement'), |
235 |
('$category', 'tct', 'tactile text', 'tactile text'), |
236 |
('$category', 'tcf', 'tactile three-dimensional form', 'tactile three-dimensional form'), |
237 |
('$category', 'txt', 'text', 'text'), |
238 |
('$category', 'tdf', 'three-dimensional form', 'three-dimensional form'), |
239 |
('$category', 'tdm', 'three-dimensional moving image', 'three-dimensional moving image'), |
240 |
('$category', 'tdi', 'two-dimensional moving image', 'two-dimensional moving image'), |
241 |
('$category', 'xxx', 'other', 'other'), |
242 |
('$category', 'zzz', 'unspecified', 'unspecified') |
243 |
| |
244 |
); |
245 |
say $out "Added new authorised values for $category category"; |
246 |
} |
247 |
|
248 |
# Media terms |
249 |
$category = 'RDAMEDIA'; |
250 |
($result) = $dbh->selectrow_array( |
251 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
252 |
undef, $category |
253 |
); |
254 |
if ($result) { |
255 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
256 |
} else { |
257 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
258 |
say $out "Added new authorised value category $category"; |
259 |
$dbh->do( |
260 |
qq| |
261 |
INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) |
262 |
VALUES |
263 |
('$category', 'audio', 'audio', 'audio'), |
264 |
('$category', 'computer', 'computer', 'computer'), |
265 |
('$category', 'microform', 'microform', 'microform'), |
266 |
('$category', 'microscopic', 'microscopic', 'microscopic'), |
267 |
('$category', 'projected', 'projected', 'projected'), |
268 |
('$category', 'stereographic', 'stereographic', 'stereographic'), |
269 |
('$category', 'unmediated', 'unmediated', 'unmediated'), |
270 |
('$category', 'video', 'video', 'video'), |
271 |
('$category', 'other', 'other', 'other'), |
272 |
('$category', 'unspecified', 'unspecified', 'unspecified') |
273 |
| |
274 |
); |
275 |
say $out "Added new authorised values for $category category"; |
276 |
} |
277 |
|
278 |
# Media codes |
279 |
$category = 'RDAMEDIA_CODE'; |
280 |
($result) = $dbh->selectrow_array( |
281 |
q|SELECT category_name FROM authorised_value_categories WHERE category_name = ?|, |
282 |
undef, $category |
283 |
); |
284 |
if ($result) { |
285 |
say_warning( $out, "$category auth value category already exists, new values will not be inserted" ); |
286 |
} else { |
287 |
$dbh->do( q|INSERT INTO authorised_value_categories (category_name) VALUES (?)|, undef, $category ); |
288 |
say $out "Added new authorised value category $category"; |
289 |
$dbh->do( |
290 |
qq| |
291 |
INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) |
292 |
VALUES |
293 |
('$category', 's', 'audio', 'audio'), |
294 |
('$category', 'c', 'computer', 'computer'), |
295 |
('$category', 'h', 'microform', 'microform'), |
296 |
('$category', 'p', 'microscopic', 'microscopic'), |
297 |
('$category', 'g', 'projected', 'projected'), |
298 |
('$category', 'e', 'stereographic', 'stereographic'), |
299 |
('$category', 'n', 'unmediated', 'unmediated'), |
300 |
('$category', 'v', 'video', 'video'), |
301 |
('$category', 'x', 'other', 'other'), |
302 |
('$category', 'z', 'unspecified', 'unspecified') |
303 |
| |
304 |
); |
305 |
say $out "Added new authorised values for $category category"; |
306 |
} |
307 |
|
308 |
say_success( $out, "Successfully added authorised values for RDA Carrier, Content, & Media vocabularies." ); |
309 |
}, |
310 |
}; |