enable CardFortress in test database, #71513
[freeside.git] / FS / FS / cust_pkg_option.pm
1 package FS::cust_pkg_option;
2 use base qw(FS::Record);
3
4 use strict;
5
6 =head1 NAME
7
8 FS::cust_pkg_option - Object methods for cust_pkg_option records
9
10 =head1 SYNOPSIS
11
12   use FS::cust_pkg_option;
13
14   $record = new FS::cust_pkg_option \%hash;
15   $record = new FS::cust_pkg_option { '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::cust_pkg_option object represents an option key an value for a
28 customer package.  FS::cust_pkg_option inherits from
29 FS::Record.  The following fields are currently supported:
30
31 =over 4
32
33 =item optionnum - primary key
34
35 =item pkgnum - 
36
37 =item optionname - 
38
39 =item optionvalue - 
40
41
42 =back
43
44 =head1 METHODS
45
46 =over 4
47
48 =item new HASHREF
49
50 Creates a new option.  To add the option to the database, see L<"insert">.
51
52 Note that this stores the hash reference, not a distinct copy of the hash it
53 points to.  You can ask the object for a copy with the I<hash> method.
54
55 =cut
56
57 sub table { 'cust_pkg_option'; }
58
59 =item insert
60
61 Adds this record to the database.  If there is an error, returns the error,
62 otherwise returns false.
63
64 =cut
65
66 =item delete
67
68 Delete this record from the database.
69
70 =cut
71
72 =item replace OLD_RECORD
73
74 Replaces the OLD_RECORD with this one in the database.  If there is an error,
75 returns the error, otherwise returns false.
76
77 =cut
78
79 =item check
80
81 Checks all fields to make sure this is a valid option.  If there is
82 an error, returns the error, otherwise returns false.  Called by the insert
83 and replace methods.
84
85 =cut
86
87 sub check {
88   my $self = shift;
89
90   my $error = 
91     $self->ut_numbern('optionnum')
92     || $self->ut_foreign_key('pkgnum', 'cust_pkg', 'pkgnum')
93     || $self->ut_text('optionname')
94     || $self->ut_textn('optionvalue')
95   ;
96   return $error if $error;
97
98   $self->SUPER::check;
99 }
100
101 =back
102
103 =head1 BUGS
104
105 =head1 SEE ALSO
106
107 L<FS::Record>, L<FS::cust_pkg>, schema.html from the base documentation.
108
109 =cut
110
111 1;
112