FROM legacy_item i
JOIN legacy_callnum c USING (cat_key,call_key);
+CREATE INDEX lj_cat_call_idx ON joined_legacy (cat_key,call_key);
+
-- Import the call numbers
-- Getting the owning lib from the first available copy on the CN
INSERT INTO asset.call_number (creator,editor,record,label,owning_lib)
-- Import base copy data
-INSERT INTO asset.copy (circ_lib,creator,editor,create_date,barcode,status,location,loan_duration,fine_level,opac_visible,price,circ_modifier,call_number)
+INSERT INTO asset.copy (circ_lib,creator,editor,create_date,barcode,status,location,loan_duration,fine_level,opac_visible,price,circ_modifier,call_number, alert_message)
SELECT DISTINCT ou.id AS circ_lib,
1 AS creator,
1 AS editor,
(l.price/100::numeric)::numeric(8,2) AS price,
l.item_type AS circ_modifier,
cn.id AS call_number,
- pc.cnt || " pieces" as alert_message
+ pc.cnt || ' pieces' as alert_message
FROM joined_legacy l
JOIN legacy_copy_status_map s_map
ON (s_map.name = l.current_location)
$batch->strict_off();
$batch->warnings_off();
+my %seen;
+
my $starttime = time;
my $rec;
while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) {
}
$rec = preprocess($rec);
+ $rec->delete_field( $_ ) for ($rec->field($id_field));
if (!$rec) {
next;
}
- my $tcn_value = $rec->subfield($id_field => 'a');
- my $tcn_source = $rec->subfield($id_field => 'b');
+ my $tcn_value = $rec->subfield('901' => 'a');
+ my $tcn_source = $rec->subfield('901' => 'b');
+
+ next if ($seen{$tcn_value});
+ $seen{$tcn_value} = 1;
(my $xml = $rec->as_xml_record()) =~ s/\n//sog;
$xml =~ s/^<\?xml.+\?\s*>//go;
}
my $tcn = MARC::Field->new(
- $id_field,
- '', '',
- 'a', $id,
- 'b', do { $source_map{$source} || 'System' },
+ '901' => ('', ''),
+ a => $id,
+ b => do { $source_map{$source} || 'System' },
);
$rec->append_fields($tcn);