From 332588e3a08e3c845de0b128ecf678e53f023675 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 5 Jul 2005 21:14:44 +0000 Subject: [PATCH] added "due_date" git-svn-id: svn://svn.open-ils.org/ILS/trunk@1051 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Storage/CDBI.pm | 5 ++-- .../OpenILS/Application/Storage/CDBI/action.pm | 2 +- Open-ILS/src/sql/Postgres/090.schema.action.sql | 34 ++++++++++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm index 07fbe7140c..a46f2fefc2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm @@ -101,6 +101,7 @@ sub fast_fieldmapper { my $id = shift; my $col = shift; my $like = shift; + my $options = shift; my $class = ref($self) || $self; my $fm_class = 'Fieldmapper::'.$class; my @fms; @@ -121,7 +122,7 @@ sub fast_fieldmapper { $search_type = 'search_regex' } - for my $obj ($class->$search_type({ $col => $id})) { + for my $obj ($class->$search_type({ $col => $id}, $options)) { push @fms, $obj->to_fieldmapper; } } @@ -301,8 +302,6 @@ sub modify_from_fieldmapper { actor::card->has_a( usr => 'actor::user' ); - config::rules::age_hold_protect->has_a( radius => 'actor::org_unit_type' ); - actor::org_unit->has_a( parent_ou => 'actor::org_unit' ); actor::org_unit->has_a( ou_type => 'actor::org_unit_type' ); #actor::org_unit->has_a( address => 'actor::org_address' ); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm index 9e0485eaa7..b617d834cf 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -45,7 +45,7 @@ __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib duration duration_rule renewal_remaining recuring_fine_rule recuring_fine stop_fines max_fine max_fine_rule fine_interval - stop_fines xact_finish/); + stop_fines xact_finish due_date/); #------------------------------------------------------------------------------- diff --git a/Open-ILS/src/sql/Postgres/090.schema.action.sql b/Open-ILS/src/sql/Postgres/090.schema.action.sql index 3b08f56c40..e2c7c61039 100644 --- a/Open-ILS/src/sql/Postgres/090.schema.action.sql +++ b/Open-ILS/src/sql/Postgres/090.schema.action.sql @@ -70,12 +70,32 @@ CREATE TABLE action.circulation ( ) INHERITS (money.billable_xact); CREATE INDEX circ_open_xacts_idx ON action.circulation (usr) WHERE xact_finish IS NULL; +CREATE OR REPLACE VIEW action.open_cirulations AS + SELECT * + FROM action.circulation + WHERE xact_finish IS NULL; + +CREATE OR REPLACE FUNCTION action.circulation_claims_returned () RETURNS TRIGGER AS $$ +BEGIN + IF NEW.stop_fines <> OLD.stop_fines AND NEW.stop_fines = 'CLAIMSRETURNED' THEN + UPDATE actor.usr SET claims_returned_count = claims_returned_count + 1 WHERE id = NEW.usr; + END IF; + RETURN NEW; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TRIGGER action_circulation_claims_returned + BEFORE UPDATE ON action.circulation + FOR EACH ROW + EXECUTE PROCEDURE action.circulation_claims_returned (); + CREATE TABLE action.hold_request ( id SERIAL PRIMARY KEY, request_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), capture_time TIMESTAMP WITH TIME ZONE, fulfillment_time TIMESTAMP WITH TIME ZONE, + checkin_time TIMESTAMP WITH TIME ZONE, + return_time TIMESTAMP WITH TIME ZONE, prev_check_time TIMESTAMP WITH TIME ZONE, expire_time TIMESTAMP WITH TIME ZONE, requestor INT NOT NULL REFERENCES actor.usr (id), @@ -101,11 +121,21 @@ CREATE TABLE action.hold_notification ( CREATE TABLE action.hold_copy_map ( id SERIAL PRIMARY KEY, - hold INT NOT NULL REFERENCES action.hold_notification (id) ON DELETE CASCADE, + hold INT NOT NULL REFERENCES action.hold_request (id) ON DELETE CASCADE, target_copy BIGINT NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE, - CONSTRAINT copy_once_per_hold UNIQUE (hold,copy) + CONSTRAINT copy_once_per_hold UNIQUE (hold,target_copy) ); +CREATE TABLE action.hold_transit_copy ( + id SERIAL PRIMARY KEY, + hold INT NOT NULL REFERENCES action.hold_request (id), + source INT NOT NULL REFERENCES actor.org_unit (id), + dest INT NOT NULL REFERENCES actor.org_unit (id), + persistant_transfer BOOL NOT NULL DEFAULT FALSE, + source_send_time TIMESTAMP WITH TIME ZONE, + dest_recv_time TIMESTAMP WITH TIME ZONE, + prev_hop INT REFERENCES action.hold_transit_copy (id) +); COMMIT; -- 2.11.0