'excel' => 'column',
'marc' => 'marc',
'feed' => 'feed',
- 'dbf' => 'isis', # special case, re-use isis import_xml
);
my $cache; # for cacheing
my ($swish,$display);
- my $tag = $type2tag{$type} || die "can't find which tag to use for type $type";
+ my $tag = $cfg->val($database, 'import_xml_tag') || $type2tag{$type} || die "can't find which tag to use for type $type";
# is this field page-by-page?
my $iterate_by_page = $config->{indexer}->{$field}->{iterate_by_page};
print STDERR "opening lookup file '$lookup_file'\n";
}
- my $import_xml_file = "./import_xml/$type.xml";
+ my $import_xml_type = $cfg->val($database, 'import_xml_file') || $type;
+ my $import_xml_file = "./import_xml/$import_xml_type.xml";
if (! -r $import_xml_file) {
print STDERR "ERROR: file $import_xml_file not readable skipping!\n";
my $type_base = $type;
$type_base =~ s/_.+$//g;
- $config=XMLin($import_xml_file, ForceArray => [ $type2tag{$type_base}, 'config', 'format' ], ForceContent => 1 );
+ my $tag = $cfg->val($database, 'import_xml_tag') || $type2tag{$type_base} || die "can't find which tag to use for type $type";
+ $config=XMLin($import_xml_file, ForceArray => [ $tag, 'config', 'format' ], ForceContent => 1 );
# helper for progress bar
sub fmt_time {
}
# now read database
-print STDERR "using: $type...\n";
# erase cache for tags by order in this database
delete $cache->{tags_by_order};
--- /dev/null
+=head1 Import DBF files into WebPAC
+
+dBase file format C<.dbf> is supported using C<XBase> perl module.
+Configuration in C<all2xml.conf> for this type looks like this:
+
+ [hda]
+ dbf_file=/data/drustvene/hda/ISO.DBF
+ type=dbf
+ import_xml_file=isis
+ import_xml_tag=isis
+ dbf_codepage=cp852
+ dbf_mapping=<<_END_OF_MAP_
+ ID_BROJ mfn
+ ISBN_BROJ 010
+ SKUPINA1 200
+ SKUPINA2 205
+ SKUPINA4 210
+ SKUPINA5 215
+ SKUPINA6 225
+ SKUPINA7 300
+ ANOTACIJA 330
+ PREDMET1 610
+ PREDMET2 610
+ PREDMET3 510
+ UDK 675
+ REDALICA 700
+ SIGNATURA 990
+ _END_OF_MAP_
+
+Options are following:
+
+=over 4
+
+=item dbf_file
+
+Full path to C<.dbf> file that you want to import.
+
+=item type
+
+It should be C<dbf> for dBase files.
+
+=item import_xml_file
+
+If you want to re-use exising import_xml file, you can use this option
+to specify C<import_xml/B<import_xml_file>.xml> file.
+
+If not used, you will have to create C<import_xml/dbf.xml> file.
+
+=item import_xml_tag
+
+If using C<import_xml_file> you will like to specify which tag to use
+for C<dbf> data using this option.
+
+=item dbf_codepage
+
+Override codepage in C<import_xml_file> for this C<.dbf> database.
+
+=item dbf_mapping
+
+Specify mapping from C<.dbf> fields to ISO fields. Each field is assumed to
+have MARC/ISO subfields in form C<^a> or C<$a> and so on.
+
+Mapping must be specified using text here notation in config file, and must
+have two fields: original name of column from C<.dbf> file and new field name
+which is used in C<import_xml>.
+
+=back
+
+=cut