- my $self = shift;
- my %opt = @_;
- my $conf = new FS::Conf;
- my $prefix = '';
- my $format = $conf->config('cust_location-label_prefix') || '';
- my $cust_or_prospect;
- if ( $self->custnum ) {
- $cust_or_prospect = FS::cust_main->by_key($self->custnum);
- }
- elsif ( $self->prospectnum ) {
- $cust_or_prospect = FS::prospect_main->by_key($self->prospectnum);
+ my( $self, %opt ) = @_;
+
+ my $prefix = $self->label_prefix;
+ $prefix .= ($opt{join_string} || ': ') if $prefix;
+
+ $prefix . $self->SUPER::location_label(%opt);
+}
+
+=item label_prefix
+
+Returns the optional site ID string (based on the cust_location-label_prefix
+config option), "Default service location", or the empty string.
+
+Options:
+
+=over 4
+
+=item cust_main
+
+Customer object (see L<FS::cust_main>)
+
+=item prospect_main
+
+Prospect object (see L<FS::prospect_main>)
+
+=back
+
+=cut
+
+sub label_prefix {
+ my( $self, %opt ) = @_;
+
+ my $cust_or_prospect = $opt{cust_main} || $opt{prospect_main};
+ unless ( $cust_or_prospect ) {
+ if ( $self->custnum ) {
+ $cust_or_prospect = FS::cust_main->by_key($self->custnum);
+ } elsif ( $self->prospectnum ) {
+ $cust_or_prospect = FS::prospect_main->by_key($self->prospectnum);
+ }