adding "user_setting" object
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jul 2005 18:32:45 +0000 (18:32 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jul 2005 18:32:45 +0000 (18:32 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1212 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.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/005.schema.actors.sql

index 3649f46..4f027bf 100644 (file)
@@ -21,6 +21,14 @@ __PACKAGE__->columns( Essential => qw/usrname email first_given_name
                                day_phone evening_phone other_phone mailing_address/ );
 
 #-------------------------------------------------------------------------------
+package actor::user_setting;
+use base qw/actor/;
+
+__PACKAGE__->table( 'actor_user_setting' );
+__PACKAGE__->columns( Primary => qw/id/);
+__PACKAGE__->columns( Essential => qw/usr name value/);
+
+#-------------------------------------------------------------------------------
 package actor::profile;
 use base qw/actor/;
 
index 37653a2..db1885e 100644 (file)
        actor::user->sequence( 'actor.usr_id_seq' );
 
        #---------------------------------------------------------------------
+       package actor::user_setting;
+       
+       actor::user_setting->table( 'actor.usr_setting' );
+       actor::user_setting->sequence( 'actor.usr_setting_id_seq' );
+
+       #---------------------------------------------------------------------
        package actor::user_address;
        
        actor::user_address->table( 'actor.usr_address' );
index 1d2b287..91a0882 100644 (file)
@@ -67,7 +67,9 @@ sub _init {
                                                                                             stat_cat_entries   => 1,
                                                                                             checkouts          => 1,
                                                                                             hold_requests      => 1,
+                                                                                            settings           => 1,
                                                                                             addresses          => 1 } },
+               'Fieldmapper::actor::user_setting'              => { hint => 'aus'    },
                'Fieldmapper::actor::user_address'              => { hint => 'aua'    },
                'Fieldmapper::actor::org_address'               => { hint => 'aoa'    },
                'Fieldmapper::actor::profile'                   => { hint => 'ap'    },
@@ -328,7 +330,6 @@ sub cdbi {
        return $fieldmap->{$self->class_name}->{cdbi};
 }
 
-
 sub is_virtual {
        my $self = shift;
        my $field = shift;
index 857434d..c44beed 100644 (file)
@@ -136,6 +136,39 @@ INSERT INTO actor.usr ( profile, card, usrname, passwd, first_given_name, family
 INSERT INTO actor.usr ( profile, card, usrname, passwd, first_given_name, family_name, dob, master_account, super_user, ident_type, ident_value )
        VALUES ( 1, 3,'athens', 'athens', 'athens', 'user', '1979-01-22', FALSE, TRUE, 1, 'identification' );
 
+
+CREATE TABLE actor.usr_setting (
+       id      BIGSERIAL       PRIMARY KEY,
+       usr     INT             NOT NULL REFERENCES actor.usr ON DELETE CASCADE,
+       name    TEXT            NOT NULL,
+       value   TEXT            NOT NULL,
+       CONSTRAINT name_once_per_value UNIQUE (usr,name)
+);
+COMMENT ON TABLE actor.usr_setting IS $$
+/*
+ * Copyright (C) 2005  Georgia Public Library Service 
+ * Mike Rylander <mrylander@gmail.com>
+ *
+ * User objects
+ *
+ * This table contains any arbitrary settings that a client
+ * program would like to save for a user.
+ *
+ * ****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+$$;
+
+
 CREATE TABLE actor.profile (
        id              SERIAL  PRIMARY KEY,
        name            TEXT    NOT NULL UNIQUE