enable CardFortress in test database, #71513
[freeside.git] / FS / FS / access_user_pref.pm
1 package FS::access_user_pref;
2 use base qw(FS::Record);
3
4 use strict;
5
6 =head1 NAME
7
8 FS::access_user_pref - Object methods for access_user_pref records
9
10 =head1 SYNOPSIS
11
12   use FS::access_user_pref;
13
14   $record = new FS::access_user_pref \%hash;
15   $record = new FS::access_user_pref { 'column' => 'value' };
16
17   $error = $record->insert;
18
19   $error = $new_record->replace($old_record);
20
21   $error = $record->delete;
22
23   $error = $record->check;
24
25 =head1 DESCRIPTION
26
27 An FS::access_user_pref object represents an per-user preference.  Preferenaces
28 are also used to store transient state information (server-side "cookies").
29 FS::access_user_pref inherits from FS::Record.  The following fields are
30 currently supported:
31
32 =over 4
33
34 =item prefnum - primary key
35
36 =item usernum - Internal access user (see L<FS::access_user>)
37
38 =item prefname - 
39
40 =item prefvalue - 
41
42 =item expiration - 
43
44 =back
45
46 =head1 METHODS
47
48 =over 4
49
50 =item new HASHREF
51
52 Creates a new preference.  To add the preference to the database, see L<"insert">.
53
54 Note that this stores the hash reference, not a distinct copy of the hash it
55 points to.  You can ask the object for a copy with the I<hash> method.
56
57 =cut
58
59 # the new method can be inherited from FS::Record, if a table method is defined
60
61 sub table { 'access_user_pref'; }
62
63 =item insert
64
65 Adds this record to the database.  If there is an error, returns the error,
66 otherwise returns false.
67
68 =cut
69
70 # the insert method can be inherited from FS::Record
71
72 =item delete
73
74 Delete this record from the database.
75
76 =cut
77
78 # the delete method can be inherited from FS::Record
79
80 =item replace OLD_RECORD
81
82 Replaces the OLD_RECORD with this one in the database.  If there is an error,
83 returns the error, otherwise returns false.
84
85 =cut
86
87 # the replace method can be inherited from FS::Record
88
89 =item check
90
91 Checks all fields to make sure this is a valid preference.  If there is
92 an error, returns the error, otherwise returns false.  Called by the insert
93 and replace methods.
94
95 =cut
96
97 # the check method should currently be supplied - FS::Record contains some
98 # data checking routines
99
100 sub check {
101   my $self = shift;
102
103   my $error = 
104     $self->ut_numbern('prefnum')
105     || $self->ut_number('usernum')
106     || $self->ut_text('prefname')
107     #|| $self->ut_textn('prefvalue')
108     || $self->ut_anything('prefvalue')
109   ;
110   return $error if $error;
111
112   $self->SUPER::check;
113 }
114
115 =back
116
117 =head1 BUGS
118
119 =head1 SEE ALSO
120
121 L<FS::access_user>, L<FS::Record>, schema.html from the base documentation.
122
123 =cut
124
125 1;
126