[open-ils-commits] r586 - in conifer/trunk/tools: . config daily-scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 17 16:02:11 EDT 2009
Author: dbs
Date: 2009-07-17 16:02:07 -0400 (Fri, 17 Jul 2009)
New Revision: 586
Added:
conifer/trunk/tools/config/
conifer/trunk/tools/config/z3950.xml
conifer/trunk/tools/daily-scripts/
conifer/trunk/tools/daily-scripts/circ_date_to_expire_date.pl
conifer/trunk/tools/daily-scripts/end_of_the_day.pl
conifer/trunk/tools/daily-scripts/reingest_uningested.pl
Removed:
conifer/trunk/tools/circ_date_to_expire_date.pl
conifer/trunk/tools/delete_ill_books.pl
conifer/trunk/tools/end_of_the_day.pl
conifer/trunk/tools/reingest_uningested.pl
Log:
Move daily scripts around, create a config directory for some good stuff like Z39.50 servers
Deleted: conifer/trunk/tools/circ_date_to_expire_date.pl
===================================================================
--- conifer/trunk/tools/circ_date_to_expire_date.pl 2009-07-16 20:37:10 UTC (rev 585)
+++ conifer/trunk/tools/circ_date_to_expire_date.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -1,76 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use warnings;
-
-# Evergreen sets due dates that are past the user's expiry date
-
-# Let's fix that after the fact, for now, by setting the due dates to the user's expiry date
-
-use DBI;
-use Getopt::Long;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::Utils qw/:daemon/;
-use OpenSRF::System;
-use OpenSRF::AppSession;
-use OpenSRF::Utils::SettingsClient;
-
-my ($config, $set_due_time) = ('/openils/conf/opensrf_core.xml', 0);
-
-GetOptions(
- "bootstrap=s" => \$config,
- "set_due_time" => \$set_due_time,
-);
-
-OpenSRF::System->bootstrap_client( config_file => $config );
-
-my $sc = OpenSRF::Utils::SettingsClient->new;
-my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
-my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
-my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
-my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
-my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
-my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
-
-my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
-
-my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
-
-end_of_day($set_due_time);
-
-$dbh->disconnect;
-
-sub end_of_day {
- my $set_due_time = shift;
-
- my $select_stmt = <<STMT;
- SELECT aoc.due_date, au.expire_date
- FROM action.open_circulation aoc
- INNER JOIN actor.usr au ON au.id = aoc.usr
- WHERE aoc.due_date > au.expire_date
- AND au.expire_date > NOW()
- AND au.expire_date < NOW() + '2 years'::interval
- AND au.home_ou IN (103, 110, 126)
- ORDER BY au.expire_date
-STMT
-
- my $update_stmt = <<UPDATE;
- UPDATE action.circulation ac SET due_date = au.expire_date
- FROM actor.usr au
- WHERE au.id = ac.usr
- AND ac.due_date > au.expire_date
- AND au.expire_date > NOW()
- AND au.expire_date < NOW() + '2 years'::interval
- AND au.home_ou IN (103, 110, 126)
- AND ac.checkin_time IS NULL
-UPDATE
-
-
- my $results = $dbh->selectall_arrayref($select_stmt);
- print localtime() . " - found " . scalar(@$results) . " circulation transactions to update where due_date > expire_date\n";
- if ($set_due_time) {
- my $stmt = $dbh->prepare($update_stmt);
- my $updates = $stmt->execute();
- print "Updated $updates circulation transactions.\n";
- }
-}
-
Added: conifer/trunk/tools/config/z3950.xml
===================================================================
--- conifer/trunk/tools/config/z3950.xml (rev 0)
+++ conifer/trunk/tools/config/z3950.xml 2009-07-17 20:02:07 UTC (rev 586)
@@ -0,0 +1,315 @@
+ <z3950>
+ <default>biblios</default>
+ <services>
+ <AMICUS>
+ <!-- AMICUS does not require username/password -->
+ <name>AMICUS</name>
+ <host>amicus.nlc-bnc.ca</host>
+ <port>210</port>
+ <db>NL</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </AMICUS>
+
+ <McGill>
+ <!-- No username/password required -->
+ <name>McGill</name>
+ <host>aleph.mcgill.ca</host>
+ <port>210</port>
+ <db>MUSE</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </McGill>
+
+ <UChicago>
+ <!-- No username/password required -->
+ <name>UChicago</name>
+ <host>ipac.lib.uchicago.edu</host>
+ <port>210</port>
+ <db>uofc</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UChicago>
+
+ <ULaval>
+ <!-- UofT does not require username/password -->
+ <name>ULaval</name>
+ <host>ariane2.ulaval.ca</host>
+ <port>2200</port>
+ <db>unicorn</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </ULaval>
+
+ <UManitoba>
+ <!-- No username/password required -->
+ <name>UManitoba</name>
+ <host>lrpapp.cc.umanitoba.ca</host>
+ <port>2200</port>
+ <db>unicorn</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>FI</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UManitoba>
+
+ <UMichigan>
+ <!-- No username/password required -->
+ <name>UMichigan</name>
+ <host>z3950.lib.umich.edu</host>
+ <port>210</port>
+ <db>miu101_pub</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>FI</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UMichigan>
+
+ <UMontréal>
+ <!-- No username/password required -->
+ <name>UMontréal</name>
+ <host>atrium.bib.umontreal.ca</host>
+ <port>210</port>
+ <db>ADVANCE</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UMontréal>
+
+ <UofT>
+ <!-- No username/password required -->
+ <name>UofT</name>
+ <host>sirsi.library.utoronto.ca</host>
+ <port>2200</port>
+ <db>UNICORN</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UofT>
+
+ <UWO>
+ <!-- No username/password required -->
+ <name>UWO</name>
+ <host>alpha.lib.uwo.ca</host>
+ <port>210</port>
+ <db>INNOPAC</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>F</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </UWO>
+
+ <biblios>
+ <!-- biblios does not require username/password -->
+ <name>‡biblios.net</name>
+ <host>z3950.biblios.net</host>
+ <port>210</port>
+ <db>bibliographic</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>FI</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </biblios>
+
+ <loc>
+ <!-- LoC does not require username/password -->
+ <name>loc</name>
+ <host>z3950.loc.gov</host>
+ <port>7090</port>
+ <db>Voyager</db>
+ <!-- fetch the full record with no holdings. FI is the most common choice -->
+ <record_format>FI</record_format>
+
+ <!-- Record transmission format from the server. Supported -->
+ <!-- formats include usmarc and xml (for marcxml). -->
+ <transmission_format>usmarc</transmission_format>
+
+ <attrs>
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </loc>
+
+ <oclc>
+ <!-- Z3950 settings for OCLC. Note that OCLC requires username/password -->
+ <host>zcat.oclc.org</host>
+ <port>210</port>
+ <db>OLUCWorldCat</db>
+ <attrs>
+ <!--
+ These are directly from the Bib-1 Attribute Set
+ http://www.loc.gov/z3950/agency/defns/bib1.html
+ <code> is the "use attribute", <format> is the "structure attribute"
+ This just puts some friendly names on the data.
+ -->
+ <tcn><code>12</code><format>1</format></tcn>
+ <isbn><code>7</code><format>6</format></isbn>
+ <lccn><code>9</code><format>1</format></lccn>
+ <author><code>1003</code><format>6</format></author>
+ <title><code>4</code><format>6</format></title>
+ <issn><code>8</code><format>1</format></issn>
+ <publisher><code>1018</code><format>6</format></publisher>
+ <pubdate><code>31</code><format>1</format></pubdate>
+ <item_type><code>1001</code><format>1</format></item_type>
+ </attrs>
+ </oclc>
+
+ </services>
+ </z3950>
Copied: conifer/trunk/tools/daily-scripts/circ_date_to_expire_date.pl (from rev 581, conifer/trunk/tools/circ_date_to_expire_date.pl)
===================================================================
--- conifer/trunk/tools/daily-scripts/circ_date_to_expire_date.pl (rev 0)
+++ conifer/trunk/tools/daily-scripts/circ_date_to_expire_date.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# Evergreen sets due dates that are past the user's expiry date
+
+# Let's fix that after the fact, for now, by setting the due dates to the user's expiry date
+
+use DBI;
+use Getopt::Long;
+use OpenSRF::EX qw/:try/;
+use OpenSRF::Utils qw/:daemon/;
+use OpenSRF::System;
+use OpenSRF::AppSession;
+use OpenSRF::Utils::SettingsClient;
+
+my ($config, $set_due_time) = ('/openils/conf/opensrf_core.xml', 0);
+
+GetOptions(
+ "bootstrap=s" => \$config,
+ "set_due_time" => \$set_due_time,
+);
+
+OpenSRF::System->bootstrap_client( config_file => $config );
+
+my $sc = OpenSRF::Utils::SettingsClient->new;
+my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
+my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
+my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
+my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
+my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
+my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
+
+my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
+
+my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
+
+end_of_day($set_due_time);
+
+$dbh->disconnect;
+
+sub end_of_day {
+ my $set_due_time = shift;
+
+ my $select_stmt = <<STMT;
+ SELECT aoc.due_date, au.expire_date
+ FROM action.open_circulation aoc
+ INNER JOIN actor.usr au ON au.id = aoc.usr
+ WHERE aoc.due_date > au.expire_date
+ AND au.expire_date > NOW()
+ AND au.expire_date < NOW() + '2 years'::interval
+ AND au.home_ou IN (103, 110, 126)
+ ORDER BY au.expire_date
+STMT
+
+ my $update_stmt = <<UPDATE;
+ UPDATE action.circulation ac SET due_date = au.expire_date
+ FROM actor.usr au
+ WHERE au.id = ac.usr
+ AND ac.due_date > au.expire_date
+ AND au.expire_date > NOW()
+ AND au.expire_date < NOW() + '2 years'::interval
+ AND au.home_ou IN (103, 110, 126)
+ AND ac.checkin_time IS NULL
+UPDATE
+
+
+ my $results = $dbh->selectall_arrayref($select_stmt);
+ print localtime() . " - found " . scalar(@$results) . " circulation transactions to update where due_date > expire_date\n";
+ if ($set_due_time) {
+ my $stmt = $dbh->prepare($update_stmt);
+ my $updates = $stmt->execute();
+ print "Updated $updates circulation transactions.\n";
+ }
+}
+
Property changes on: conifer/trunk/tools/daily-scripts/circ_date_to_expire_date.pl
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: conifer/trunk/tools/daily-scripts/end_of_the_day.pl (from rev 575, conifer/trunk/tools/end_of_the_day.pl)
===================================================================
--- conifer/trunk/tools/daily-scripts/end_of_the_day.pl (rev 0)
+++ conifer/trunk/tools/daily-scripts/end_of_the_day.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -0,0 +1,104 @@
+#!/usr/bin/perl -w
+
+# Sets the due time of items with a given loan period for a given library to 23:59:59
+
+# This is a temporary workaround for Evergreen's assumption that the
+# fine generating script will only run once a day, to avoid dinging a patron
+# with an overdue charge at 48 hours + 5 minutes rather than at the end of the
+# day that 48 hours falls on.
+
+# We also found that editing the due date for a given item sets the corresponding
+# due time to 00:00 - which isn't great, as that means that it is due the minute
+# the day starts. So, for now, we'll set all daily / weekly loans or those loans
+# that are due exactly at midnight to being due at 23:59:59 - the very last second
+# of the day on which it is due. This probably meets our patrons' expectations a bit
+# better.
+
+use DBI;
+use Getopt::Long;
+use OpenSRF::EX qw/:try/;
+use OpenSRF::Utils qw/:daemon/;
+use OpenSRF::System;
+use OpenSRF::AppSession;
+use OpenSRF::Utils::SettingsClient;
+
+my ($config, $set_due_time) = ('/openils/conf/opensrf_core.xml', 0);
+
+GetOptions(
+ "bootstrap=s" => \$config,
+ "set_due_time" => \$set_due_time,
+);
+
+OpenSRF::System->bootstrap_client( config_file => $config );
+
+my $sc = OpenSRF::Utils::SettingsClient->new;
+my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
+my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
+my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
+my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
+my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
+my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
+
+my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
+
+my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
+
+end_of_day($set_due_time);
+
+$dbh->disconnect;
+
+sub end_of_day {
+ my $set_due_time = shift;
+
+ my $select_stmt = <<STMT;
+ SELECT id
+ FROM action.circulation
+ WHERE checkin_time IS NULL
+ AND (
+ (
+ due_date::TIME != '23:59:59'
+ AND duration_rule LIKE ('%days%')
+ OR duration_rule LIKE ('%weeks%')
+ OR duration_rule = '48_hours_2_renew'
+ ) OR (
+ due_date::TIME = '00:00:00'
+ )
+ ) AND circ_lib IN (
+ SELECT id
+ FROM actor.org_unit
+ WHERE parent_ou = 105
+ )
+STMT
+
+ my $update_stmt = <<UPDATE;
+ UPDATE action.circulation
+ SET due_date = CAST(due_date::DATE || ' ' || '23:59:59-04' AS TIMESTAMP WITH TIME ZONE)
+ WHERE checkin_time IS NULL
+ AND (
+ (
+ due_date::TIME != '23:59:59'
+ AND duration_rule LIKE ('%days%')
+ OR duration_rule LIKE ('%weeks%')
+ OR duration_rule = '48_hours_2_renew'
+ ) OR (
+ due_date::TIME = '00:00:00'
+ )
+ ) AND circ_lib IN (
+ SELECT id
+ FROM actor.org_unit
+ WHERE parent_ou = 105
+ )
+UPDATE
+
+
+ my $results = $dbh->selectcol_arrayref($select_stmt);
+ print localtime() . " - found " . scalar(@$results) . " circulation transactions to update:\n";
+ foreach (@$results) {
+ print "\t$_\n";
+ }
+ if ($set_due_time) {
+ my $stmt = $dbh->prepare($update_stmt);
+ my $updates = $stmt->execute();
+ print "Updated $updates circulation transactions.\n";
+ }
+}
Property changes on: conifer/trunk/tools/daily-scripts/end_of_the_day.pl
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: conifer/trunk/tools/daily-scripts/reingest_uningested.pl (from rev 570, conifer/trunk/tools/reingest_uningested.pl)
===================================================================
--- conifer/trunk/tools/daily-scripts/reingest_uningested.pl (rev 0)
+++ conifer/trunk/tools/daily-scripts/reingest_uningested.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -0,0 +1,72 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# Reingest biblio.record_entry records that didn't get ingested due to the simple_rec_sync bug
+# Ingested records are expected to have an entry in the keyword index
+# Might want to build a variation on this that reingests edited records on a nightly basis
+
+use DBI;
+use Getopt::Long;
+use OpenSRF::EX qw/:try/;
+use OpenSRF::Utils qw/:daemon/;
+use OpenSRF::System;
+use OpenSRF::AppSession;
+use OpenSRF::Utils::SettingsClient;
+
+my ($config, $reingest) = ('/openils/conf/opensrf_core.xml', 0);
+
+GetOptions(
+ "bootstrap=s" => \$config,
+ "reingest" => \$reingest,
+);
+
+OpenSRF::System->bootstrap_client( config_file => $config );
+
+my $sc = OpenSRF::Utils::SettingsClient->new;
+my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
+my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
+my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
+my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
+my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
+my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
+
+my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
+
+my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
+
+reingest_empty_records($reingest);
+
+$dbh->disconnect;
+
+sub reingest_empty_records {
+ my $select_stmt = <<STMT;
+ SELECT bre.id
+ FROM biblio.record_entry bre
+ WHERE deleted IS FALSE
+ AND bre.id > 0
+ EXCEPT
+ SELECT mrd.source
+ FROM metabib.keyword_field_entry mrd
+STMT
+
+ my $results = $dbh->selectcol_arrayref($select_stmt);
+ print localtime() . " - found " . scalar(@$results) . " records to reingest\n";
+ foreach (@$results) {
+ print "\t$_\n";
+ }
+ if ($reingest) {
+
+ foreach (@$results) {
+ my $r = OpenSRF::AppSession
+ ->create( 'open-ils.ingest' )
+ ->request( 'open-ils.ingest.full.biblio.record' => $_ );
+
+ while (!$r->complete) { $r->recv };
+
+ # Sleep for 10 seconds between each request to prevent blocking
+ sleep(10);
+ }
+ }
+}
+
Property changes on: conifer/trunk/tools/daily-scripts/reingest_uningested.pl
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: conifer/trunk/tools/delete_ill_books.pl
===================================================================
--- conifer/trunk/tools/delete_ill_books.pl 2009-07-16 20:37:10 UTC (rev 585)
+++ conifer/trunk/tools/delete_ill_books.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -1,97 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use DBI;
-use Getopt::Long;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::Utils qw/:daemon/;
-use OpenSRF::System;
-use OpenSRF::AppSession;
-use OpenSRF::Utils::SettingsClient;
-use File::Find;
-
-my ($config) = ('/openils/conf/opensrf_core.xml');
-
-GetOptions(
- "bootstrap=s" => \$config,
-);
-
-OpenSRF::System->bootstrap_client( config_file => $config );
-
-my $sc = OpenSRF::Utils::SettingsClient->new;
-my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
-my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
-my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
-my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
-my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
-my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
-
-my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
-
-my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
-
-delete_racer_callnumbers();
-
-$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'
- )
- 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
-
-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'
- )
- 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
-DELETE
-
- 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();
- }
-}
-
Deleted: conifer/trunk/tools/end_of_the_day.pl
===================================================================
--- conifer/trunk/tools/end_of_the_day.pl 2009-07-16 20:37:10 UTC (rev 585)
+++ conifer/trunk/tools/end_of_the_day.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -1,104 +0,0 @@
-#!/usr/bin/perl -w
-
-# Sets the due time of items with a given loan period for a given library to 23:59:59
-
-# This is a temporary workaround for Evergreen's assumption that the
-# fine generating script will only run once a day, to avoid dinging a patron
-# with an overdue charge at 48 hours + 5 minutes rather than at the end of the
-# day that 48 hours falls on.
-
-# We also found that editing the due date for a given item sets the corresponding
-# due time to 00:00 - which isn't great, as that means that it is due the minute
-# the day starts. So, for now, we'll set all daily / weekly loans or those loans
-# that are due exactly at midnight to being due at 23:59:59 - the very last second
-# of the day on which it is due. This probably meets our patrons' expectations a bit
-# better.
-
-use DBI;
-use Getopt::Long;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::Utils qw/:daemon/;
-use OpenSRF::System;
-use OpenSRF::AppSession;
-use OpenSRF::Utils::SettingsClient;
-
-my ($config, $set_due_time) = ('/openils/conf/opensrf_core.xml', 0);
-
-GetOptions(
- "bootstrap=s" => \$config,
- "set_due_time" => \$set_due_time,
-);
-
-OpenSRF::System->bootstrap_client( config_file => $config );
-
-my $sc = OpenSRF::Utils::SettingsClient->new;
-my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
-my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
-my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
-my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
-my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
-my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
-
-my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
-
-my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
-
-end_of_day($set_due_time);
-
-$dbh->disconnect;
-
-sub end_of_day {
- my $set_due_time = shift;
-
- my $select_stmt = <<STMT;
- SELECT id
- FROM action.circulation
- WHERE checkin_time IS NULL
- AND (
- (
- due_date::TIME != '23:59:59'
- AND duration_rule LIKE ('%days%')
- OR duration_rule LIKE ('%weeks%')
- OR duration_rule = '48_hours_2_renew'
- ) OR (
- due_date::TIME = '00:00:00'
- )
- ) AND circ_lib IN (
- SELECT id
- FROM actor.org_unit
- WHERE parent_ou = 105
- )
-STMT
-
- my $update_stmt = <<UPDATE;
- UPDATE action.circulation
- SET due_date = CAST(due_date::DATE || ' ' || '23:59:59-04' AS TIMESTAMP WITH TIME ZONE)
- WHERE checkin_time IS NULL
- AND (
- (
- due_date::TIME != '23:59:59'
- AND duration_rule LIKE ('%days%')
- OR duration_rule LIKE ('%weeks%')
- OR duration_rule = '48_hours_2_renew'
- ) OR (
- due_date::TIME = '00:00:00'
- )
- ) AND circ_lib IN (
- SELECT id
- FROM actor.org_unit
- WHERE parent_ou = 105
- )
-UPDATE
-
-
- my $results = $dbh->selectcol_arrayref($select_stmt);
- print localtime() . " - found " . scalar(@$results) . " circulation transactions to update:\n";
- foreach (@$results) {
- print "\t$_\n";
- }
- if ($set_due_time) {
- my $stmt = $dbh->prepare($update_stmt);
- my $updates = $stmt->execute();
- print "Updated $updates circulation transactions.\n";
- }
-}
Deleted: conifer/trunk/tools/reingest_uningested.pl
===================================================================
--- conifer/trunk/tools/reingest_uningested.pl 2009-07-16 20:37:10 UTC (rev 585)
+++ conifer/trunk/tools/reingest_uningested.pl 2009-07-17 20:02:07 UTC (rev 586)
@@ -1,72 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use warnings;
-
-# Reingest biblio.record_entry records that didn't get ingested due to the simple_rec_sync bug
-# Ingested records are expected to have an entry in the keyword index
-# Might want to build a variation on this that reingests edited records on a nightly basis
-
-use DBI;
-use Getopt::Long;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::Utils qw/:daemon/;
-use OpenSRF::System;
-use OpenSRF::AppSession;
-use OpenSRF::Utils::SettingsClient;
-
-my ($config, $reingest) = ('/openils/conf/opensrf_core.xml', 0);
-
-GetOptions(
- "bootstrap=s" => \$config,
- "reingest" => \$reingest,
-);
-
-OpenSRF::System->bootstrap_client( config_file => $config );
-
-my $sc = OpenSRF::Utils::SettingsClient->new;
-my $db_driver = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver' );
-my $db_host = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'host' );
-my $db_port = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'port' );
-my $db_name = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'db' );
-my $db_user = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'user' );
-my $db_pw = $sc->config_value( apps => 'open-ils.storage' => app_settings => databases => database => 'pw' );
-
-my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
-
-my $dbh = DBI->connect($dsn,$db_user,$db_pw, {pg_enable_utf8 => 1, RaiseError => 1});
-
-reingest_empty_records($reingest);
-
-$dbh->disconnect;
-
-sub reingest_empty_records {
- my $select_stmt = <<STMT;
- SELECT bre.id
- FROM biblio.record_entry bre
- WHERE deleted IS FALSE
- AND bre.id > 0
- EXCEPT
- SELECT mrd.source
- FROM metabib.keyword_field_entry mrd
-STMT
-
- my $results = $dbh->selectcol_arrayref($select_stmt);
- print localtime() . " - found " . scalar(@$results) . " records to reingest\n";
- foreach (@$results) {
- print "\t$_\n";
- }
- if ($reingest) {
-
- foreach (@$results) {
- my $r = OpenSRF::AppSession
- ->create( 'open-ils.ingest' )
- ->request( 'open-ils.ingest.full.biblio.record' => $_ );
-
- while (!$r->complete) { $r->recv };
-
- # Sleep for 10 seconds between each request to prevent blocking
- sleep(10);
- }
- }
-}
-
More information about the open-ils-commits
mailing list