From 973d4c53994dfa563292990d4e1ad5493b9fd69c Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 19 Jul 2005 14:53:25 +0000 Subject: [PATCH 1/1] adding view for open circs git-svn-id: svn://svn.open-ils.org/ILS/trunk@1277 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/CDBI/action.pm | 12 ++++++++++++ .../OpenILS/Application/Storage/Driver/Pg/dbi.pm | 5 +++++ Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm | 4 ++++ Open-ILS/src/sql/Postgres/090.schema.action.sql | 12 +++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) 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 d89dcc1530..eedf83aba2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -49,6 +49,18 @@ __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib #------------------------------------------------------------------------------- +package action::open_circulation; +use base qw/action/; +__PACKAGE__->table('action_open_circulation'); +__PACKAGE__->columns(Primary => 'id'); +__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 due_date renewal/); + +#------------------------------------------------------------------------------- + package action::hold_request; use base qw/action/; __PACKAGE__->table('action_hold_request'); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm index 30aee17360..4ee5b737ec 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm @@ -74,6 +74,11 @@ action::circulation->table( 'action.circulation' ); action::circulation->sequence( 'money.billable_xact_id_seq' ); + #--------------------------------------------------------------------- + package action::open_circulation; + + action::open_circulation->table( 'action.open_circulation' ); + #--------------------------------------------------------------------- package action::survey; diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm index f12a67473f..fd43df0a52 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm @@ -61,6 +61,10 @@ sub _init { 'Fieldmapper::action::survey_response' => { hint => 'asvr' }, 'Fieldmapper::action::circulation' => { hint => 'circ', proto_fields => {} }, + + 'Fieldmapper::action::open_circulation' => { hint => 'aoc', + readonly => 1 }, + 'Fieldmapper::actor::user' => { hint => 'au', proto_fields => { cards => 1, survey_responses => 1, diff --git a/Open-ILS/src/sql/Postgres/090.schema.action.sql b/Open-ILS/src/sql/Postgres/090.schema.action.sql index 888800af5d..cc1fe0b0dc 100644 --- a/Open-ILS/src/sql/Postgres/090.schema.action.sql +++ b/Open-ILS/src/sql/Postgres/090.schema.action.sql @@ -67,10 +67,20 @@ CREATE TABLE action.circulation ( max_fine NUMERIC(6,2) NOT NULL, -- derived from "max fine" rule fine_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule due_date TIMESTAMP WITH TIME ZONE NOT NULL, - stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES','RENEW')) + stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES','RENEW','LONGOVERDUE')) ) INHERITS (money.billable_xact); CREATE INDEX circ_open_xacts_idx ON action.circulation (usr) WHERE xact_finish IS NULL; +CREATE VIEW action.open_circulation AS + SELECT * + FROM action.circulation + WHERE xact_finish IS NULL + AND ( stop_fines IS NULL OR + stop_fines IN ('CLAIMSRETURNED','MAXFINES','LONGOVERDUE') + ) + ORDER BY due_date; + + CREATE OR REPLACE VIEW action.open_cirulations AS SELECT * FROM action.circulation -- 2.43.2