JOIN legacy_item jl
ON ( jl.cat_key = lh.cat_key
AND jl.call_key = lh.call_key
- AND jl.item_key = lh.call_key )
+ AND jl.item_key = lh.item_key )
JOIN asset.copy cp ON (cp.barcode = jl.item_id)
JOIN actor.usr au ON (au.id = lh.user_key)
JOIN actor.org_unit rou ON (rou.shortname = lh.placing_lib)
JOIN actor.org_unit pou ON (pou.shortname = lh.pickup_lib)
- WHERE lh.hold_level = 'C';
+ WHERE lh.hold_level = 'C'
+ AND lh.hold_date > '2006-01-01';
-- And these are CN level holds
-- CREATE TABLE legacy_cn_hold_insert AS
JOIN legacy_item jl
ON ( jl.cat_key = lh.cat_key
AND jl.call_key = lh.call_key
- AND jl.item_key = lh.call_key )
+ AND jl.item_key = lh.item_key )
JOIN asset.copy cp ON (cp.barcode = jl.item_id)
JOIN actor.usr au ON (au.id = lh.user_key)
JOIN actor.org_unit rou ON (rou.shortname = lh.placing_lib)
JOIN actor.org_unit pou ON (pou.shortname = lh.pickup_lib)
- WHERE lh.hold_level = 'A';
+ WHERE lh.hold_level = 'A'
+ AND lh.hold_date > '2006-01-01';
--- And these are CN level holds
+-- And these are Title level holds
-- CREATE TABLE legacy_title_hold_insert AS
INSERT INTO action.hold_request
(id, target, current_copy, hold_type, pickup_lib, selection_ou, selection_depth, request_time, capture_time, request_lib, requestor, usr)
JOIN legacy_item jl
ON ( jl.cat_key = lh.cat_key
AND jl.call_key = lh.call_key
- AND jl.item_key = lh.call_key )
+ AND jl.item_key = lh.item_key )
JOIN asset.copy cp ON (cp.barcode = jl.item_id)
JOIN actor.usr au ON (au.id = lh.user_key)
JOIN actor.org_unit rou ON (rou.shortname = lh.placing_lib)
JOIN actor.org_unit pou ON (pou.shortname = lh.pickup_lib)
- WHERE lh.hold_level = 'T';
+ WHERE lh.hold_level = 'T'
+ AND lh.hold_date > '2006-01-01';
SELECT SETVAL('action.hold_request_id_seq',(SELECT MAX(id) FROM action.hold_request),TRUE);
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+
+my $new = shift;
+my $old = shift;
+
+open N, $new;
+open O, $old;
+
+my %oldlibs;
+while (<O>) {
+ chomp;
+ my ($sname, $lib, $sys) = split /\t/;
+ my ($sys_prefix) = split /-/;
+
+ $oldlibs{$sys_prefix} = $sys;
+}
+
+while (<N>) {
+ chomp;
+ my ($sname,$lib) = split /\|/;
+ my ($sys_prefix) = split /-/, $sname;
+ $lib =~ s/^[^-]+-(.+)/$1/o;
+ print "$sname\t$lib\t$oldlibs{$sys_prefix}\n";
+}
ON (ou.id = cn.owning_lib AND l.cat_key = cn.record AND l.call_num = cn.label)
LEFT JOIN legacy_piece_count pc ON (pc.barcode = l.item_id);
+-- Import brief copies
+INSERT INTO asset.copy (circ_lib,creator,editor,barcode,status,loan_duration,fine_level,dummy_title,dummy_author,opac_visible,circ_modifier,call_number)
+ SELECT DISTINCT ou.id AS circ_lib,
+ 1 AS creator,
+ 1 AS editor,
+ b.barcode AS barcode,
+ 1 AS status,
+ 2 AS loan_duration,
+ 2 AS fine_level,
+ b.title AS dummy_title,
+ b.author AS dummy_author,
+ FALSE as opac_visible,
+ 'BOOK' AS circ_modifier,
+ -1 AS call_number
+ FROM legacy_pre_cat b
+ JOIN actor.org_unit ou ON (ou.shortname = b.lib);
+
-- Move copy notes into the notes table ... non-public
INSERT INTO asset.copy_note (owning_copy,creator,title,value)
SELECT cp.id,
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<SQL;
+DROP TABLE legacy_pre_cat;
+CREATE TABLE legacy_pre_cat (barcode text, lib text, title text, author text);
+COPY legacy_pre_cat (barcode, lib, title, author) FROM STDIN;
+SQL
+
+while (<>) {
+ chomp;
+ my ($bc,$l,$t,$a) = split '\|';
+ $bc =~ s/\s*$//o;
+ print "$bc\t$l\t$t\t$a\n";
+}
+
+print '\.'."\n";
+print "CREATE INDEX precat_bc_idx ON legacy_pre_cat (barcode);\n";
+