adding view for open circs
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 19 Jul 2005 14:53:25 +0000 (14:53 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 19 Jul 2005 14:53:25 +0000 (14:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1277 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
Open-ILS/src/sql/Postgres/090.schema.action.sql

index d89dcc1..eedf83a 100644 (file)
@@ -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');
index 30aee17..4ee5b73 100644 (file)
        action::circulation->sequence( 'money.billable_xact_id_seq' );
 
        #---------------------------------------------------------------------
+       package action::open_circulation;
+       
+       action::open_circulation->table( 'action.open_circulation' );
+
+       #---------------------------------------------------------------------
        package action::survey;
        
        action::survey->table( 'action.survey' );
index f12a674..fd43df0 100644 (file)
@@ -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,
index 888800a..cc1fe0b 100644 (file)
@@ -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