+++ /dev/null
-#!/usr/bin/perl
-
-use Getopt::Long;
-
-my ($usermap,$nonusers,$recirc) = ();
-
-GetOptions(
- 'usermap=s' => \$usermap,
- 'nonusers=s' => \$nonusers,
- 'recirc=s' => \$recirc,
-);
-
-my %u_map;
-open F, $usermap;
-while (my $line = <F>) {
- chomp($line);
- my ($b,$i) = split(/\|/, $line);
- $b =~ s/^\s*(\S+)\s*$/$1/o;
- $i =~ s/^\s*(\S+)\s*$/$1/o;
- $u_map{$b} = $i;
-}
-close F;
-
-print "CREATE TABLE legacy_baduser_map ( barcode text, id int, type text);\n";
-print "COPY legacy_baduser_map FROM STDIN;\n";
-
-open F, $nonusers;
-while (<F>) {
- chomp;
- my ($p,$l,$b) = split '\|';
- next unless ($u_map{$b});
- print "$b\t$u_map{$b}\tN\n";
-}
-close F;
-
-open F, $recirc;
-while (<F>) {
- chomp;
- my ($b) = split '\|';
- next unless ($u_map{$b});
- print "$b\t$u_map{$b}\tR\n";
-}
-close F;
-
-print "\\.\n";
-
+++ /dev/null
-/* XXX update me
-book
-cd
-dvd
-e-book
-equipment
-filmstrip
-kit
-magazine
-map
-microform
-music
-record
-software
-talking book
-toy
-video
-*/
-
-
-{
- 'art' : {
- durationRule : '3_month_0_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'atlas' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'audiobook' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'av' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'bestseller' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'bestsellernh' : {
- durationRule : '7_days_2_renew',
- recurringFinesLevel : 'normal',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'cd' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Computer Use' : {
- durationRule : '1_hour_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Deposit [monetary]' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'DVD' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'DVD with long loan period' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'E-Book' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Equipment' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Equipment with long loan period' : {
- },
-
- 'Non-PINES GA loan (NILS-Item)' : {
- durationRule : '28_days_0_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'ILL item' : {
- durationRule : '28_days_0_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'PINES ILL loan (ILS-Item)' : {
- durationRule : '28_days_0_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
-
- 'Filmstrip' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Internet' : {
- },
-
- 'Kit' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Laserdisc' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Libraryuse' : {
- },
-
- 'Magazine-Circulating' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
-
- 'Magazine-Non Circulating' : {
- },
-
- 'Map' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
-
- 'Microform' : {
- },
-
- 'Music' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'New AV material' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'New Book' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Outreach' : {
- durationRule : '2_months_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Pamphlet' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Paperback' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Realia' : {
- durationRule : '28_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Record' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Reference' : {
- },
-
- 'Reserve' : {
- },
-
- 'Room' : {
- },
-
- 'Roomsatell' : {
- },
-
- 'Software' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Software with long loan period' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Staff' : {
- },
-
- 'State Library book' : {
- durationRule : '35_days_1_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'State Library microform ' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'State Library reference' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Talkingbook' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Toy' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Video (high demand)' : {
- durationRule : '7_days_0_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Video (not high demand)' : {
- durationRule : '7_days_0_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Video - long loan period' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Video public performance' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- recurringFinesLevel : 'normal',
- maxFine : 'overdue_mid'
- },
-
- 'Video - special parameters' : {
- }
-}
-
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select CAT_KEY,FLEX_KEY from CATALOG');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $data = $sth->fetchrow_arrayref) {
- print join('|', @$data) . "\n";
-}
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select USER_BARCODE,USER_KEY from USER');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $data = $sth->fetchrow_arrayref) {
- print join('|', @$data) . "\n";
-}
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_bill;
-CREATE TABLE legacy_bill (bill_amount int, balance int, bill_date date, cat_key int, call_key int, item_key int, user_key int, paid bool, reason text, library text, bill_key1 int, bill_key2 int);
-COPY legacy_bill (bill_amount, balance, bill_date, cat_key, call_key, item_key, user_key, paid, reason, library, bill_key1, bill_key2) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select * from BILL');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{uc($_)} } qw/bill_amount balance bill_date cat_key call_key item_key user_key paid reason library bill_key1 bill_key2/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-print "CREATE INDEX lb_bk1_idx ON legacy_bill (bill_key1);\n";
-print "CREATE INDEX lb_usr_idx ON legacy_bill (user_key);\n";
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_charge;
-CREATE TABLE legacy_charge (charge_date text, due_date text, renewal_date text, charge_key1 int, charge_key2 int, charge_key3 int, charge_key4 int, user_key int, overdue bool, library text, claim_return_date text);
-COPY legacy_charge (charge_date, due_date, renewal_date, charge_key1, charge_key2, charge_key3, charge_key4, user_key, overdue, library, claim_return_date) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select * from CHARGE');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{uc($_)} } qw/charge_date due_date renewal_date charge_key1 charge_key2 charge_key3 charge_key4 user_key overdue library claim_return_date/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_callnum;
-CREATE TABLE legacy_callnum (call_num text, cat_key int, call_key int, shadow bool);
-COPY legacy_callnum (call_num, cat_key, call_key, shadow) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select * from CALLNUM');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{$_} } qw/CALL_NUM CAT_KEY CALL_KEY SHADOW/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_bill;
-CREATE TABLE legacy_email (user_key int, email text);
-COPY legacy_email (user_key, email) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare('select USER_KEY, EMAIL from USER');
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{uc($_)} } qw/user_key email/;
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_hold;
-CREATE TABLE legacy_hold (available text, status text, notified text, num_of_notices int, cat_key int, call_key int, item_key int, hold_key int, user_key int, hold_date date, hold_range text, pickup_lib text, placing_lib text, owning_lib text, inactive_date text, inactive_reason text, hold_level text);
-COPY legacy_hold (available, status, notified, num_of_notices, cat_key, call_key, item_key, hold_key, user_key, hold_date, hold_range, pickup_lib, placing_lib, owning_lib, inactive_date, inactive_reason, hold_level) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare("select * from HOLD where STATUS = 'ACTIVE'");
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{uc($_)} } qw/available status notified num_of_notices cat_key call_key item_key hold_key user_key hold_date hold_range pickup_lib placing_lib owning_lib inactive_date inactive_reason hold_level/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print <<SQL
-\\.
-
-UPDATE legacy_hold SET notified = null where notified = '0';
-UPDATE legacy_hold SET inactive_date = null where inactive_date = '0';
-
-ALTER TABLE legacy_hold ALTER COLUMN notified TYPE DATE USING notified::DATE;
-ALTER TABLE legacy_hold ALTER COLUMN inactive_date TYPE DATE USING inactive_date::DATE;
-
-SQL
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_transit;
-CREATE TABLE legacy_transit (destination_lib text, owning_lib text, starting_lib text, transit_date timestamptz, transit_reason text, cat_key int, call_key int, item_key int, hold_key int);
-COPY legacy_transit (destination_lib, owning_lib, starting_lib, transit_date, transit_reason, cat_key, call_key, item_key, hold_key) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare("select CAT_KEY, CALL_KEY, ITEM_KEY, HOLD_KEY, DESTINATION_LIB, OWNING_LIB, STARTING_LIB, concat(substring(TRANSIT_DATE,1,8),'T',substring(TRANSIT_DATE,9,4)) AS TRANSIT_DATE, TRANSIT_REASON from INTRANSIT");
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{uc($_)} } qw/destination_lib owning_lib starting_lib transit_date transit_reason cat_key call_key item_key hold_key/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use DBI;
-
-my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
-
-print <<SQL;
-
-DROP TABLE legacy_item;
-
-CREATE TABLE legacy_item (CAT_1 text,CREATION_DATE date,CAT_2 text,CURRENT_LOCATION text,ITEM_ID text,CAT_KEY int,CALL_KEY int,ITEM_KEY int,PRICE numeric(8,2),ITEM_TYPE text,OWNING_LIBRARY text,SHADOW bool,ITEM_COMMENT text,LAST_IMPORT_DATE date,HOME_LOCATION text);
-
-COPY legacy_item (CAT_1,CREATION_DATE,CAT_2,CURRENT_LOCATION,ITEM_ID,CAT_KEY,CALL_KEY,ITEM_KEY,PRICE,ITEM_TYPE,OWNING_LIBRARY,SHADOW,ITEM_COMMENT,LAST_IMPORT_DATE,HOME_LOCATION) FROM STDIN;
-SQL
-
-warn "going for the data...";
-
-my $sth = $dbh->prepare("SELECT * FROM ITEM WHERE LAST_IMPORT_DATE IN ('20060901','20060902');");
-$sth->execute;
-
-warn "got it, writing file...";
-
-while (my $cn = $sth->fetchrow_hashref) {
- my @data = map { $$cn{$_} } qw/CAT_1 CREATION_DATE CAT_2 CURRENT_LOCATION ITEM_ID CAT_KEY CALL_KEY ITEM_KEY PRICE ITEM_TYPE OWNING_LIBRARY SHADOW ITEM_COMMENT LAST_IMPORT_DATE HOME_LOCATION/;
- for (@data) {
- if (defined($_)) {
- s/\\/\\\\/go;
- s/\t/ /go;
- } else {
- $_ = '\N';
- }
- }
- print join("\t", @data) . "\n";
-}
-
-print "\\.\n";
-print "CREATE INDEX cat_call_idx ON legacy_item (cat_key,call_key);\n";
-
-
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use XML::LibXML;
-use Time::HiRes qw/time/;
-use Getopt::Long;
-use Data::Dumper;
-use Error qw/:try/;
-use open qw/:utf8/;
-
-$|=1;
-
-my ($userid,$sourceid,$rec_id,$entry_file,$id_tag) = (1,2,1,'authority_entry.sql','//*[@tag="035"][1]');
-
-GetOptions (
- "sourceid" => \$sourceid,
- "sql_output=s" => \$entry_file,
- "userid=i" => \$userid,
- "first=i" => \$rec_id,
- "id_tag_xpath=s" => \$id_tag,
-);
-
-my $tcn_map;
-
-open RE, ">$entry_file" or die "Can't open $entry_file! $!\n";
-
-print RE <<SQL;
-SET CLIENT_ENCODING TO 'UNICODE';
-COPY authority.record_entry (id,editor,creator,arn_value,marc,last_xact_id) FROM STDIN;
-SQL
-
-my $xact_id = time;
-
-my $parser = XML::LibXML->new;
-
-my $xml = '';
-while ( $xml .= <STDIN> ) {
- chomp $xml;
- next unless $xml;
-
- my $tcn = '';
- my $success = 0;
- try {
- my $doc = $parser->parse_string($xml);
- my @nodes = $doc->documentElement->findnodes( $id_tag );
- for my $n (@nodes) {
- $tcn .= $n->textContent;
- }
- $tcn =~ s/^\s*(\.+)\s*/$1/o;
- $tcn =~ s/\s+/_/go;
- $success = 1;
- } catch Error with {
- my $e = shift;
- warn $e;
- warn $xml;
- };
- next unless $success;
-
- $xml =~ s/\\/\\\\/go;
- $xml =~ s/\t/\\t/go;
-
- $tcn =~ s/^.*?(\w+)\s*$/$1/go;
-
- unless ($tcn) {
- warn "\nNo TCN found for rec # $rec_id\n";
- $xml = '';
- $rec_id++;
- next;
- }
-
- if (exists($$tcn_map{$tcn})) {
- warn "\n !! TCN $tcn already exists!\n";
- $xml = '';
- next;
- }
-
- print ".";
- $$tcn_map{$tcn} = $rec_id;
-
- print RE join("\t", ($rec_id,$userid,$userid,$tcn,$xml,$xact_id))."\n";
-
- $rec_id++;
- $xml = '';
-}
-
-print RE "\\.\n";
-print RE "SELECT setval('authority.record_entry_id_seq'::TEXT, $rec_id);\n";
-
-
-
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use XML::LibXML;
-use Time::HiRes qw/time/;
-use Getopt::Long;
-use Data::Dumper;
-use Error qw/:try/;
-use open qw/:utf8/;
-
-$|=1;
-
-my ($userid,$sourceid,$rec_id,$entry_file,$map_file,$id_tag) = (1,2,1,'record_entry.sql','record_id_map.pl','//*[@tag="035"][1]');
-
-GetOptions (
- "sourceid" => \$sourceid,
- "sql_output=s" => \$entry_file,
- "tcn_output=s" => \$map_file,
- "userid=i" => \$userid,
- "first=i" => \$rec_id,
- "id_tag_xpath=s" => \$id_tag,
-);
-
-my $tcn_map;
-
-open RE, ">$entry_file" or die "Can't open $entry_file! $!\n";
-
-print RE <<SQL;
-SET CLIENT_ENCODING TO 'UNICODE';
-COPY biblio.record_entry (id,editor,creator,source,tcn_value,marc,last_xact_id) FROM STDIN;
-SQL
-
-my $xact_id = time;
-
-my $parser = XML::LibXML->new;
-
-my $xml = '';
-while ( $xml .= <STDIN> ) {
- chomp $xml;
- next unless $xml;
-
- my $tcn = '';
- my $success = 0;
- try {
- my $doc = $parser->parse_string($xml);;
- my @nodes = $doc->documentElement->findnodes( $id_tag );
- for my $n (@nodes) {
- $tcn .= $n->textContent;
- }
- $tcn =~ s/^\s*(\.+)\s*/$1/o;
- $tcn =~ s/\s+/_/go;
- $success = 1;
- } catch Error with {
- my $e = shift;
- warn $e;
- warn $xml;
- };
- next unless $success;
-
- $xml =~ s/\\/\\\\/go;
- $xml =~ s/\t/\\t/go;
-
- $tcn =~ s/^.*?(\w+)\s*$/$1/go;
-
- unless ($tcn) {
- warn "\nNo TCN found for rec # $rec_id\n";
- $xml = '';
- $rec_id++;
- next;
- }
-
- if (exists($$tcn_map{$tcn})) {
- warn "\n !! TCN $tcn already exists!\n";
- $xml = '';
- next;
- }
-
- print ".";
- $$tcn_map{$tcn} = $rec_id;
-
- print RE join("\t", ($rec_id,$userid,$userid,$sourceid,$tcn,$xml,$xact_id))."\n";
-
- $rec_id++;
- $xml = '';
-}
-
-print RE "\\.\n";
-print RE "SELECT setval('biblio.record_entry_id_seq'::TEXT, $rec_id);\n";
-
-open MAP, ">$map_file" or die "Can't open $map_file! $!\n";
-print MAP Data::Dumper->Dump([$tcn_map],['tcn_map']);
-
-
-
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use UNIVERSAL::require;
-use MARC::Charset;
-use MARC::Batch;
-use MARC::File::XML;
-use Time::HiRes qw/time/;
-use Getopt::Long;
-use Data::Dumper;
-use Error qw/:try/;
-use DBI;
-use open qw/:utf8/;
-
-#-------------------------------------------------------------------------------
-# The keys of this hash should be the string values stored in your legacy
-# system that map to the copy statuses in Open-ILS. If you don't see a
-# legacy status here that you need to carry over to your new Open-ILS install
-# you can use the "Copy Statuses" bootstrapping CGI to create an entry for it.
-# Then simply a key for the legacy status that points to the SysID of the new
-# Open-ILS Copy Status.
-#-------------------------------------------------------------------------------
-my %status_map = (
- '' => 0,
- CHECKEDOUT => 1,
- BINDERY => 2,
- LOST => 3,
- MISSING => 4,
- INPROCESS => 5,
- INTRANSIT => 6,
- RESHELVING => 7,
- 'ON HOLDS SHELF'=> 8,
- 'ON-ORDER' => 9,
- ILL => 10,
- CATALOGING => 11,
- RESERVES => 12,
- DISCARD => 13,
-);
-
-
-$|=1;
-
-my ($userid,$cn_id,$cp_id,$cp_file,$cn_file,$lib_map_field,$id_tag,$id_field,$id_subfield, $marc_file) =
- (1, 1, 1, 'asset_copy.sql','asset_volume.sql','shortname','001');
-
-my ($skip,$enc,$marctype,$holding_tag,$bc,$lbl,$own,$pr,$cpn,$avail) =
- (0,'utf-8','XML','999','i','a','m','p','c','k');
-
-my ($db_driver,$db_host,$db_name,$db_user,$db_pw) =
- ('Pg','localhost','evergreen','postgres','postgres');
-
-GetOptions (
- "encoding=s" => \$enc,
- "copy_file=s" => \$cp_file,
- "volume_file=s" => \$cn_file,
- "userid=i" => \$userid,
- "first_volume=i" => \$cn_id,
- "first_copy=i" => \$cp_id,
- "db_driver=s" => \$db_driver,
- "db_host=s" => \$db_host,
- "db_name=s" => \$db_name,
- "db_user=s" => \$db_user,
- "db_pw=s" => \$db_pw,
- "lib_map_field=s" => \$lib_map_field,
- "id_field=s" => \$id_field,
- "id_subfield=s" => \$id_subfield,
- "holding_field=s" => \$holding_tag,
- "item_barcode=s" => \$bc,
- "item_call_number=s" => \$lbl,
- "item_owning_lib=s" => \$own,
- "item_price=s" => \$pr,
- "item_copy_number=s" => \$cpn,
- "item_copy_status=s" => \$avail,
- "marc_file=s" => \$marc_file,
- "marctype=s" => \$marctype,
- "skip=i" => \$skip,
-
-);
-
-if ($marctype eq 'XML') {
- 'open'->use(':utf8');
-} else {
- bytes->use();
-}
-
-if ($enc) {
- MARC::Charset->ignore_errors(1);
- MARC::Charset->assume_encoding($enc);
-}
-
-my $dsn = "dbi:$db_driver:host=$db_host;dbname=$db_name";
-my $dbh = DBI->connect($dsn,$db_user,$db_pw);
-
-my $t = 'actor_org_unit';
-if ($db_driver eq 'Pg') {
- $t = 'actor.org_unit';
-}
-my $sth = $dbh->prepare("SELECT $lib_map_field,id FROM $t");
-$sth->execute;
-
-my $lib_map = {};
-while (my $lib = $sth->fetchrow_arrayref) {
- $$lib_map{$$lib[0]} = $$lib[1];
-}
-
-my $tcn_sth = $dbh->prepare("SELECT id FROM biblio.record_entry WHERE tcn_value = ?");
-my $rec_id;
-
-open CP, ">>$cp_file" or die "Can't open $cp_file! $!\n";
-open CN, ">>$cn_file" or die "Can't open $cn_file! $!\n";
-
-print CP <<SQL if (!$skip);
-SET CLIENT_ENCODING TO 'UNICODE';
-COPY asset.copy (id,circ_lib,editor,creator,barcode,call_number,copy_number,status,loan_duration,fine_level,circulate,deposit,deposit_amount,price,ref,opac_visible) FROM STDIN;
-SQL
-
-print CN <<SQL if (!$skip);
-SET CLIENT_ENCODING TO 'UNICODE';
-COPY asset.call_number (id,editor,creator,record,label,owning_lib) FROM STDIN;
-SQL
-
-my $xact_id = time;
-
-my $batch = MARC::Batch->new( $marctype => $marc_file );
-$batch->strict_off();
-$batch->warnings_off();
-
-my $cn_map;
-my $count = 0;
-my $record;
-while ( try { $record = $batch->next } otherwise { $record = -1 } ) {
- next if ($record == -1);
- $count++;
- next if ($count <= $skip);
-
- $rec_id = $record->subfield( $id_field => $id_subfield );
-
- next unless ($rec_id);
-
- for my $field ($record->field($holding_tag)) {
- my $barcode = $field->subfield( $bc );
- my $label = $field->subfield( $lbl );
- my $owning_lib = $$lib_map{ $field->subfield( $own ) };
- my $price = $field->subfield( $pr );
- my $copy_number = $field->subfield( $cpn ) || '\N';
- my $available = $field->subfield( $avail ) || '';
-
- my $status = $status_map{$available} || 0;
-
- next unless $barcode;
- next unless $owning_lib;
- next unless $label;
-
- $barcode =~ s/\\/\\\\/og;
- $label =~ s/\\/\\\\/og;
- $price =~ s/\$//og if($price);
- if (!defined($price) || $price !~ /^\s*\d{1,6}\.\d{2}\s*$/o) {
- $price = '0.00';
- }
-
- unless (exists($$cn_map{"$rec_id/$owning_lib/$label"})) {
- $$cn_map{"$rec_id/$owning_lib/$label"} = $cn_id;
- print CN join("\t",($cn_id,$userid,$userid,$rec_id,$label,$owning_lib))."\n";
- print 'v';
- $cn_id++;
- }
-
-# id,editor,creator,barcode,call_number,copy_number,available,loan_duration,fine_level,circulate,deposit,deposit_amount,price,ref,opac_visible
-
- print CP join("\t", ( $cp_id,$owning_lib,$userid,$userid,$barcode,
- $$cn_map{"$rec_id/$owning_lib/$label"},
- $copy_number,$status,2,2,1,0,'0.00',
- $price,0,1 )
- )."\n";
- print 'c';
- $cp_id++;
- }
-}
-
-print CN "\\.\n";
-print CN "SELECT setval('asset.call_number_id_seq'::TEXT, $cn_id);\n";
-print CP "\\.\n";
-print CP "SELECT setval('asset.copy_id_seq'::TEXT, $cp_id);\n";
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-print "CREATE TEMP TABLE legacy_closing (lib text, cstart int, cend int, reason text);\n";
-print "COPY legacy_closing (lib,cstart,cend,reason) FROM STDIN;\n";
-
-while (<>) {
- my ($lib,$s,$e) = split '\|';
- my @start = split ' ', $s;
- my @end = split ' ', $e;
-
- for (my $x = 0; $x < @start; $x++) {
- print "$lib\t$start[$x]\t$end[$x]\tLegacy Closing\n";
- }
-}
-
-print "\\.\n";
-
-print <<SQL;
-
-DELETE FROM actor.org_unit_closed;
-
-CREATE TEMP VIEW legacy_closing_view AS
- SELECT au.id AS org_unit,
- ('epoch'::TIMESTAMPTZ + (l.cstart || ' seconds')::INTERVAL)::DATE AS close_start,
- ('epoch'::TIMESTAMPTZ + (l.cend || ' seconds')::INTERVAL + '1 day'::INTERVAL)::DATE - '1 second'::INTERVAL AS close_end,
- l.reason AS reason
- FROM legacy_closing l
- JOIN actor.org_unit au ON (au.shortname = l.lib);
-
-INSERT INTO actor.org_unit_closed (org_unit, close_start, close_end, reason)
- SELECT * from legacy_closing_view;
-
-INSERT INTO actor.org_unit_closed (org_unit, close_start, close_end, reason)
- SELECT au.id AS org_unit,
- '2006-09-02' AS close_start,
- '2006-09-05'::DATE - '1 second'::INTERVAL AS close_end,
- 'Evergreen Migration' AS reason
- FROM actor.org_unit au;
-
-SQL
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-print "CREATE TEMP TABLE legacy_hoo (lib text, d0o time, d0c time, d1o time, d1c time, d2o time, d2c time, d3o time, d3c time, d4o time, d4c time, d5o time, d5c time, d6o time, d6c time);\n";
-print "COPY legacy_hoo (lib,d0o,d0c,d1o,d1c,d2o,d2c,d3o,d3c,d4o,d4c,d5o,d5c,d6o,d6c) FROM STDIN;\n";
-
-while (<>) {
- my ($lib,@dow) = split '\|';
- @dow = @dow[1,2,3,4,5,6,0];
-
- print "$lib";
- for my $c (@dow) {
- if ($c == 1) {
- print "\t00:00:00\t00:00:00";
- } else {
- print "\t09:00:00\t17:00:00";
- }
- }
- print "\n";
-}
-
-print "\\.\n";
-
-print <<SQL;
-
-DELETE FROM actor.hours_of_operation;
-
-CREATE TEMP VIEW legacy_hoo_view AS
- SELECT au.id AS id, l.d0o, l.d0c, l.d1o, l.d1c, l.d2o, l.d2c, l.d3o, l.d3c, l.d4o, l.d4c, l.d5o, l.d5c, l.d6o, l.d6c
- FROM legacy_hoo l
- JOIN actor.org_unit au ON (au.shortname = l.lib);
-
-INSERT INTO actor.hours_of_operation (id, dow_0_open, dow_0_close, dow_1_open, dow_1_close, dow_2_open, dow_2_close, dow_3_open, dow_3_close, dow_4_open, dow_4_close, dow_5_open, dow_5_close, dow_6_open, dow_6_close)
- SELECT * from legacy_hoo_view;
-
-SQL
-
+++ /dev/null
-BEGIN;
-
-INSERT INTO money.grocery (usr,xact_start,billing_location,note)
- SELECT DISTINCT ON (au.id)
- au.id AS usr,
- lb.bill_date AS xact_start,
- ou.id AS billing_location,
- 'Legacy Open Billing' AS note
- FROM legacy_bill lb
- JOIN actor.usr au ON (lb.user_key = au.id)
- JOIN actor.org_unit ou ON (lb.library = ou.shortname)
- WHERE lb.paid IS FALSE
- ORDER BY au.id, lb.bill_key2;
-
-INSERT INTO money.billing (xact,billing_ts,amount,billing_type,note)
- SELECT mg.id AS xact,
- lb.bill_date AS billing_ts,
- (lb.balance / 100.0)::NUMERIC(6,2) AS amount,
- lb.reason AS billing_type,
- 'Item Barcode: ' || jl.item_id AS note
- FROM legacy_bill lb
- JOIN money.grocery mg ON (lb.user_key = mg.usr)
- JOIN actor.usr au ON (lb.user_key = au.id)
- JOIN actor.org_unit ou ON (lb.library = ou.shortname)
- LEFT JOIN joined_legacy jl USING (cat_key, call_key, item_key)
- WHERE lb.paid IS FALSE;
-
-COMMIT;
+++ /dev/null
-BEGIN;
-
-CREATE TABLE legacy_lib_max_fine (lib text, max_fine numeric(6,2));
-COPY legacy_lib_max_fine (lib, max_fine) FROM STDIN;
-CHRLS 10.00
-FRRLS 10.00
-HCLS 10.00
-OCRL 10.00
-OHOOP 10.00
-OKRL 10.00
-PPL 10.00
-PMRLS 10.00
-STRL 10.00
-DTRL 100.00
-SJRL 100.00
-ARL 100.00
-ECGRL 100.00
-\.
-
-CREATE TABLE legacy_type_circ_map (item_type text, recuring_fine numeric(6,2), renewals int);
-COPY legacy_type_circ_map (item_type, recuring_fine, renewals) FROM STDIN;
-ART 0.10 0
-ATLAS 0.50 2
-AUDIOBOOK 0.50 2
-AV 0.50 2
-BESTSELLER 0.50 2
-BOOK 0.10 2
-CD 0.10 2
-COMPUTER 0.10 2
-DATALOAD 0.10 2
-DEPOSIT 0.10 2
-DVD 0.50 0
-DVD-LONG 0.10 2
-E-AUDIO 0.50 1
-E-BOOK 0.50 1
-EQUIP-LONG 0.50 0
-EQUIPMENT 0.50 1
-FACBESTSLR 0.10 2
-FACNEWBK 0.10 2
-FILMSTRIP 0.10 2
-ILL-ITEM 0.50 0
-INTERNET 0.10 1
-KIT 0.10 2
-LASERDISC 0.50 0
-LIBRARYUSE 0.10 2
-MAG-CIRC 0.10 2
-MAG-NOCIRC 0.10 2
-MAP 0.50 1
-MICROFORM 0.10 2
-MUSIC 0.10 2
-NEW-AV 0.50 1
-NEW-BOOK 0.10 2
-NEWSPAPER 0.10 2
-NILS-ITEM 0.10 2
-OUTREACH 0.10 2
-PAMPHLET 0.10 2
-PAPERBACK 0.10 2
-REALIA 0.10 2
-RECORD 0.10 2
-REFERENCE 0.00 0
-RESERVE 0.00 0
-ROOM 0.00 0
-ROOMSATELL 0.00 0
-SOFTWARE 0.10 2
-SOFTWRLONG 0.10 2
-STATE-BOOK 0.10 1
-STATE-MFRM 0.10 2
-TALKINGBK 0.00 0
-TOY 0.10 2
-UNKNOWN 0.10 2
-VIDEO 0.10 0
-VIDEO-LONG 0.10 2
-VIDEO-SPEC 0.00 2
-WEBSOURCE 0.00 2
-\.
-
--- First, we extract the real circs for users that we know about
--- CREATE TABLE legacy_real_circ AS
-INSERT INTO action.circulation
- (
- usr,
- xact_start,
- target_copy,
- circ_lib,
- circ_staff,
- renewal_remaining,
- due_date,
- stop_fines_time,
- duration,
- recuring_fine,
- max_fine,
- desk_renewal,
- duration_rule,
- recuring_fine_rule,
- max_fine_rule,
- stop_fines
- )
- SELECT DISTINCT ON (lc.charge_key1, lc.charge_key2, lc.charge_key3)
- au.id AS usr,
- CASE WHEN lc.renewal_date = 'NEVER' THEN lc.charge_date::DATE ELSE lc.renewal_date::DATE END AS xact_start,
- cp.id AS target_copy,
- ou.id AS circ_lib,
- 1 AS circ_staff,
- tm.renewals AS renewal_remaining,
- CASE WHEN lc.due_date = 'NEVER' THEN (now() + '20 years')::DATE ELSE lc.due_date::DATE END AS due_date,
- CASE WHEN lc.claim_return_date = '0' THEN NULL ELSE lc.claim_return_date::DATE END AS stop_fines_time,
- ((CASE WHEN lc.due_date = 'NEVER' THEN (now() + '20 years')::DATE ELSE lc.due_date::DATE END
- -
- CASE WHEN lc.renewal_date = 'NEVER' THEN lc.charge_date::DATE ELSE lc.renewal_date::DATE END)||' days')::interval AS duration,
- tm.recuring_fine AS recuring_fine,
- COALESCE( mf.max_fine, 5.00 ) AS max_fine,
- CASE WHEN lc.renewal_date = 'NEVER' THEN FALSE ELSE TRUE END AS desk_renewal,
- 'IMPORT'::TEXT AS duration_rule,
- 'IMPORT'::TEXT AS recuring_fine_rule,
- 'IMPORT'::TEXT AS max_fine_rule,
- CASE WHEN lc.claim_return_date = '0' THEN NULL ELSE 'CLAIMSRETURNED' END AS stop_fines
- FROM legacy_charge lc
- JOIN joined_legacy li
- ON ( lc.charge_key1 = li.cat_key
- AND lc.charge_key2 = li.call_key
- AND lc.charge_key3 = li.item_key )
- JOIN asset.copy cp ON (cp.barcode = li.item_id)
- JOIN legacy_type_circ_map tm ON (cp.circ_modifier = tm.item_type)
- JOIN actor.org_unit ou ON (lc.library = ou.shortname)
- JOIN actor.usr au ON (lc.user_key = au.id)
- LEFT JOIN legacy_baduser_map bu ON (bu.id = lc.user_key)
- LEFT JOIN legacy_lib_max_fine mf ON (ou.shortname LIKE mf.lib||'%')
- WHERE bu.id IS NULL
- ORDER BY
- lc.charge_key1,
- lc.charge_key2,
- lc.charge_key3,
- lc.charge_key4 DESC;
-
-
--- Now build a table containing the status change info ...
-CREATE TABLE legacy_status_change_circ AS
- SELECT DISTINCT ON (lc.charge_key1, lc.charge_key2, lc.charge_key3)
- pol.profile AS profile,
- cp.id AS item
- FROM legacy_charge lc
- JOIN joined_legacy li
- ON ( lc.charge_key1 = li.cat_key
- AND lc.charge_key2 = li.call_key
- AND lc.charge_key3 = li.item_key )
- JOIN asset.copy cp ON (cp.barcode = li.item_id)
- JOIN legacy_baduser_map bu ON (bu.id = lc.user_key)
- JOIN legacy_non_real_user pol ON (bu.barcode = pol.barcode)
- WHERE bu.type = 'N'
- ORDER BY
- lc.charge_key1,
- lc.charge_key2,
- lc.charge_key3,
- lc.charge_key4 DESC;
-
--- ... and update the copies with it
-UPDATE asset.copy
- SET status = legacy_copy_status_map.id
- FROM legacy_status_change_circ
- JOIN legacy_copy_status_map ON (legacy_copy_status_map.name = legacy_status_change_circ.profile)
- WHERE asset.copy.id = legacy_status_change_circ.item;
-
-
--- Next up, circ_lib changes based on recirc users ...
-CREATE TABLE legacy_lib_change_circ AS
- SELECT DISTINCT ON (lc.charge_key1, lc.charge_key2, lc.charge_key3)
- ou.id AS lib,
- cp.id AS item
- FROM legacy_charge lc
- JOIN joined_legacy li
- ON ( lc.charge_key1 = li.cat_key
- AND lc.charge_key2 = li.call_key
- AND lc.charge_key3 = li.item_key )
- JOIN asset.copy cp ON (cp.barcode = li.item_id)
- JOIN legacy_baduser_map bu ON (bu.id = lc.user_key)
- JOIN legacy_recirc_lib pol ON (bu.barcode = pol.barcode)
- JOIN actor.org_unit ou ON (ou.shortname = pol.lib)
- WHERE bu.type = 'R'
- ORDER BY
- lc.charge_key1,
- lc.charge_key2,
- lc.charge_key3,
- lc.charge_key4 DESC;
-
--- ... and apply that too.
-UPDATE asset.copy
- SET circ_lib = legacy_lib_change_circ.lib
- FROM legacy_lib_change_circ
- WHERE asset.copy.id = legacy_lib_change_circ.item;
-
-COMMIT;
+++ /dev/null
-BEGIN;
-
--- These are copy level holds
--- CREATE TABLE legacy_copy_hold_insert AS
-create table copy_hold_fix as
- SELECT lh.hold_key AS id,
- cp.id AS target,
- cp.id AS current_copy,
- 'C'::TEXT AS hold_type,
- pou.id AS pickup_lib,
- pou.id AS selection_ou,
- CASE WHEN lh.hold_range = 'SYSTEM' THEN 0
- WHEN lh.hold_range = 'GROUP' THEN 1
- ELSE 2
- END AS selection_depth,
- lh.hold_date AS request_time,
- CASE WHEN lh.available IN ('Y','I') THEN '2006-09-01'::timestamptz
- ELSE NULL
- END AS capture_time,
- rou.id AS request_lib,
- au.id AS requestor,
- au.id AS usr
- FROM legacy_hold lh
- JOIN legacy_item jl
- ON ( jl.cat_key = lh.cat_key
- AND jl.call_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'
- AND lh.hold_date > '2006-01-01';
-
-
--- And these are CN level holds
--- CREATE TABLE legacy_cn_hold_insert AS
-create table cn_hold_fix as
- SELECT lh.hold_key AS id,
- cp.call_number AS target,
- cp.id AS current_copy,
- 'V'::TEXT AS hold_type,
- pou.id AS pickup_lib,
- pou.id AS selection_ou,
- CASE WHEN lh.hold_range = 'SYSTEM' THEN 0
- WHEN lh.hold_range = 'GROUP' THEN 1
- ELSE 2
- END AS selection_depth,
- lh.hold_date AS request_time,
- CASE WHEN lh.available IN ('Y','I') THEN '2006-09-01'::timestamptz
- ELSE NULL
- END AS capture_time,
- rou.id AS request_lib,
- au.id AS requestor,
- au.id AS usr
- FROM legacy_hold lh
- JOIN legacy_item jl
- ON ( jl.cat_key = lh.cat_key
- AND jl.call_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'
- AND lh.hold_date > '2006-01-01';
-
--- And these are Title level holds
--- CREATE TABLE legacy_title_hold_insert AS
-create table title_hold_fix as
- SELECT lh.hold_key AS id,
- lh.cat_key AS target,
- cp.id AS current_copy,
- 'T'::TEXT AS hold_type,
- pou.id AS pickup_lib,
- pou.id AS selection_ou,
- CASE WHEN lh.hold_range = 'SYSTEM' THEN 0
- WHEN lh.hold_range = 'GROUP' THEN 1
- ELSE 2
- END AS selection_depth,
- lh.hold_date AS request_time,
- CASE WHEN lh.available IN ('Y','I') THEN '2006-09-01'::timestamptz
- ELSE NULL
- END AS capture_time,
- rou.id AS request_lib,
- au.id AS requestor,
- au.id AS usr
- FROM legacy_hold lh
- JOIN legacy_item jl
- ON ( jl.cat_key = lh.cat_key
- AND jl.call_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'
- AND lh.hold_date > '2006-01-01';
-
-SELECT SETVAL('action.hold_request_id_seq',(SELECT MAX(id) FROM action.hold_request),TRUE);
-
-COMMIT;
+++ /dev/null
-BEGIN;
-
--- hold transit import
-INSERT INTO action.hold_transit_copy (dest, source, source_send_time, target_copy, copy_status, hold)
- SELECT dou.id AS dest,
- sou.id AS source,
- l.transit_date AS source_send_time,
- cp.id AS target_copy,
- 8 AS copy_status,
- h.id AS hold
- FROM legacy_transit l
- JOIN action.hold_request h ON (l.hold_key = h.id)
- JOIN legacy_item li USING (cat_key, call_key, item_key)
- JOIN asset.copy cp ON (li.item_id = cp.barcode)
- JOIN actor.org_unit dou ON (l.destination_lib = dou.shortname)
- JOIN actor.org_unit sou ON (l.starting_lib = sou.shortname)
- WHERE l.hold_key > 0;
-
--- normal transits
-INSERT INTO action.transit_copy (dest, source, source_send_time, target_copy, copy_status)
- SELECT dou.id AS dest,
- sou.id AS source,
- l.transit_date AS source_send_time,
- cp.id AS target_copy,
- 7 AS copy_status
- FROM legacy_transit l
- JOIN legacy_item li USING (cat_key, call_key, item_key)
- JOIN asset.copy cp ON (li.item_id = cp.barcode)
- JOIN actor.org_unit dou ON (l.destination_lib = dou.shortname)
- JOIN actor.org_unit sou ON (l.starting_lib = sou.shortname)
- WHERE l.hold_key = 0;
-
-COMMIT;
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use Data::Dumper;
-use DBI;
-
-unless (@ARGV) {
- print <<" USAGE";
- Usage: $0 <db-name> <lib-map-output> < <lib-file>
- USAGE
- exit;
-}
-
-my %libs;
-my $lib_map = {};
-while (<STDIN>) {
- chomp;
- my ($policy, $lib, $sys) = split "\t";
- my ($sys_pol) = split '-', $policy;
-
- $libs{$sys_pol}{libs} ||= [];
- $libs{$sys_pol}{name} = $sys;
- $libs{$sys_pol}{type} = 2;
- push @{ $libs{$sys_pol}{libs} }, {name => $lib, shortname => $policy, type => 3 };
-}
-
-my $dbh = DBI->connect("dbi:Pg:host=10.1.0.13;port=5432;dbname=$ARGV[0]",'postgres');
-
-$dbh->begin_work;
-
-my $find_lib_ou = 'select id from actor.org_unit where shortname = ?';
-for my $sname (keys %libs) {
- ($libs{$sname}{id}) = $dbh->selectrow_array($find_lib_ou,{},$sname);
- $lib_map->{$sname} = $libs{$sname}{id};
- for my $lib (@{ $libs{$sname}{libs} }) {
- ($$lib{id}) = $dbh->selectrow_array($find_lib_ou,{},$$lib{shortname});
- $lib_map->{$$lib{shortname}} = $$lib{id};
- }
-}
-
-my $find_parent_ou = 'select parent_ou from actor.org_unit where shortname = ?';
-my $create_lib_ou = 'insert into actor.org_unit (name,shortname,parent_ou,ou_type) VALUES (?,?,?,?)';
-for my $sname (keys %libs) {
- unless ($libs{$sname}{id}) {
- $dbh->do($create_lib_ou,{},$libs{$sname}{name},$sname, 1,$libs{$sname}{type});
- ($libs{$sname}{id}) = $dbh->selectrow_array($find_lib_ou,{},$sname);
- $lib_map->{$sname} = $libs{$sname}{id};
- }
- ($libs{$sname}{parent_ou}) = $dbh->selectrow_array($find_parent_ou,{},$libs{$sname}{shortname});
- my $pid = $libs{$sname}{id};
- for my $lib (@{ $libs{$sname}{libs} }) {
- unless ($$lib{id}) {
- $dbh->do($create_lib_ou,{},$$lib{name},$$lib{shortname}, $pid,$$lib{type});
- ($$lib{id}) = $dbh->selectrow_array($find_lib_ou,{},$$lib{shortname});
- $lib_map->{$$lib{shortname}} = $$lib{id};
- }
- ($$lib{parent_ou}) = $dbh->selectrow_array($find_parent_ou,{},$$lib{shortname});
- }
-}
-
-open FH, ">$ARGV[1]" or die "Can't open $ARGV[1] to write the map file! $!";
-print FH Data::Dumper->Dump([$lib_map],['lib_map']);
-
-warn Dumper( $dbh->selectall_hashref("SELECT * FROM actor.org_unit;" => 'id') );
-
-sleep 10;
-
-$dbh->commit;
-
+++ /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";
-}
+++ /dev/null
-DROP TABLE joined_legacy;
-DROP TABLE legacy_copy_status_map;
-
-BEGIN;
-
--- Build the status map ... by hand, which suxorz.
-CREATE TABLE legacy_copy_status_map (id int, name text);
-COPY legacy_copy_status_map FROM STDIN;
-0 ADULT
-0 AV
-0 AWARDBOOKS
-0 BHDESK
-2 BINDERY
-0 BIOGRAPHY
-0 BOOKMOBILE
-0 BROWSING
-11 CATALOGING
-1 CHECKEDOUT
-0 DATALOAD
-13 DISCARD
-0 DISPLAY
-0 EASY
-0 EASY-RDR
-0 FANTASY
-0 FIC
-0 FIXLIB
-0 FOREIGNL
-0 GA-CIRC
-0 GENEALOGY
-0 GEORGIA
-0 GOV-DOC
-8 HOLDS
-10 ILL
-10 ILS-ILL
-0 INDEX
-5 INPROCESS
-6 INTRANSIT
-0 JUV
-0 LEASE
-0 LG-PRNT
-0 LIB-CLOSED
-0 LITERACY
-0 LONGOVRDUE
-3 LOST
-3 LOST-PAID
-0 MAG
-0 MAPS
-4 MISSING
-0 MYSTERY
-0 NEW-BKS
-0 NEWS
-0 NONFIC
-0 OFFICE
-9 ON-ORDER
-10 ONLOAN
-0 OVERSIZED
-0 PBK
-0 PICTURE
-0 REF
-11 REPAIR
-0 RESERVES
-7 RESHELVING
-0 ROTATING
-0 SCIFI
-0 SHORTSTORY
-0 SPEC-COL-R
-0 SPEC-COLL
-0 SPECNEEDS
-0 STACKS
-0 STATELIBGA
-0 STORAGE
-0 THRILLER
-0 TODDLER
-0 UNAVAILBLE
-0 UNKNOWN
-0 VRTICLFILE
-0 WEBSITE
-0 WESTERN
-0 YA
-\.
-
-
--- First, we build shelving location
-INSERT INTO asset.copy_location (name, owning_lib)
- SELECT DISTINCT l.home_location, ou.id
- FROM legacy_item l JOIN actor.org_unit ou
- ON (l.owning_library = ou.shortname);
-
-
--- Now set their flags
-UPDATE asset.copy_location
- SET holdable = FALSE
- WHERE name IN ('BINDERY','DISCARD','GENEALOGY','GOV-DOC','INDEX',
- 'LIB-CLOSED','LONGOVERDUE','LOST','LOST-PAID','MAG',
- 'NEWS','ONLOAN','REF','REPAIR','SPEC-COL-R');
-
-UPDATE asset.copy_location
- SET opac_visible = FALSE
- WHERE name IN ('DATALOA','DISCARD','FIXLIB','LIB-CLOSED', 'LONGOVERDUE',
- 'LOST','LOST-PAID','STORAGE', 'UNKNOWN');
-
-
--- Now the old stat-cat stuff
-INSERT INTO asset.stat_cat (owner, name) VALUES (1, 'Legacy CAT1');
-INSERT INTO asset.stat_cat_entry (stat_cat, owner, value)
- SELECT DISTINCT currval('asset.stat_cat_id_seq'::regclass), 1, cat_1
- FROM legacy_item;
-
-INSERT INTO asset.stat_cat (owner, name) VALUES (1, 'Legacy CAT2');
-INSERT INTO asset.stat_cat_entry (stat_cat, owner, value)
- SELECT DISTINCT currval('asset.stat_cat_id_seq'::regclass), 1, cat_2
- FROM legacy_item;
-
-
--- Create a temp table to speed up CN and copy inserts
-CREATE TABLE joined_legacy AS
- SELECT i.*, c.call_num
- 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)
- SELECT DISTINCT 1, 1, l.cat_key , l.call_num, ou.id
- FROM joined_legacy l
- JOIN biblio.record_entry b ON (cat_key = b.id)
- JOIN actor.org_unit ou ON (l.owning_library = ou.shortname);
-
-
-
--- 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, alert_message)
- SELECT DISTINCT ou.id AS circ_lib,
- 1 AS creator,
- 1 AS editor,
- l.creation_date AS create_date,
- l.item_id AS barcode,
- s_map.id AS status,
- cl.id AS location,
- 2 AS loan_duration,
- 2 AS fine_level,
- CASE WHEN l.shadow IS TRUE THEN FALSE ELSE TRUE END AS opac_visible,
- (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
- FROM joined_legacy l
- JOIN legacy_copy_status_map s_map
- ON (s_map.name = l.current_location)
- JOIN actor.org_unit ou
- ON (l.owning_library = ou.shortname)
- JOIN asset.copy_location cl
- ON (ou.id = cl.owning_lib AND l.home_location = cl.name)
- JOIN asset.call_number cn
- 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,
- 1,
- 'Legacy Note',
- l.item_comment
- FROM legacy_item l
- JOIN asset.copy cp ON (cp.barcode = l.item_id)
- WHERE l.item_comment IS NOT NULL
- AND l.item_comment <> '';
-
--- Now do stat cats
-INSERT INTO asset.stat_cat_entry_copy_map (stat_cat, stat_cat_entry, owning_copy)
- SELECT sc.id,
- sce.id,
- cp.id
- FROM joined_legacy l
- JOIN asset.copy cp ON (cp.barcode = l.item_id)
- JOIN asset.stat_cat_entry sce ON (sce.value = l.cat_1)
- JOIN asset.stat_cat sc ON (sce.stat_cat = sc.id)
- WHERE sc.name = 'Legacy CAT1';
-
-INSERT INTO asset.stat_cat_entry_copy_map (stat_cat, stat_cat_entry, owning_copy)
- SELECT sc.id,
- sce.id,
- cp.id
- FROM joined_legacy l
- JOIN asset.copy cp ON (cp.barcode = l.item_id)
- JOIN asset.stat_cat_entry sce ON (sce.value = l.cat_2)
- JOIN asset.stat_cat sc ON (sce.stat_cat = sc.id)
- WHERE sc.name = 'Legacy CAT2';
-
-
-COMMIT;
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-print <<SQL;
-CREATE TABLE legacy_non_real_user (profile text, lib text, barcode text);
-COPY legacy_non_real_user (profile, lib, barcode) FROM STDIN;
-SQL
-
-while (<>) {
- chomp;
- my ($p,$l,$b) = split '\|';
- print "$p\t$l\t$b\n";
-}
-
-print '\.'."\n";
-
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-use warnings;
-
-use lib '/openils/lib/perl5';
-
-use OpenSRF::System;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::AppSession;
-use OpenSRF::Utils::SettingsClient;
-use OpenILS::Utils::Fieldmapper;
-use Digest::MD5 qw/md5_hex/;
-use Getopt::Long;
-use OpenSRF::Utils::JSON;
-use DateTime;
-use Time::HiRes qw/time/;
-use XML::LibXML;
-
-my ($file,$config,$profileid,$identtypeid,$default_profile,$profile_map,$seenmap,$nosaveseen,$usermap) =
- ('return_file_0623-2.xml', '/openils/conf/opensrf_core.xml', 1, 3, 'User', 'profile.map','/tmp/patron-import.seen');
-
-GetOptions(
- 'usermap=s' => \$usermap,
- 'file=s' => \$file,
- 'config=s' => \$config,
- 'seenmap=s' => \$seenmap,
- 'no_save_seenmap' => \$nosaveseen,
- 'default_profile=i' => \$default_profile,
- 'profile_map=s' => \$profile_map,
- 'profile_statcat_id=i' => \$profileid,
- 'identtypeid=i' => \$identtypeid,
-);
-
-my %u_map;
-if ($usermap) {
- open F, $usermap;
- while (my $line = <F>) {
- chomp($line);
- my ($b,$i) = split(/\|/, $line);
- $b =~ s/^\s*(\S+)\s*$/$1/o;
- $i =~ s/^\s*(\S+)\s*$/$1/o;
- $u_map{$b} = $i;
- }
- close F;
-}
-
-my %p_map;
-if ($profile_map) {
- open F, $profile_map;
- while (my $line = <F>) {
- chomp($line);
- my ($b,$i) = split(/\|/, $line);
- $b =~ s/^\s*(\S+)\s*$/$1/o;
- $i =~ s/^\s*(\S+)\s*$/$1/o;
- $p_map{$b} = $i;
- }
- close F;
-}
-
-my %s_map;
-if ($seenmap) {
- open F, $seenmap;
- while (my $line = <F>) {
- chomp($line);
- next if ($line eq '');
- $s_map{$line} = 1;
- }
- close F;
-}
-
-my $doc = XML::LibXML->new->parse_file($file);
-
-OpenSRF::System->bootstrap_client( config_file => $config );
-Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
-
-my $cstore = OpenSRF::AppSession->create( 'open-ils.cstore' );
-
-my $profiles = $cstore->request(
- 'open-ils.cstore.direct.permission.grp_tree.search.atomic',
- { id => { '!=' => undef } },
-)->gather(1);
-
-my $orgs = $cstore->request(
- 'open-ils.cstore.direct.actor.org_unit.search.atomic',
- { id => { '!=' => undef } },
-)->gather(1);
-
-$profiles = { map { ($_->name => $_->id) } @$profiles };
-$orgs = { map { ($_->shortname => $_->id) } @$orgs };
-
-my $starttime = time;
-my $count = 1;
-for my $patron ( $doc->documentElement->childNodes ) {
- next if ($patron->nodeType == 3);
- my $p = new Fieldmapper::actor::user;
- my $card = new Fieldmapper::actor::card;
- my $profile_sce = new Fieldmapper::actor::stat_cat_entry_user_map;
-
- my $old_profile = $patron->findvalue( 'user_profile' );
-
- my $bc = $patron->findvalue( 'user_id' );
- if (exists($s_map{$bc})) {
- $count++;
- warn "\n!!! already saw barcode $bc, skipping\n";
- next;
- } else {
- $s_map{$bc} = 1;
- }
-
- unless (defined($bc)) {
- my $xml = $patron->toString;
- warn "\n!!! no barcode found in UMS data, user number $count, xml => $xml \n";
- $count++;
- next;
- }
-
- my $uid;
- if (keys %u_map) {
- $uid = $u_map{$bc};
- unless ($uid) {
- $count++;
- warn "\n!!! no uid mapping found for barcode $bc\n";
- next;
- }
- } else {
- next;
- }
-
- unless ($uid > 1) {
- $count++;
- warn "\n!!! user id lower than 2\n";
- next;
- }
-
- $card->barcode( $bc );
- $card->usr( $uid );
- $card->active( 't' );
-
- $p->id( $uid );
- $p->usrname( $bc );
- $p->passwd( $patron->findvalue( 'user_pin' ) );
-
- my $new_profile = $p_map{$old_profile} || $default_profile;
-
- $p->profile( $$profiles{$new_profile} );
- if (!$p->profile) {
- $count++;
- warn "\n!!! no new profile found for $old_profile\n";
- next;
- }
-
- # some defaults
- $p->standing(1);
- $p->active('t');
- $p->deleted('f');
- $p->master_account('f');
- $p->super_user('f');
- $p->usrgroup($uid);
- $p->claims_returned_count(0);
- $p->credit_forward_balance(0);
- $p->last_xact_id('IMPORT-'.$starttime);
-
- $p->barred('f');
- $p->barred('t') if ( $patron->findvalue( 'user_status' ) eq 'BARRED' );
-
- $p->ident_type( $identtypeid );
- my $id_val = $patron->findvalue( 'user_altid' );
- $p->ident_value( $id_val ) if ($id_val);
-
- my ($fname,$mname,$lname) = ($patron->findvalue('first_name'),$patron->findvalue('middle_name'),$patron->findvalue('last_name'));
-
- $fname =~ s/^\s*//o;
- $mname =~ s/^\s*//o;
- $lname =~ s/^\s*//o;
-
- $fname =~ s/\s*$//o;
- $mname =~ s/\s*$//o;
- $lname =~ s/\s*$//o;
-
- $p->first_given_name( $fname );
- $p->second_given_name( $mname );
- $p->family_name( $lname );
-
- $p->day_phone( $patron->findvalue( 'Address/dayphone' ) );
- $p->evening_phone( $patron->findvalue( 'Address/homephone' ) );
- $p->other_phone( $patron->findvalue( 'Address/workphone' ) );
-
- my $hlib = $$orgs{$patron->findvalue( 'user_library' )};
- unless ($hlib) {
- $count++;
- warn "\n!!! no home library found in patron record\n";
- next;
- }
- $p->home_ou( $hlib );
-
- $p->dob( parse_date( $patron->findvalue( 'birthdate' ) ) );
- $p->create_date( parse_date( $patron->findvalue( 'user_priv_granted' ) ) );
- $p->expire_date( parse_date( $patron->findvalue( 'user_priv_expires' ) ) );
-
- $p->alert_message("Legacy Import Message: old profile was FIXME")
- if ($old_profile eq 'FIXME');
-
- my $net_access = 1;
- $net_access = 2 if ($old_profile =~ /^U.I/o);
- $net_access = 3 if ($old_profile =~ /^X.I/o);
-
- $p->net_access_level( $net_access );
-
- $profile_sce->target_usr( $uid );
- $profile_sce->stat_cat( $profileid );
- $profile_sce->stat_cat_entry( $old_profile );
-
- my @addresses;
- my $mailing_addr_id = $patron->findvalue( 'user_mailingaddr' );
-
- my $all_valid = 't';
- for my $addr ( $patron->findnodes( "Address" ) ) {
- if (!$p->email) {
- $p->email( $patron->findvalue( 'email' ) );
- }
-
- my $prefix = 'coa_';
-
- my $line1 = $addr->findvalue( "${prefix}line1" );
- $prefix = 'std_' if (!$line1);
-
- $line1 = $addr->findvalue( "${prefix}line1" );
- next unless ($line1);
-
- my $a = new Fieldmapper::actor::user_address;
- $a->usr( $uid );
- $a->street1( $line1 );
- $a->street2( $addr->findvalue( "${prefix}line2" ) );
- $a->city( $addr->findvalue( "${prefix}city" ) );
- $a->state( $addr->findvalue( "${prefix}state" ) );
- $a->post_code(
- $addr->findvalue( "${prefix}zip" ) .
- '-' . $addr->findvalue( "${prefix}zip4" )
- );
-
- $a->valid( 'f' );
- $a->valid( 't' ) if ($prefix eq 'std_');
- $a->valid( 'f' ) if ($prefix eq 'std_' and $addr->findvalue( "${prefix}dpvscore" ) < 3);
-
- $a->within_city_limits( 'f' );
- $a->country('USA');
-
- if ($addr->getAttribute('addr_type') == $mailing_addr_id) {
- $a->address_type( 'LEGACY MAILING' );
- } else {
- $a->address_type( 'LEGACY' );
- }
-
- push @addresses, $a;
-
- if ($prefix eq 'coa_') {
- $all_valid = 'f';
- $prefix = 'std_';
-
- $line1 = $addr->findvalue( "${prefix}line1" );
- next unless ($line1);
-
- $a = new Fieldmapper::actor::user_address;
- $a->usr( $uid );
- $a->street1( $line1 );
- $a->street2( $addr->findvalue( "${prefix}line2" ) );
- $a->city( $addr->findvalue( "${prefix}city" ) );
- $a->state( $addr->findvalue( "${prefix}state" ) );
- $a->post_code(
- $addr->findvalue( "${prefix}zip" ) .
- '-' . $addr->findvalue( "${prefix}zip4" )
- );
-
- $a->valid( 'f' );
-
- $a->within_city_limits( 'f' );
- $a->country('USA');
-
- $a->address_type( 'LEGACY' );
-
- push @addresses, $a;
- }
- }
-
- if ($all_valid eq 'f') {
- $_->valid('f') for (@addresses);
- }
-
- my @notes;
- for my $note_field ( qw#note comment voter bus_school Address/phone1 Address/phone2# ) {
- for my $note ( $patron->findnodes( $note_field) ) {
- my $a = new Fieldmapper::actor::usr_note;
-
- $a->creator(1);
- $a->create_date('now');
- $a->usr( $uid );
- $a->title( "Legacy ".$note->localName );
- $a->value( $note->textContent );
- $a->pub( 'f' );
- push @notes, $a;
- }
- }
-
- print STDERR "\r$count ".$count/(time - $starttime) unless ($count % 100);
- print OpenSRF::Utils::JSON->perl2JSON( $_ )."\n" for ($p,$card,$profile_sce,@addresses,@notes);
-
- $count++;
-}
-
-unless ($nosaveseen) {
- warn "writing seen_map $seenmap...\n";
-
- open F, ">$seenmap";
- print F "$_\n" for (keys %s_map);
- close F;
-}
-
-print STDERR "\n";
-
-
-sub parse_date {
- my $string = shift;
- my $group = shift;
-
- my ($y,$m,$d);
-
- if ($string eq 'NEVER') {
- my (undef,undef,undef,$d,$m,$y) = localtime();
- return sprintf('%04d-%02d-%02d', $y + 1920, $m + 1, $d);
- } elsif (length($string) == 8 && $string =~ /^(\d{4})(\d{2})(\d{2})$/o) {
- ($y,$m,$d) = ($1,$2,$3);
- } elsif ($string =~ /(\d+)\D(\d+)\D(\d+)/o) { #looks like it's parsable
- if ( length($3) > 2 ) { # looks like mm.dd.yyyy
- if ( $1 < 99 && $2 < 99 && $1 > 0 && $2 > 0 && $3 > 0) {
- if ($1 > 12 && $1 < 31 && $2 < 13) { # well, actually it looks like dd.mm.yyyy
- ($y,$m,$d) = ($3,$2,$1);
- } elsif ($2 > 12 && $2 < 31 && $1 < 13) {
- ($y,$m,$d) = ($3,$1,$2);
- }
- }
- } elsif ( length($1) > 3 ) { # format probably yyyy.mm.dd
- if ( $3 < 99 && $2 < 99 && $1 > 0 && $2 > 0 && $3 > 0) {
- if ($2 > 12 && $2 < 32 && $3 < 13) { # well, actually it looks like yyyy.dd.mm -- why, I don't konw
- ($y,$m,$d) = ($1,$3,$2);
- } elsif ($3 > 12 && $3 < 31 && $2 < 13) {
- ($y,$m,$d) = ($1,$2,$3);
- }
- }
- } elsif ( $1 < 99 && $2 < 99 && $3 < 99 && $1 > 0 && $2 > 0 && $3 > 0) {
- if ($3 < 7) { # probably 2000 or greater, mm.dd.yy
- $y = $3 + 2000;
- if ($1 > 12 && $1 < 32 && $2 < 13) { # well, actually it looks like dd.mm.yyyy
- ($m,$d) = ($2,$1);
- } elsif ($2 > 12 && $2 < 32 && $1 < 13) {
- ($m,$d) = ($1,$2);
- }
- } else { # probably before 2000, mm.dd.yy
- $y = $3 + 1900;
- if ($1 > 12 && $1 < 32 && $2 < 13) { # well, actually it looks like dd.mm.yyyy
- ($m,$d) = ($2,$1);
- } elsif ($2 > 12 && $2 < 32 && $1 < 13) {
- ($m,$d) = ($1,$2);
- }
- }
- }
- }
-
- my $date;
- if ($y && $m && $d) {
- try {
- $date = sprintf('%04d-%02d-%-2d',$y, $m, $d)
- if (new DateTime ( year => $y, month => $m, day => $d ));
- } otherwise {};
- }
-
- return $date;
-}
-
+++ /dev/null
-#!/bin/sh
-dropdb demo-dev
-createdb -E UNICODE demo-dev
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-print <<SQL;
-CREATE TABLE legacy_piece_count (barcode text, cnt int);
-COPY legacy_piece_count (barcode, cnt) FROM STDIN;
-SQL
-
-while (<>) {
- chomp;
- my ($bc,$c) = split '\|';
- $bc =~ s/\s*$//o;
- print "$bc\t$c\n" if ($c > 1);
-}
-
-print '\.'."\n";
-print "CREATE INDEX pc_bc_idx ON legacy_piece_count (barcode);\n";
-
+++ /dev/null
-BROOK-HQ Headquarters Brooks County Library
-CHAT-TRION Trion Public Library Chattooga County Library
-CHAT-SMRVL Summerville Branch Chattooga County Library
-CHRL-LW LaFayette-Walker County Library Cherokee Regional Library
-CHRL-ROSS Rossville Public Library Cherokee Regional Library
-CHRL-CHICK Chickamauga Public Library Cherokee Regional Library
-CHRL-DADE Dade County Public Library Cherokee Regional Library
-CRLS-LMPKN Lumpkin County Library Chestatee Regional Library
-CRLS-DAWSN Dawson County Library Chestatee Regional Library
-DTRL-CAMI Camilla-DeSoto Trail Regional Library Desoto Trail Regional Library
-DTRL-SYLV Sylvester-Margaret Jones Library Desoto Trail Regional Library
-DTRL-BLAK Blakely-Maddox Memorial Library Desoto Trail Regional Library
-DTRL-PELH Pelham-Pelham Carnegie Library Desoto Trail Regional Library
-FBHCL-MAIN Fitzgerald-Ben Hill Library Fitzgerald-Ben Hill Library
-FRRLS-GR Griffin-Spalding County Library Flint River Regional Library
-FRRLS-JA Jackson-Butts County Public Library Flint River Regional Library
-FRRLS-BA Barnesville-Lamar County Library Flint River Regional Library
-FRRLS-FY Monroe County Library Flint River Regional Library
-FRRLS-FA Fayette County Public Library Flint River Regional Library
-FRRLS-PT Peachtree City Library Flint River Regional Library
-FRRLS-ZE J. Joel Edwards Public Library Flint River Regional Library
-FRRLS-TY Tyrone Public Library Flint River Regional Library
-HART-HQ Hart County Library Hart County Library
-HCLS-LG Locust Grove Public Library Henry County Library
-HCLS-MD Alexander Public Library / McDonough Henry County Library
-HCLS-ST Cochran Public Library / Stockbridge Henry County Library
-HCLS-HA Fortson Public Library / Hampton Henry County Library
-HOU-PE Perry Branch Library Houston County Public Library
-HOU-WR Nola Brantley Memorial Library / Warner Robins Houston County Public Library
-HOU-CV Centerville Branch Library Houston County Public Library
-JCL-LVILLE Louisville Public Library Jefferson County Library
-JCL-WRENS McCollum Public Library Jefferson County Library
-JCL-WADLEY Wadley Public Library Jefferson County Library
-JCL-BKMOBL Bookmobile Jefferson County Library
-KRLS-AR Arlington Branch Library Kinchafoonee Regional Library
-KRLS-CA Calhoun County Library Kinchafoonee Regional Library
-KRLS-CL Clay County Library Kinchafoonee Regional Library
-KRLS-RA Randolph County Library Kinchafoonee Regional Library
-KRLS-TE Terrell County Library Kinchafoonee Regional Library
-KRLS-WE Webster County Library Kinchafoonee Regional Library
-KRLS-KI Kinchafoonee Regional Library System Kinchafoonee Regional Library
-LEE-SMV Smithville Library Lee County Public Library
-LEE-LSB Lee County Library Lee County Public Library
-MGRL-WA Washington Memorial Library Middle Georgia Regional Library
-MGRL-SH Shurling Branch Library Middle Georgia Regional Library
-MGRL-RV Riverside Branch Library Middle Georgia Regional Library
-MGRL-RC Rocky Creek Branch Library Middle Georgia Regional Library
-MGRL-WB West Bibb Branch Library Middle Georgia Regional Library
-TLLS-MV Mary Vinson Memorial Library Twin Lakes Library
-MGRL-RO Crawford County Public Library Middle Georgia Regional Library
-MGRL-JO Jones County Public Library Middle Georgia Regional Library
-MGRL-ID Ideal Public Library Middle Georgia Regional Library
-MGRL-OG Oglethorpe Public Library Middle Georgia Regional Library
-MGRL-MA Marshallville Public Library Middle Georgia Regional Library
-MGRL-MO Montezuma Public Library Middle Georgia Regional Library
-MGRL-TW Twiggs County Public Library Middle Georgia Regional Library
-MGRL-EW East Wilkinson County Library Middle Georgia Regional Library
-MGRL-GO Gordon Public Library Middle Georgia Regional Library
-MGRL-GH Genealogical and Historical Department Middle Georgia Regional Library
-MGRL-LB Library for the Blind & Physically Handicapped Middle Georgia Regional Library
-MGRL-MM Miss Martha Bookmobile Middle Georgia Regional Library
-ARL-ATH Athens-Clarke County Library Athens Regional Library
-MGRL-RE Regional Library Middle Georgia Regional Library
-MCCLS-HQ Moultrie-Colquitt County Library Moultrie-Colquitt County Library
-TRRL-SAPLO Sapelo Branch Library Three Rivers Regional Library
-MCCLS-DOE Monroe Memorial Library Moultrie-Colquitt County Library
-MCCLS-BKM Bookmobile Moultrie-Colquitt County Library
-MRLS-MRL Mountain Regional Library Mountain Regional Library
-MRLS-BKMB Bookmobile Mountain Regional Library
-MRLS-FCPL Fannin County Public Library Mountain Regional Library
-MRLS-TCPL Towns County Public Library Mountain Regional Library
-MRLS-UCPL Union County Public Library Mountain Regional Library
-NEG-CLRKVL Clarkesville-Habersham County Library Northeast Georgia Regional Library
-NEG-CORNEL Cornelia-Habersham County Library Northeast Georgia Regional Library
-NEG-CLVLND White County Library - Cleveland Branch Northeast Georgia Regional Library
-NEG-HELEN White County Library - Helen Branch Northeast Georgia Regional Library
-NEG-RABUN Rabun County Library Northeast Georgia Regional Library
-NEG-TOCCOA Toccoa-Stephens County Library Northeast Georgia Regional Library
-PIED-PEN Pendergrass Public Library Piedmont Regional Library System
-ORLS-HDQ Ocmulgee Regional Library Headquarters Ocmulgee Regional Library
-ORLS-TEL Telfair County Library Ocmulgee Regional Library
-ORLS-BLE Bleckly County Library Ocmulgee Regional Library
-ORLS-WIL Wilcox County Library Ocmulgee Regional Library
-ORLS-PUL Pulaski County Library Ocmulgee Regional Library
-ORLS-WHE Wheeler County Library Ocmulgee Regional Library
-ORLS-EXT Extension Services Ocmulgee Regional Library
-OHOOP-VIDT Vidalia-Toombs County Library Ohoopee Regional Library
-OHOOP-MONT Montgomery County Library Ohoopee Regional Library
-OHOOP-LYON Nelle Brown Memorial [Lyon] Ohoopee Regional Library
-OHOOP-TATR Reidsville / Tattnall County Library Ohoopee Regional Library
-OHOOP-TATG Glennville / Tattnall County Library Ohoopee Regional Library
-OHOOP-BKML Bookmobile Ohoopee Regional Library
-PPL-TPL Thomas Public Library Peach Public Libraries
-PPL-BPL Byron Public Library Peach Public Libraries
-PPL-LEC Peach County Law Enforcement Center Peach Public Libraries
-PMRLS-BPL Butler Public Library Pine Mountain Regional Library
-PMRLS-HML Hightower Memorial Library Pine Mountain Regional Library
-PMRLS-GPL Greenville Area Public Library Pine Mountain Regional Library
-PMRLS-MPL Manchester Public Library Pine Mountain Regional Library
-PMRLS-RCL Reynolds Community Library Pine Mountain Regional Library
-PMRLS-TCL Talbot County Library Pine Mountain Regional Library
-PMRLS-EXT Extension Services Pine Mountain Regional Library
-RML-MAIN Roddenbery Memorial Library Roddenbery Memorial Library
-SRL-AMBR Ambrose Public Library Satilla Regional Library
-SRL-BKMO Bookmobile Satilla Regional Library
-SRL-BROX Broxton Public Library Satilla Regional Library
-SRL-DOUG Douglas-Coffee County Library Satilla Regional Library
-SRL-JDHAZ Hazlehurst-Jeff Davis Branch Satilla Regional Library
-SRL-NICH Nicholls Public Library Satilla Regional Library
-SRL-PEAR Pearson Public Library Satilla Regional Library
-SRL-WILLA Willacoochee Public Library Satilla Regional Library
-SJRLS-SCL Screven County Library Screven-Jenkins Regional Library
-SJRLS-JCML Jenkins County Memorial Library Screven-Jenkins Regional Library
-SJRLS-BKM Bookmobile Screven-Jenkins Regional Library
-SJRLS-JCES Jenkins County Elementary School Screven-Jenkins Regional Library
-TRRL-SSI St. Simons Library Three Rivers Regional Library
-SWGRL-DEC Decatur County Public Library Southwest Georgia Regional Library
-SWGRL-BKM Bookmobile Southwest Georgia Regional Library
-SWGRL-SEM Seminole Public Library Southwest Georgia Regional Library
-SWGRL-MIL Miller County Public Library Southwest Georgia Regional Library
-ARL-WAT Watkinsville/Oconee County Library Athens Regional Library
-ARL-BOG Bogart Library Athens Regional Library
-ARL-LEX Lexington/Oglethorpe County Library Athens Regional Library
-ARL-DAN Danielsville/Madison County Library Athens Regional Library
-ARL-WINT Winterville Library Athens Regional Library
-ARL-LAV Lavonia Carnegie Library Athens Regional Library
-ARL-ROY Royston Library Athens Regional Library
-URRLS-GR Greene County Public Library Uncle Remus Regional Library
-URRLS-HA Hancock County Public Library Uncle Remus Regional Library
-URRLS-JA Jasper County Public Library Uncle Remus Regional Library
-URRLS-MA Morgan County Library Uncle Remus Regional Library
-URRLS-MR Monroe-Walton County Library Uncle Remus Regional Library
-URRLS-OK O'Kelly Memorial Library Uncle Remus Regional Library
-URRLS-PU Putnam County Public Library Uncle Remus Regional Library
-URRLS-SC Stanton Memorial Library Uncle Remus Regional Library
-OHOOP-LADS Ladson Genealogical Library Ohoopee Regional Library
-ARL-ENSAT Sandy Creek ENSAT Resource Ctr. Athens Regional Library
-ARL-LYNDON Lyndon House Art Resource Ctr. Athens Regional Library
-ARL-BKM Bookmobile Athens Regional Library
-ARL-EAST East Athens Community Resource Ctr. Athens Regional Library
-ARL-LAY Lay Park Community Resource Ctr. Athens Regional Library
-BTRL-MWL Mary Willis Library Bartram Trail Regional Library
-BTRL-MCD Thomson-McDuffie County Library Bartram Trail Regional Library
-BTRL-TCL Taliaferro County Library Bartram Trail Regional Library
-BTRL-BKM Bookmobile Bartram Trail Regional Library
-CLAYTN-HQS Headquarters Library Clayton County Library System
-CLAYTN-FOR Forest Park Branch Clayton County Library System
-CLAYTN-JON Jonesboro Branch Clayton County Library System
-CLAYTN-LOV Lovejoy Branch (projected) Clayton County Library System
-CLAYTN-MOR Morrow Branch Clayton County Library System
-CLAYTN-RIV Riverdale Branch Clayton County Library System
-CPRL-A Victoria Evans Memorial Library Coastal Plain Regional Library
-CPRL-B Carrie Dorsey Perry Memorial Library Coastal Plain Regional Library
-CPRL-C Cook County Library Coastal Plain Regional Library
-CPRL-L Irwin County Library Coastal Plain Regional Library
-CPRL-R Headquarters Library Coastal Plain Regional Library
-CPRL-T Tifton-Tift County Public Library Coastal Plain Regional Library
-CPRL-BKM Bookmobile Coastal Plain Regional Library
-DCPL-CEN Central Branch Dougherty County Public Library
-DCPL-NW Northwest Branch Dougherty County Public Library
-DCPL-TAL Tallulah Branch Dougherty County Public Library
-DCPL-WT Westtown Branch Dougherty County Public Library
-DCPL-SS Southside Branch Dougherty County Public Library
-ECGR-MAIN Augusta-Richmond Co. Public Lib. East Central Georgia Regional Library
-ECGR-AVTBC Audio-Visual/Talking Book Center East Central Georgia Regional Library
-ECGR-APPBY Appleby Branch Library East Central Georgia Regional Library
-ECGR-FRMAN Friedman Branch Library East Central Georgia Regional Library
-ECGR-MXWLL Maxwell Branch Library East Central Georgia Regional Library
-ECGR-WALLC Wallace Branch Library East Central Georgia Regional Library
-ECGR-DIAML Diamond Lakes Branch Library East Central Georgia Regional Library
-ECGR-BKM Bookmobile East Central Georgia Regional Library
-ECGR-BURKE Burke County Library, Waynesboro East Central Georgia Regional Library
-ECGR-MIDVL Midville Branch Library East Central Georgia Regional Library
-ECGR-SRDIS Sardis Branch Library East Central Georgia Regional Library
-ECGR-CCO Columbia County Library East Central Georgia Regional Library
-ECGR-HARLM Harlem Branch library East Central Georgia Regional Library
-ECGR-EUCHE Euchee Creek Library East Central Georgia Regional Library
-ECGR-WARRN Warren County Library East Central Georgia Regional Library
-ECGR-LINCN Lincoln County Library East Central Georgia Regional Library
-OCRL-GIBSN Glascock County Library Oconee Regional Library
-ECPL-ECPL Elbert County Public Library Elbert County Public Library
-ECPL-BWMN Bowman Branch Elbert County Public Library
-ECPL-BKM Bookmobile Elbert County Public Library
-HALL-BPL Blackshear Place Branch Hall County Library System
-HALL-CL Clermont Branch Hall County Library System
-HALL-EH East Hall and Special Needs Library Hall County Library System
-HALL-GVL Headquarters Branch Hall County Library System
-HALL-MV Murrayville Branch Hall County Library System
-NCLS-COVTN Newton County Library / Covington Branch Newton County Library System
-OCRL-WRIGH Johnson County Library Oconee Regional Library
-OCRL-DUBLN Laurens County Library Oconee Regional Library
-OCRL-SANDR Rosa M. Tarbutton Memorial Library Oconee Regional Library
-OCRL-SOPER Treutlen County Library Oconee Regional Library
-STATELIB-L Ga. State Library Collection Office of Public Library Services
-PIED-TAL Talmo Public Library Piedmont Regional Library System
-STATELIB-B Ga. GLASS Office of Public Library Services
-OKRL-CLNCH Clinch County Public Library Okefenokee Regional Library System
-OKRL-BACON Alma-Bacon County Public Library Okefenokee Regional Library System
-ARL-PWOODS Pinewoods North Community Learning Center Athens Regional Library
-OKRL-BLMEM Blackshear Memorial Library Okefenokee Regional Library System
-OKRL-APPL Appling County Public Library Okefenokee Regional Library System
-OKRL-WWC Waycross-Ware Co. Public Lib. Okefenokee Regional Library System
-OKRL-BKM Bookmobile Okefenokee Regional Library System
-SHRL-RM Rome Branch Sara Hightower Regional Library
-SHRL-CS Cave Spring Branch Sara Hightower Regional Library
-SHRL-RK Rockmart Branch Sara Hightower Regional Library
-SHRL-CD Cedartown Branch Sara Hightower Regional Library
-SHRL-BK Outreach Collection Sara Hightower Regional Library
-STRL-SBORO Headquarters-Statesboro Statesboro Regional Library
-STRL-METT L.C. Anderson Memorial Library Statesboro Regional Library
-STRL-PEMB Bryan County Library - Pembroke Statesboro Regional Library
-STRL-RHILL Bryan County Library - Richmond Hill Statesboro Regional Library
-STRL-SWAIN Franklin Memorial Library Statesboro Regional Library
-STRL-CLAX Evans County Library Statesboro Regional Library
-TRRL-BRANT Brantley County Library Three Rivers Regional Library
-TRRL-CAMDN Camden County Library Three Rivers Regional Library
-TRRL-CHARL Charlton County Library Three Rivers Regional Library
-TRRL-GLYNN Brunswick-Glynn County Library Three Rivers Regional Library
-TRRL-LONG Long County Library Three Rivers Regional Library
-TRRL-MCINT McIntosh County/Ida Hilton Library Three Rivers Regional Library
-TRRL-STMRY St. Mary's Library Three Rivers Regional Library
-TRRL-WAYNE Wayne County Library Three Rivers Regional Library
-TRRL-BKM Bookmobile Three Rivers Regional Library
-WGRL-HQ West Ga. Regional Library Hdqtrs. West Georgia Regional Library
-WGRL-BKM Bookmobile West Georgia Regional Library
-WGRL-BO Bowdon Public Library West Georgia Regional Library
-WGRL-BR Bremen Public Library West Georgia Regional Library
-WGRL-DC Douglas County Public Library West Georgia Regional Library
-WGRL-FR Heard County Public Library West Georgia Regional Library
-WGRL-LS Lithia Springs Betty C. Hagler Public Library West Georgia Regional Library
-WGRL-MR Maude Ragsdale Public Library West Georgia Regional Library
-WGRL-NG New Georgia Public Library West Georgia Regional Library
-WGRL-PC Paulding County Public Library West Georgia Regional Library
-WGRL-TA Tallapoosa Public Library West Georgia Regional Library
-WGRL-VR Villa Rica Public Library West Georgia Regional Library
-PMRLS-YPL Yatesville Public Library Pine Mountain Regional Library
-DTRL-BAKR Baker County Library Desoto Trail Regional Library
-DTRL-JAKN Jakin Public Library Desoto Trail Regional Library
-PIED-WIN Headquarters-Winder Piedmont Regional Library System
-PIED-AUB Auburn Public Library Piedmont Regional Library System
-PIED-COM Commerce Public Library Piedmont Regional Library System
-PIED-HOM Banks County Public Library Piedmont Regional Library System
-PIED-JEF Jefferson Public Library Piedmont Regional Library System
-PIED-MAY Maysville Public Library Piedmont Regional Library System
-PIED-NIC H.S. Swindle Public (Nicholson) Piedmont Regional Library System
-PIED-STA Statham Public Library Piedmont Regional Library System
-PIED-BKM Bookmobile Piedmont Regional Library System
-PIED-BRL Braselton Library Piedmont Regional Library System
-ROCK-NG Nancy Guinn Library Conyers-Rockdale Library System
-TLLS-LS Lake Sinclair Library Twin Lakes Library
-WGRL-BU Buchanan Branch Library West Georgia Regional Library
-HALL-TEMP Temp branch Hall County Library System
-LEE-RED Redbone Lee County Public Library
+++ /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";
-
+++ /dev/null
-CIR1|Circ1
-CIR1LOG|Circ1
-CIR2|Circ2
-CIR3|Circ3
-CIR4|Circ4
-CAT1|Cat1
-CAT1LOG|Cat1
-OCLCCAT1|Cat1
-OCLCCAT1LO|Cat1
-CAT2|Cat2
-CAT2LOG|Cat2
-CAT3|Cat3
-CAT3LOG|Cat3
-STAFF|Staff
-LIBM|LibraryManager
-OPSM|LocalAdmin
-NON-RES|NonResident
-OUTOFSTATE|OutOfState
-OUTREACH|Outreach
-RESTRICTED|Patron
-TEACHER|Patron
-TRUSTEE|Trustee
-UAINTERNET|Patron
-UJINTERNET|Patron
-WEBSERVER|Patron
-XAINTERNET|Patron
-XJINTERNET|Patron
-FIXME|Patron
-ADULT|Patron
-FRIEND|Patron
-JUV|Patron
-VENDOR|CatVendor
-SELFCHK|SIP-Client
-SIPCHK|SIP-Client
-GUEST|User
-WEBGUEST|User
-WEBUSER|User
-WEBSERVER|User
-SIRSI|User
-ADMIN|User
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-print <<SQL;
-CREATE TABLE legacy_recirc_lib (barcode text, lib text);
-COPY legacy_recirc_lib (barcode, lib) FROM STDIN;
-SQL
-
-while (<>) {
- chomp;
- my ($b,$l) = split '\|';
- print "$b\t$l\n";
-}
-
-print '\.'."\n";
-
+++ /dev/null
-#!/usr/bin/perl
-
-print "CREATE TABLE legacy_renewal_count ( barcode text, cnt int);\n";
-print "COPY legacy_renewal_count FROM STDIN;\n";
-
-while (<>) {
- chomp;
- my ($b,$c) = split '\|';
- $b =~ s/\s*$//o;
- print "$b\t$c\n";
-}
-
-print "\\.\n";
-
+++ /dev/null
-#!/bin/sh
-
-CLUSTER=prod_replica_set
-DBNAME=sparkle
-MASTERHOST=10.1.0.13
-SLAVEHOST=10.1.0.14
-STATSHOST=10.1.0.11
-PGUSER=postgres
-BINDIR=/opt/pg814/bin
-
-$BINDIR/slonik <<_EOF_
-
- #--
- # define the namespace the replication system uses in our example it is
- # slony_example
- #--
-
- cluster name = $CLUSTER;
-
- #--
- # admin conninfo's are used by slonik to connect to the nodes one for each
- # node on each side of the cluster, the syntax is that of PQconnectdb in
- # the C-API
- # --
-
- node 1 admin conninfo = 'dbname=$DBNAME host=$MASTERHOST user=$PGUSER';
- node 2 admin conninfo = 'dbname=$DBNAME host=$SLAVEHOST user=$PGUSER';
- node 3 admin conninfo = 'dbname=$DBNAME host=$STATSHOST user=$PGUSER';
-
- #--
- # init the first node. Its id MUST be 1. This creates the schema
- # _$CLUSTERNAME containing all replication system specific database
- # objects.
- #--
-
- init cluster ( id=1, comment = 'Master Node');
-
- #--
- # Slony-I organizes tables into sets. The smallest unit a node can
- # subscribe is a set.
- #--
-
- create set (id=1, origin=1, comment='All Open-ILS Tables');
-
- set add table (set id=1, origin=1, id=1, fully qualified name = 'offline.script', comment = '');
- set add table (set id=1, origin=1, id=2, fully qualified name = 'offline.session', comment = '');
-
- set add table (set id=1, origin=1, id=3, fully qualified name = 'config.bib_source', comment = '');
- set add table (set id=1, origin=1, id=4, fully qualified name = 'config.standing', comment = '');
- set add table (set id=1, origin=1, id=5, fully qualified name = 'config.metabib_field', comment = '');
- set add table (set id=1, origin=1, id=6, fully qualified name = 'config.non_cataloged_type', comment = '');
- set add table (set id=1, origin=1, id=7, fully qualified name = 'config.identification_type', comment = '');
- set add table (set id=1, origin=1, id=8, fully qualified name = 'config.rule_circ_duration', comment = '');
- set add table (set id=1, origin=1, id=9, fully qualified name = 'config.rule_max_fine', comment = '');
- set add table (set id=1, origin=1, id=10, fully qualified name = 'config.rule_recuring_fine', comment = '');
- set add table (set id=1, origin=1, id=11, fully qualified name = 'config.rule_age_hold_protect', comment = '');
- set add table (set id=1, origin=1, id=12, fully qualified name = 'config.copy_status', comment = '');
- set add table (set id=1, origin=1, id=13, fully qualified name = 'config.net_access_level', comment = '');
- set add table (set id=1, origin=1, id=14, fully qualified name = 'config.audience_map', comment = '');
- set add table (set id=1, origin=1, id=15, fully qualified name = 'config.lit_form_map', comment = '');
- set add table (set id=1, origin=1, id=16, fully qualified name = 'config.language_map', comment = '');
- set add table (set id=1, origin=1, id=17, fully qualified name = 'config.item_form_map', comment = '');
- set add table (set id=1, origin=1, id=18, fully qualified name = 'config.item_type_map', comment = '');
-
- set add table (set id=1, origin=1, id=19, fully qualified name = 'actor.usr', comment = '');
- set add table (set id=1, origin=1, id=20, fully qualified name = 'actor.usr_note', comment = '');
- set add table (set id=1, origin=1, id=21, fully qualified name = 'actor.usr_standing_penalty', comment = '');
- set add table (set id=1, origin=1, id=22, fully qualified name = 'actor.usr_setting', comment = '');
- set add table (set id=1, origin=1, id=23, fully qualified name = 'actor.stat_cat', comment = '');
- set add table (set id=1, origin=1, id=24, fully qualified name = 'actor.stat_cat_entry', comment = '');
- set add table (set id=1, origin=1, id=25, fully qualified name = 'actor.stat_cat_entry_usr_map', comment = '');
- set add table (set id=1, origin=1, id=26, fully qualified name = 'actor.card', comment = '');
- set add table (set id=1, origin=1, id=34, fully qualified name = 'actor.usr_address', comment = '');
-
- set add table (set id=1, origin=1, id=27, fully qualified name = 'actor.org_unit_type', comment = '');
- set add table (set id=1, origin=1, id=28, fully qualified name = 'actor.org_unit', comment = '');
- set add table (set id=1, origin=1, id=29, fully qualified name = 'actor.org_unit_proximity', comment = '');
- set add table (set id=1, origin=1, id=30, fully qualified name = 'actor.hours_of_operation', comment = '');
- set add table (set id=1, origin=1, id=31, fully qualified name = 'actor.org_unit_closed', comment = '');
- set add table (set id=1, origin=1, id=32, fully qualified name = 'actor.workstation', comment = '');
- set add table (set id=1, origin=1, id=33, fully qualified name = 'actor.org_unit_setting', comment = '');
- set add table (set id=1, origin=1, id=35, fully qualified name = 'actor.org_address', comment = '');
-
- set add table (set id=1, origin=1, id=36, fully qualified name = 'permission.perm_list', comment = '');
- set add table (set id=1, origin=1, id=37, fully qualified name = 'permission.grp_tree', comment = '');
- set add table (set id=1, origin=1, id=38, fully qualified name = 'permission.grp_perm_map', comment = '');
- set add table (set id=1, origin=1, id=39, fully qualified name = 'permission.usr_perm_map', comment = '');
- set add table (set id=1, origin=1, id=40, fully qualified name = 'permission.usr_grp_map', comment = '');
-
- set add table (set id=1, origin=1, id=41, fully qualified name = 'biblio.record_entry', comment = '');
- set add table (set id=1, origin=1, id=42, fully qualified name = 'biblio.record_note', comment = '');
-
- set add table (set id=1, origin=1, id=43, fully qualified name = 'authority.record_entry', comment = '');
- set add table (set id=1, origin=1, id=44, fully qualified name = 'authority.record_note', comment = '');
- set add table (set id=1, origin=1, id=45, fully qualified name = 'authority.rec_descriptor', comment = '');
- set add table (set id=1, origin=1, id=46, fully qualified name = 'authority.full_rec', comment = '');
-
- set add table (set id=1, origin=1, id=47, fully qualified name = 'metabib.metarecord', comment = '');
- set add table (set id=1, origin=1, id=48, fully qualified name = 'metabib.title_field_entry', comment = '');
- set add table (set id=1, origin=1, id=49, fully qualified name = 'metabib.author_field_entry', comment = '');
- set add table (set id=1, origin=1, id=50, fully qualified name = 'metabib.subject_field_entry', comment = '');
- set add table (set id=1, origin=1, id=51, fully qualified name = 'metabib.keyword_field_entry', comment = '');
- set add table (set id=1, origin=1, id=52, fully qualified name = 'metabib.series_field_entry', comment = '');
- set add table (set id=1, origin=1, id=53, fully qualified name = 'metabib.rec_descriptor', comment = '');
- set add table (set id=1, origin=1, id=54, fully qualified name = 'metabib.full_rec', comment = '');
- set add table (set id=1, origin=1, id=55, fully qualified name = 'metabib.metarecord_source_map', comment = '');
-
- set add table (set id=1, origin=1, id=56, fully qualified name = 'asset.copy_location', comment = '');
- set add table (set id=1, origin=1, id=57, fully qualified name = 'asset.copy', comment = '');
- set add table (set id=1, origin=1, id=61, fully qualified name = 'asset.stat_cat', comment = '');
- set add table (set id=1, origin=1, id=62, fully qualified name = 'asset.stat_cat_entry', comment = '');
- set add table (set id=1, origin=1, id=63, fully qualified name = 'asset.stat_cat_entry_copy_map', comment = '');
- set add table (set id=1, origin=1, id=64, fully qualified name = 'asset.copy_note', comment = '');
- set add table (set id=1, origin=1, id=65, fully qualified name = 'asset.call_number', comment = '');
- set add table (set id=1, origin=1, id=66, fully qualified name = 'asset.call_number_note', comment = '');
-
- set add table (set id=1, origin=1, id=67, fully qualified name = 'container.copy_bucket', comment = '');
- set add table (set id=1, origin=1, id=68, fully qualified name = 'container.copy_bucket_item', comment = '');
- set add table (set id=1, origin=1, id=69, fully qualified name = 'container.call_number_bucket', comment = '');
- set add table (set id=1, origin=1, id=70, fully qualified name = 'container.call_number_bucket_item', comment = '');
- set add table (set id=1, origin=1, id=71, fully qualified name = 'container.biblio_record_entry_bucket', comment = '');
- set add table (set id=1, origin=1, id=72, fully qualified name = 'container.biblio_record_entry_bucket_item', comment = '');
- set add table (set id=1, origin=1, id=73, fully qualified name = 'container.user_bucket', comment = '');
- set add table (set id=1, origin=1, id=74, fully qualified name = 'container.user_bucket_item', comment = '');
-
- set add table (set id=1, origin=1, id=75, fully qualified name = 'money.collections_tracker', comment = '');
- set add table (set id=1, origin=1, id=76, fully qualified name = 'money.billable_xact', comment = '');
- set add table (set id=1, origin=1, id=77, fully qualified name = 'money.grocery', comment = '');
- set add table (set id=1, origin=1, id=78, fully qualified name = 'money.billing', comment = '');
- set add table (set id=1, origin=1, id=79, fully qualified name = 'money.payment', comment = '');
- set add table (set id=1, origin=1, id=80, fully qualified name = 'money.bnm_payment', comment = '');
- set add table (set id=1, origin=1, id=81, fully qualified name = 'money.forgive_payment', comment = '');
- set add table (set id=1, origin=1, id=82, fully qualified name = 'money.work_payment', comment = '');
- set add table (set id=1, origin=1, id=83, fully qualified name = 'money.credit_payment', comment = '');
- set add table (set id=1, origin=1, id=84, fully qualified name = 'money.bnm_desk_payment', comment = '');
- set add table (set id=1, origin=1, id=85, fully qualified name = 'money.cash_payment', comment = '');
- set add table (set id=1, origin=1, id=86, fully qualified name = 'money.check_payment', comment = '');
- set add table (set id=1, origin=1, id=87, fully qualified name = 'money.credit_card_payment', comment = '');
-
- set add table (set id=1, origin=1, id=88, fully qualified name = 'action.in_house_use', comment = '');
- set add table (set id=1, origin=1, id=89, fully qualified name = 'action.non_cataloged_circulation', comment = '');
- set add table (set id=1, origin=1, id=90, fully qualified name = 'action.survey', comment = '');
- set add table (set id=1, origin=1, id=91, fully qualified name = 'action.survey_question', comment = '');
- set add table (set id=1, origin=1, id=92, fully qualified name = 'action.survey_answer', comment = '');
- set add table (set id=1, origin=1, id=93, fully qualified name = 'action.survey_response', comment = '');
- set add table (set id=1, origin=1, id=94, fully qualified name = 'action.circulation', comment = '');
- set add table (set id=1, origin=1, id=95, fully qualified name = 'action.hold_request', comment = '');
- set add table (set id=1, origin=1, id=96, fully qualified name = 'action.hold_notification', comment = '');
- set add table (set id=1, origin=1, id=97, fully qualified name = 'action.hold_copy_map', comment = '');
- set add table (set id=1, origin=1, id=98, fully qualified name = 'action.transit_copy', comment = '');
- set add table (set id=1, origin=1, id=99, fully qualified name = 'action.hold_transit_copy', comment = '');
- set add table (set id=1, origin=1, id=100, fully qualified name = 'action.unfulfilled_hold_list', comment = '');
-
- #set add table (set id=1, origin=1, id=101, fully qualified name = 'auditor.actor_org_unit_history', comment = '', key = serial);
- #set add table (set id=1, origin=1, id=102, fully qualified name = 'auditor.actor_usr_address_history', comment = '', key = serial);
- #set add table (set id=1, origin=1, id=103, fully qualified name = 'auditor.actor_usr_history', comment = '', key = serial);
- #set add table (set id=1, origin=1, id=104, fully qualified name = 'auditor.asset_call_number_history', comment = '', key = serial);
- #set add table (set id=1, origin=1, id=105, fully qualified name = 'auditor.asset_copy_history', comment = '', key = serial);
- #set add table (set id=1, origin=1, id=106, fully qualified name = 'auditor.biblio_record_entry_history', comment = '', key = serial);
-
- set add sequence (set id=1, origin=1, id=1, fully qualified name = 'action.survey_response_group_id_seq', comment = '');
-
- # TSearch2 tables
- set add table (set id=1, origin=1, id=107, fully qualified name = 'public.pg_ts_cfg', comment = '');
- set add table (set id=1, origin=1, id=108, fully qualified name = 'public.pg_ts_cfgmap', comment = '');
- set add table (set id=1, origin=1, id=109, fully qualified name = 'public.pg_ts_dict', comment = '');
- set add table (set id=1, origin=1, id=110, fully qualified name = 'public.pg_ts_parser', comment = '');
-
-
- store node (id=2, comment = 'Active Slave node');
- #store node (id=3, comment = 'Statistical Reporting node');
-
- store path (server = 1, client = 2, conninfo='dbname=$DBNAME host=$MASTERHOST user=$PGUSER');
- #store path (server = 1, client = 3, conninfo='dbname=$DBNAME host=$MASTERHOST user=$PGUSER');
-
- store path (server = 2, client = 1, conninfo='dbname=$DBNAME host=$SLAVEHOST user=$PGUSER');
- #store path (server = 2, client = 3, conninfo='dbname=$DBNAME host=$SLAVEHOST user=$PGUSER');
-
- #store path (server = 3, client = 1, conninfo='dbname=$DBNAME host=$STATSHOST user=$PGUSER');
- #store path (server = 3, client = 2, conninfo='dbname=$DBNAME host=$STATSHOST user=$PGUSER');
-
- store listen (origin=1, provider = 1, receiver =2);
- store listen (origin=2, provider = 2, receiver =1);
-
- #store listen (origin=2, provider = 2, receiver =3);
- #store listen (origin=3, provider = 3, receiver =2);
-
- #store listen (origin=1, provider = 1, receiver =3);
- #store listen (origin=3, provider = 3, receiver =1);
-
-_EOF_
+++ /dev/null
-#!/bin/sh
-
-CLUSTER=prod_replica_set
-DBNAME=sparkle
-MASTERHOST=10.1.0.13
-SLAVEHOST=10.1.0.14
-STATSHOST=10.1.0.11
-PGUSER=postgres
-BINDIR=/opt/pg814/bin
-
-$BINDIR/slonik <<_EOF_
-
- #--
- # define the namespace the replication system uses in our example it is
- # slony_example
- #--
-
- cluster name = $CLUSTER;
-
- #--
- # admin conninfo's are used by slonik to connect to the nodes one for each
- # node on each side of the cluster, the syntax is that of PQconnectdb in
- # the C-API
- # --
-
- node 1 admin conninfo = 'dbname=$DBNAME host=$MASTERHOST user=$PGUSER';
- node 2 admin conninfo = 'dbname=$DBNAME host=$SLAVEHOST user=$PGUSER';
- node 3 admin conninfo = 'dbname=$DBNAME host=$STATSHOST user=$PGUSER';
-
- subscribe set ( id = 1, provider = 2, receiver = 3, forward = no);
-_EOF_
+++ /dev/null
-#!/bin/sh
-
-CLUSTER=prod_replica_set
-DBNAME=sparkle
-MASTERHOST=10.1.0.13
-SLAVEHOST=10.1.0.14
-STATSHOST=10.1.0.11
-PGUSER=postgres
-BINDIR=/opt/pg814/bin
-
-$BINDIR/slonik <<_EOF_
-
- #--
- # define the namespace the replication system uses in our example it is
- # slony_example
- #--
-
- cluster name = $CLUSTER;
-
- #--
- # admin conninfo's are used by slonik to connect to the nodes one for each
- # node on each side of the cluster, the syntax is that of PQconnectdb in
- # the C-API
- # --
-
- node 1 admin conninfo = 'dbname=$DBNAME host=$MASTERHOST user=$PGUSER';
- node 2 admin conninfo = 'dbname=$DBNAME host=$SLAVEHOST user=$PGUSER';
-
- subscribe set ( id = 1, provider = 1, receiver = 2, forward = yes);
-_EOF_
+++ /dev/null
-#!/bin/sh
-/opt/pg814/bin/pgpool -f /opt/pg814/etc/pgpool.conf -n 2>&1 | logger -t pgpool -p local0.info &
+++ /dev/null
-#!/bin/sh
-/opt/pg814/bin/slon prod_replica_set dbname=sparkle host=10.1.0.13 user=postgres 2>&1 | logger -t slon -p local3.info &