5 use FS::Record qw( qsearchs );
8 use UNIVERSAL qw( can );
10 @ISA = qw( FS::Record );
14 FS::sb_field - Object methods for sb_field records
20 $record = new FS::sb_field \%hash;
21 $record = new FS::sb_field { 'column' => 'value' };
23 $error = $record->insert;
25 $error = $new_record->replace($old_record);
27 $error = $record->delete;
29 $error = $record->check;
33 See L<FS::part_sb_field> for details on this table's mission in life.
34 FS::sb_field contains the actual values of the xfields defined in
37 The following fields are supported:
41 =item sbfieldpart - Type of sb_field as defined by FS::part_sb_field
43 =item svcnum - The svc_broadband to which this value belongs.
45 =item value - The contents of the field.
55 Create a new record. To add the record to the database, see L<"insert">.
59 sub table { 'sb_field'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
68 Deletes this record from the database. If there is an error, returns the
69 error, otherwise returns false.
71 =item replace OLD_RECORD
73 Replaces OLD_RECORD with this one in the database. If there is an error,
74 returns the error, otherwise returns false.
78 Checks the value against the check_block of the corresponding part_sb_field.
79 Returns whatever the check_block returned (unless the check_block dies, in
80 which case check returns the die message). Therefore, if the check_block
81 wants to allow the value to be stored, it must return false. See
82 L<FS::part_sb_field> for details.
89 return "svcnum must be defined" unless $self->svcnum;
90 return "sbfieldpart must be defined" unless $self->sbfieldpart;
92 my $part_sb_field = $self->part_sb_field;
96 my $check_block = $self->part_sb_field->check_block;
99 my $error = (eval($check_block) or $@); # treat fatal errors as errors
100 return $error if $error;
101 $self->setfield('value' => $_);
109 Returns a reference to the FS::part_sb_field that defines this FS::sb_field.
116 return qsearchs('part_sb_field', { sbfieldpart => $self->sbfieldpart });
123 Returns a reference to the FS::svc_broadband to which this value is attached.
124 Nobody's ever going to use this function, but here it is anyway.
131 return qsearchs('svc_broadband', { svcnum => $self->svcnum });
142 L<FS::svc_broadband>, schema.html
143 from the base documentation.