1 package FS::part_event_condition_option;
5 use FS::Record qw( qsearch qsearchs );
7 use FS::part_event_condition;
9 @ISA = qw( FS::option_Common ); # FS::Record);
13 FS::part_event_condition_option - Object methods for part_event_condition_option records
17 use FS::part_event_condition_option;
19 $record = new FS::part_event_condition_option \%hash;
20 $record = new FS::part_event_condition_option { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::part_event_condition_option object represents an event condition option.
33 FS::part_event_condition_option inherits from FS::Record. The following fields
34 are currently supported:
38 =item optionnum - primary key
40 =item eventconditionnum - Event condition (see L<FS::part_event_condition>)
42 =item optionname - Option name
44 =item optionvalue - Option value
54 Creates a new record. To add the record to the database, see L<"insert">.
56 Note that this stores the hash reference, not a distinct copy of the hash it
57 points to. You can ask the object for a copy with the I<hash> method.
61 # the new method can be inherited from FS::Record, if a table method is defined
63 sub table { 'part_event_condition_option'; }
65 =item insert [ HASHREF | OPTION => VALUE ... ]
67 Adds this record to the database. If there is an error, returns the error,
68 otherwise returns false.
70 If a list or hash reference of options is supplied,
71 part_event_condition_option_option records are created (see
72 L<FS::part_event_condition_option_option>).
76 # the insert method can be inherited from FS::Record
80 Delete this record from the database.
84 # the delete method can be inherited from FS::Record
86 =item replace OLD_RECORD [ HASHREF | OPTION => VALUE ... ]
88 Replaces the OLD_RECORD with this one in the database. If there is an error,
89 returns the error, otherwise returns false.
91 If a list or hash reference of options is supplied,
92 part_event_condition_option_option records are created or modified (see
93 L<FS::part_event_condition_option_option>).
97 # the replace method can be inherited from FS::Record
101 Checks all fields to make sure this is a valid record. If there is
102 an error, returns the error, otherwise returns false. Called by the insert
107 # the check method should currently be supplied - FS::Record contains some
108 # data checking routines
114 $self->ut_numbern('optionnum')
115 || $self->ut_foreign_key('eventconditionnum',
116 'part_event_condition', 'eventconditionnum')
117 || $self->ut_text('optionname')
118 || $self->ut_textn('optionvalue')
120 return $error if $error;
125 #this makes the nested options magically show up as perl refs
126 #move it to a mixin class if we need nested options again
129 if ( scalar(@_) ) { #setting, no magic (here, insert takes care of it)
130 $self->set('optionvalue', @_);
131 } else { #getting, magic
132 my $optionvalue = $self->get('optionvalue');
133 if ( $optionvalue eq 'HASH' ) {
134 return { $self->options };
145 L<FS::part_event_condition>, L<FS::part_event_condition_option_option>,
146 L<FS::Record>, schema.html from the base documentation.