From ffed40ef42b9efe756fad595987e174d0876f5cc Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 15 Jul 2005 18:32:45 +0000 Subject: [PATCH] adding "user_setting" object git-svn-id: svn://svn.open-ils.org/ILS/trunk@1212 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/CDBI/actor.pm | 8 +++++ .../Application/Storage/Driver/Pg/dbi.pm | 6 ++++ .../src/perlmods/OpenILS/Utils/Fieldmapper.pm | 3 +- .../src/sql/Postgres/005.schema.actors.sql | 33 +++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm index 3649f46c54..4f027bfde1 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm @@ -20,6 +20,14 @@ __PACKAGE__->columns( Essential => qw/usrname email first_given_name standing profile prefix suffix alert_message 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/; 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 37653a2432..db1885e0e5 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 @@ -225,6 +225,12 @@ actor::user->table( 'actor.usr' ); 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; diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm index 1d2b287f2a..91a088253e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm @@ -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; diff --git a/Open-ILS/src/sql/Postgres/005.schema.actors.sql b/Open-ILS/src/sql/Postgres/005.schema.actors.sql index 857434d44f..c44beedfb8 100644 --- a/Open-ILS/src/sql/Postgres/005.schema.actors.sql +++ b/Open-ILS/src/sql/Postgres/005.schema.actors.sql @@ -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 + * + * 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 -- 2.43.2