From 52dd3d56790a14915b51abfeb6b89047d42d2041 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 6 Dec 2007 01:30:59 +0000 Subject: [PATCH] having the Makefile install the orphaned report detector git-svn-id: svn://svn.open-ils.org/ILS/trunk@8158 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/Makefile | 1 + Open-ILS/src/sql/Pg/020.schema.functions.sql | 77 -------------------- Open-ILS/src/sql/Pg/090.schema.action.sql | 39 +++++----- 3 files changed, 21 insertions(+), 96 deletions(-) diff --git a/Open-ILS/src/Makefile b/Open-ILS/src/Makefile index e3cedd643b..e47405cca6 100644 --- a/Open-ILS/src/Makefile +++ b/Open-ILS/src/Makefile @@ -144,6 +144,7 @@ reporter-install: @echo $@ @echo "Installing Reporter email templates to $(REPORTERDIR) and example configs to $(ETCDIR)" cp reporter/clark-kent.pl $(BINDIR) + cp reporter/find_orphaned_reports.pl $(BINDIR) cp reporter/report-fail $(DATADIR) cp reporter/report-success $(DATADIR) mkdir -p $(REPORTERDIR) diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql index c2a85bd4f5..b9ffb1690f 100644 --- a/Open-ILS/src/sql/Pg/020.schema.functions.sql +++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql @@ -1,80 +1,3 @@ -CREATE OR REPLACE FUNCTION public.non_filing_normalize ( TEXT, "char" ) RETURNS TEXT AS $$ - SELECT SUBSTRING( - REGEXP_REPLACE( - REGEXP_REPLACE( - $1, - E'\W*$', - '' - ), - ' ', - ' ' - ), - CASE - WHEN $2::INT NOT BETWEEN 48 AND 57 THEN 1 - ELSE $2::TEXT::INT + 1 - END - ); -$$ LANGUAGE SQL STRICT IMMUTABLE; - -CREATE OR REPLACE FUNCTION public.naco_normalize( TEXT, TEXT ) RETURNS TEXT AS $func$ - my $txt = lc(shift); - my $sf = shift; - - $txt =~ s/\pM+//go; # Remove diacritics - - $txt =~ s/\xE6/AE/go; # Convert ae digraph - $txt =~ s/\x{153}/OE/go;# Convert oe digraph - $txt =~ s/\xFE/TH/go; # Convert Icelandic thorn - - $txt =~ tr/\x{2070}\x{2071}\x{2072}\x{2073}\x{2074}\x{2075}\x{2076}\x{2077}\x{2078}\x{2079}\x{207A}\x{207B}/0123456789+-/;# Convert superscript numbers - $txt =~ tr/\x{2080}\x{2081}\x{2082}\x{2083}\x{2084}\x{2085}\x{2086}\x{2087}\x{2088}\x{2089}\x{208A}\x{208B}/0123456889+-/;# Convert subscript numbers - - $txt =~ tr/\x{0251}\x{03B1}\x{03B2}\x{0262}\x{03B3}/AABGG/; # Convert Latin and Greek - $txt =~ tr/\x{2113}\xF0\!\"\(\)\-\{\}\<\>\;\:\.\?\xA1\xBF\/\\\@\*\%\=\xB1\+\xAE\xA9\x{2117}\$\xA3\x{FFE1}\xB0\^\_\~\`/LD /; # Convert Misc - $txt =~ tr/\'\[\]\|//d; # Remove Misc - - if ($sf =~ /^a/o) { - my $commapos = index($txt,','); - if ($commapos > -1) { - if ($commapos != length($txt) - 1) { - my @list = split /,/, $txt; - my $first = shift @list; - $txt = $first . ',' . join(' ', @list); - } else { - $txt =~ s/,/ /go; - } - } - } else { - $txt =~ s/,/ /go; - } - - $txt =~ s/\s+/ /go; # Compress multiple spaces - $txt =~ s/^\s+//o; # Remove leading space - $txt =~ s/\s+$//o; # Remove trailing space - - return $txt; -$func$ LANGUAGE 'plperlu' STRICT IMMUTABLE; - -CREATE OR REPLACE FUNCTION public.naco_normalize( TEXT ) RETURNS TEXT AS $func$ - SELECT public.naco_normalize($1,''); -$func$ LANGUAGE 'sql' STRICT IMMUTABLE; - -CREATE OR REPLACE FUNCTION public.call_number_dewey( TEXT ) RETURNS TEXT AS $$ - my $txt = shift; - $txt =~ s/^\s+//o; - $txt =~ s/[\[\]\{\}\(\)`'"#<>\*\?\-\+\$\\]+//o; - $txt =~ s/\s+$//o; - if (/(\d{3}(?:\.\d+)?)/o) { - return $1; - } else { - return (split /\s+/, $txt)[0]; - } -$$ LANGUAGE 'plperl' STRICT IMMUTABLE; - -CREATE OR REPLACE FUNCTION public.call_number_dewey( TEXT, INT ) RETURNS TEXT AS $$ - SELECT SUBSTRING(call_number_dewey($1) FROM 1 FOR $2); -$$ LANGUAGE SQL STRICT IMMUTABLE; - CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement ) RETURNS anyelement AS $$ SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END; $$ LANGUAGE SQL STABLE; diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 0e06d3b43a..6ba3a5fb1f 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -80,26 +80,27 @@ CREATE TRIGGER action_survey_response_answer_date_fixup_tgr CREATE TABLE action.circulation ( - target_copy BIGINT NOT NULL, -- asset.copy.id - circ_lib INT NOT NULL, -- actor.org_unit.id - circ_staff INT NOT NULL, -- actor.usr.id - checkin_staff INT, -- actor.usr.id - checkin_lib INT, -- actor.org_unit.id - renewal_remaining INT NOT NULL, -- derived from "circ duration" rule + create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), + target_copy BIGINT NOT NULL, -- asset.copy.id + circ_lib INT NOT NULL, -- actor.org_unit.id + circ_staff INT NOT NULL, -- actor.usr.id + checkin_staff INT, -- actor.usr.id + checkin_lib INT, -- actor.org_unit.id + renewal_remaining INT NOT NULL, -- derived from "circ duration" rule due_date TIMESTAMP WITH TIME ZONE, - stop_fines_time TIMESTAMP WITH TIME ZONE, - checkin_time TIMESTAMP WITH TIME ZONE, - duration INTERVAL, -- derived from "circ duration" rule - fine_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule - recuring_fine NUMERIC(6,2), -- derived from "circ fine" rule - max_fine NUMERIC(6,2), -- derived from "max fine" rule - phone_renewal BOOL NOT NULL DEFAULT FALSE, - desk_renewal BOOL NOT NULL DEFAULT FALSE, - opac_renewal BOOL NOT NULL DEFAULT FALSE, - duration_rule TEXT NOT NULL, -- name of "circ duration" rule - recuring_fine_rule TEXT NOT NULL, -- name of "circ fine" rule - max_fine_rule TEXT NOT NULL, -- name of "max fine" rule - stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES','RENEW','LONGOVERDUE')) + stop_fines_time TIMESTAMP WITH TIME ZONE, + checkin_time TIMESTAMP WITH TIME ZONE, + duration INTERVAL, -- derived from "circ duration" rule + fine_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule + recuring_fine NUMERIC(6,2), -- derived from "circ fine" rule + max_fine NUMERIC(6,2), -- derived from "max fine" rule + phone_renewal BOOL NOT NULL DEFAULT FALSE, + desk_renewal BOOL NOT NULL DEFAULT FALSE, + opac_renewal BOOL NOT NULL DEFAULT FALSE, + duration_rule TEXT NOT NULL, -- name of "circ duration" rule + recuring_fine_rule TEXT NOT NULL, -- name of "circ fine" rule + max_fine_rule TEXT NOT NULL, -- name of "max fine" rule + stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES','RENEW','LONGOVERDUE')) ) INHERITS (money.billable_xact); ALTER TABLE action.circulation ADD PRIMARY KEY (id); CREATE INDEX circ_open_xacts_idx ON action.circulation (usr) WHERE xact_finish IS NULL; -- 2.43.2