1 package FS::location_Mixin;
4 use FS::Record qw( qsearchs );
9 Returns the location object, if any (see L<FS::cust_location>).
15 return '' unless $self->locationnum;
16 qsearchs( 'cust_location', { 'locationnum' => $self->locationnum } );
19 =item cust_location_or_main
21 If this package is associated with a location, returns the locaiton (see
22 L<FS::cust_location>), otherwise returns the customer (see L<FS::cust_main>).
26 sub cust_location_or_main {
28 $self->cust_location || $self->cust_main;
31 =item location_label [ OPTION => VALUE ... ]
33 Returns the label of the location object (see L<FS::cust_location>).
39 my $object = $self->cust_location_or_main;
40 $object->location_label(@_);
45 Returns a hash of values for the location, either from the location object,
46 the cust_main shipping address, or the cust_main address, whichever is present
53 my $object = $self->cust_location_or_main;
54 $object->location_hash(@_);