1 package FS::svc_realestate;
2 use base qw(FS::svc_Common);
8 use FS::Record qw(qsearchs qsearch dbh);
11 $FS::UID::callback{'FS::svc_realestate'} = sub {
17 FS::svc_realestate - Object methods for svc_realestate records
25 A FS::svc_realestate object represents a billable real estate trasnaction,
26 such as renting a home or office.
28 FS::svc_realestate inherits from FS::svc_Common. The following fields are
33 =item svcnum - primary key
43 Instantiates a new svc_realestate object.
48 tie my %fields, 'Tie::IxHash',
51 type => 'select-realestate_unit',
52 label => 'Real estate unit',
56 name => 'Real estate',
57 name_plural => 'Real estate services',
58 longname_plural => 'Real estate services',
59 display_weight => 100,
65 sub table {'svc_realestate'}
69 Returns a label formatted as:
70 <location_title> <unit_title>
76 my $unit = $self->realestate_unit;
77 my $location = $self->realestate_location;
79 return $location->location_title.' '.$unit->unit_title
80 if $unit && $location;
82 return $self->svcnum; # shouldn't happen
88 Returns associated L<FS::realestate_unit>
95 return $self->get('_realestate_unit')
96 if $self->get('_realestate_unit');
98 return unless $self->realestatenum;
100 my $realestate_unit = qsearchs(
102 {realestatenum => $self->realestatenum}
105 $self->set('_realestate_unit', $realestate_unit);
109 =item realestate_location
111 Returns associated L<FS::realestate_location>
115 sub realestate_location {
118 my $realestate_unit = $self->realestate_unit;
119 return unless $realestate_unit;
121 $realestate_unit->location;
126 Returns associated L<FS::cust_svc>
131 qsearchs('cust_svc', { 'svcnum' => $_[0]->svcnum } );
136 I have an unfounded suspicion this method serves no purpose in this context
140 # sub search_sql {die "search_sql called on FS::svc_realestate"}
144 Adds this record to the database. If there is an error, returns the error,
145 otherwise returns false.
149 Delete this record from the database.
151 =item replace OLD_RECORD
153 Replaces the OLD_RECORD with this one in the database. If there is an error,
154 returns the error, otherwise returns false.
158 Checks all fields to make sure this is a valid record. If there is
159 an error, returns the error, otherwise returns false. Called by the insert
168 L<FS::Record>, schema.html from the base documentation.