adding hold notification targets and hold_copy_map
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Jun 2005 19:48:22 +0000 (19:48 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Jun 2005 19:48:22 +0000 (19:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@975 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
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 10be2c1..0fd5291 100644 (file)
@@ -443,11 +443,17 @@ sub modify_from_fieldmapper {
 
        action::hold_notification->has_a(  hold => 'action::hold_request' );
        
+       action::hold_copy_map->has_a(  hold => 'action::hold_request' );
+       action::hold_copy_map->has_a(  copy => 'asset::copy' );
+
        action::hold_request->has_a(  current_copy => 'asset::copy' );
        action::hold_request->has_a(  requestor => 'actor::user' );
        action::hold_request->has_a(  usr => 'actor::user' );
        action::hold_request->has_a(  pickup_lib => 'actor::org_unit' );
 
        action::hold_request->has_many(  notifications => 'action::hold_notification' );
+       action::hold_request->has_many(  copy_maps => 'action::hold_copy_map' );
+
+       asset::copy->has_many(  hold_maps => 'action::hold_copy_map' );
 
 1;
index e025d4e..eafaa19 100644 (file)
@@ -56,7 +56,8 @@ __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time
                                     prev_check_time expire_time requestor usr
                                     hold_type holdable_formats target
-                                    selection_depth pickup_lib current_copy/);
+                                    phone_notify email_notify selection_depth
+                                    pickup_lib current_copy/);
 
 #-------------------------------------------------------------------------------
 
@@ -68,5 +69,13 @@ __PACKAGE__->columns(Essential => qw/hold method notify_time note/);
 
 #-------------------------------------------------------------------------------
 
+package action::hold_copy_map;
+use base qw/action/;
+__PACKAGE__->table('action_hold_copy_map');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/hold copy/);
+
+#-------------------------------------------------------------------------------
+
 1;
 
index a3d7c4a..141362f 100644 (file)
 
        #-------------------------------------------------------------------------------
 
+       package action::hold_copy_map;
+
+       action::hold_copy_map->sequence( 'action.hold_copy_map_id_seq' );
+       action::hold_copy_map->table('action.hold_copy_map');
+
+       #-------------------------------------------------------------------------------
+
 
 }
 
index 788989b..22fd708 100644 (file)
@@ -157,6 +157,7 @@ sub _init {
                'Fieldmapper::permission::grp_perm_map'         => { hint => 'pgpm'   },
                'Fieldmapper::action::hold_request'             => { hint => 'ahr'   },
                'Fieldmapper::action::hold_notification'        => { hint => 'ahn'   },
+               'Fieldmapper::action::hold_copy_map'            => { hint => 'ahcm'   },
 
 
                'Fieldmapper::ex'                               => { hint => 'ex',
index 7fabc74..3fa384f 100644 (file)
@@ -82,6 +82,8 @@ CREATE TABLE action.hold_request (
        usr                     INT                             NOT NULL REFERENCES actor.usr (id),
        hold_type               CHAR                            NOT NULL CHECK (hold_type IN ('M','T','V','C')),
        holdable_formats        TEXT,
+       phone_notify            TEXT,
+       email_notify            TEXT,
        target                  BIGINT                          NOT NULL, -- see hold_type
        selection_depth         INT                             NOT NULL DEFAULT 0,
        pickup_lib              INT                             NOT NULL REFERENCES actor.org_unit,
@@ -97,6 +99,12 @@ CREATE TABLE action.hold_notification (
        note            TEXT
 );
 
+CREATE TABLE action.hold_copy_map (
+       id      SERIAL  PRIMARY KEY,
+       hold    INT     NOT NULL REFERENCES action.hold_notification (id) ON DELETE CASCADE,
+       copy    BIGINT  NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE,
+       CONSTRAINT copy_once_per_hold UNIQUE (hold,copy)
+);
 
 
 COMMIT;