1 package FS::realestate_unit;
7 use FS::Record qw(qsearch qsearchs);
11 FS::realestate_unit - Object representing a realestate_unit record
15 use FS::realestate_unit;
17 $record = new FS:realestate_unit \%values;
18 $record = new FS::realestate_unit {
19 realestatelocnum => 42,
21 unit_title => 'Ste 404',
24 $error = $record->insert;
25 $error = $new_rec->replace($record)
26 $error = $record->check;
28 $location = $record->location;
32 An FS::realestate_unit object represents an invoicable unit of real estate.
33 Object may represent a single property, such as a rental house. It may also
34 represent a group of properties sharing a common address or identifier, such
35 as a shopping mall, apartment complex, or office building, concert hall.
37 A FS::realestate_unit object must be associated with a FS::realestate_location
39 FS::realestate_unit inherits from FS::Record.
41 The following fields are currently supported:
47 =item realestatelocnum
63 =item new HASHREF (see L<FS::Record>)
67 sub table {'realestate_unit';}
69 =item insert (see L<FS::Record>)
73 FS::realestate_unit records should never be deleted, only disabled
78 # Once this record has been associated with a customer in any way, it
79 # should not be deleted. todo perhaps, add a is_deletable function that
80 # checks if the record has ever actually been used, and allows deletion
81 # if it hasn't. (entered in error, etc).
82 croak "FS::realestate_unit records should never be deleted";
86 =item replace OLD_RECORD (see L<FS::Record>)
88 =item check (see L<FS::Record>)
92 Returns the associated agent, if any, for this object
98 return undef unless $self->agentnum;
99 return qsearchs('agent', {agentnum => $self->agentnum} );
104 Return the associated FS::realestate_location object
110 return $self->{location} if exists $self->{location};
111 return $self->{location} = qsearchs(
112 'realestate_location',
113 {realestatelocnum => $self->realestatelocnum}
130 L<FS::record>, L<FS::realestate_location>, L<FS::svc_realestate>