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