my ($config) = ('/openils/conf/opensrf_core.xml');
GetOptions(
- "bootstrap=s" => \$config,
+ "bootstrap=s" => \$config,
);
OpenSRF::System->bootstrap_client( config_file => $config );
$dbh->disconnect;
sub delete_racer_callnumbers {
- my $select_stmt = <<SELECT;
- SELECT acn.id
- FROM asset.call_number acn
- INNER JOIN asset.copy ac ON ac.call_number = acn.id
- INNER JOIN action.circulation acirc ON ac.id = acirc.target_copy
- AND acn.record IN (
- SELECT bre.id
- FROM biblio.record_entry bre
- WHERE bre.id IN (
- 2237519,
- 2239801,
- 2239798,
- 2239797,
- 2239799,
- 2239800,
- 2247576
+ my $select_stmt = <<SELECT;
+ SELECT acn.id
+ FROM asset.call_number acn
+ INNER JOIN asset.copy ac ON ac.call_number = acn.id
+ INNER JOIN action.circulation acirc ON ac.id = acirc.target_copy
+ AND acn.record IN (
+ SELECT bre.id
+ FROM biblio.record_entry bre
+ WHERE bre.id IN (
+ 2237519,
+ 2239801,
+ 2239798,
+ 2239797,
+ 2239799,
+ 2239800,
+ 2247576,
+ 2900325
)
- AND bre.deleted IS FALSE
- ) AND acirc.checkin_time IS NOT NULL
- AND acirc.id NOT IN (
- SELECT id
- FROM money.open_billable_xact_summary
- ) AND acn.deleted IS FALSE
- AND ac.status NOT IN (1, 7);
+ AND bre.deleted IS FALSE
+ ) AND acirc.checkin_time IS NOT NULL
+ AND acirc.id NOT IN (
+ SELECT id
+ FROM money.open_billable_xact_summary
+ ) AND acn.deleted IS FALSE
+ AND ac.status NOT IN (1, 7)
SELECT
- my $delete_stmt = <<DELETE;
- DELETE FROM asset.call_number acn
- USING asset.copy ac
- INNER JOIN action.circulation acirc ON ac.id = acirc.target_copy
- WHERE acn.id = ac.call_number
- AND acn.record IN (
- SELECT bre.id
- FROM biblio.record_entry bre
- WHERE bre.id IN (
- 2237519,
- 2239801,
- 2239798,
- 2239797,
- 2239799,
- 2239800,
- 2247576
+ my $delete_stmt = <<DELETE;
+ DELETE FROM asset.call_number acn
+ USING asset.copy ac
+ INNER JOIN action.circulation acirc ON ac.id = acirc.target_copy
+ WHERE acn.id = ac.call_number
+ AND acn.record IN (
+ SELECT bre.id
+ FROM biblio.record_entry bre
+ WHERE bre.id IN (
+ 2237519,
+ 2239801,
+ 2239798,
+ 2239797,
+ 2239799,
+ 2239800,
+ 2247576,
+ 2900325
)
- AND bre.deleted IS FALSE
- ) AND acirc.checkin_time IS NOT NULL
- AND acirc.id NOT IN (
- SELECT id
- FROM money.open_billable_xact_summary
- ) AND acn.deleted IS FALSE
- AND ac.status NOT IN (1, 7);
+ AND bre.deleted IS FALSE
+ ) AND acirc.checkin_time IS NOT NULL
+ AND acirc.id NOT IN (
+ SELECT id
+ FROM money.open_billable_xact_summary
+ ) AND acn.deleted IS FALSE
+ AND ac.status NOT IN (1, 7)
DELETE
my $delete_copies_stmt = <<DELETECOPIES;
UPDATE asset.copy
SET deleted = TRUE FROM asset.call_number acn
WHERE asset.copy.call_number = acn.id
- AND acn.record IN (2237519,2239801,2239798,2239797,2239799,2239800,2247576)
+ AND acn.record IN (2237519,2239801,2239798,2239797,2239799,2239800,2247576,2900325)
AND acn.deleted IS TRUE
AND asset.copy.deleted IS FALSE
AND asset.copy.circ_lib = 103
AND asset.copy.status NOT IN (1, 7);
DELETECOPIES
- my $results = $dbh->selectcol_arrayref($select_stmt);
- print localtime() . " - found " . scalar(@$results) . " RACER book call numbers to delete:\n";
- if (scalar(@$results)) {
- foreach (@$results) {
- print "\t$_\n";
- }
- my $stmt = $dbh->prepare($delete_stmt);
- my $updates = $stmt->execute();
- $stmt = $dbh->prepare($delete_copies_stmt);
- $updates = $stmt->execute();
- }
+ my $results = $dbh->selectcol_arrayref($select_stmt);
+ print localtime() . " - found " . scalar(@$results) . " RACER book call numbers to delete:\n";
+ if (scalar(@$results)) {
+ foreach (@$results) {
+ print "\t$_\n";
+ }
+ my $stmt = $dbh->prepare($delete_stmt);
+ my $updates = $stmt->execute();
+ $stmt = $dbh->prepare($delete_copies_stmt);
+ $updates = $stmt->execute();
+ }
}