diff options
author | jeff <jeff> | 2010-10-11 19:00:33 +0000 |
---|---|---|
committer | jeff <jeff> | 2010-10-11 19:00:33 +0000 |
commit | eec4949e2c8f09a0b89331437186b77c4db6ff38 (patch) | |
tree | 5e41fdf9edb1b8ca1fa16051225dc1056e2b84de /FS/FS/cust_location.pm | |
parent | 001393ff80427429f376f7bf38c42d5280d98dc5 (diff) |
external taxes support package locations RT10093
Diffstat (limited to 'FS/FS/cust_location.pm')
-rw-r--r-- | FS/FS/cust_location.pm | 80 |
1 files changed, 12 insertions, 68 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 0c5c02388..ab80941f9 100644 --- a/FS/FS/cust_location.pm +++ b/FS/FS/cust_location.pm @@ -1,7 +1,7 @@ package FS::cust_location; use strict; -use base qw( FS::Record ); +use base qw( FS::geocode_Mixin FS::Record ); use Locale::Country; use FS::Record qw( qsearch ); #qsearchs ); use FS::prospect_main; @@ -163,91 +163,35 @@ sub country_full { code2country($self->country); } -=item location_label [ OPTION => VALUE ... ] - -Returns the label of the service location for this customer. - -Options are - -=over 4 - -=item join_string - -used to separate the address elements (defaults to ', ') - -=item escape_function - - -a callback used for escaping the text of the address elements +=item line -=back +Synonym for location_label =cut -# false laziness with FS::cust_main::location_label - -sub location_label { +sub line { my $self = shift; - my %opt = @_; - - my $separator = $opt{join_string} || ', '; - my $escape = $opt{escape_function} || sub{ shift }; - my $ds = $opt{double_space} || ' '; - my $line = ''; - my $cydefault = - $opt{'countrydefault'} || FS::Conf->new->config('countrydefault') || 'US'; - my $prefix = ''; - - my $notfirst = 0; - foreach (qw ( address1 address2 ) ) { - my $method = "$prefix$_"; - $line .= ($notfirst ? $separator : ''). &$escape($self->$method) - if $self->$method; - $notfirst++; - } - $notfirst = 0; - foreach (qw ( city county state zip ) ) { - my $method = "$prefix$_"; - if ( $self->$method ) { - $line .= ($notfirst ? ($method eq 'zip' ? $ds : ' ') : $separator); - $line .= '(' if $method eq 'county'; - $line .= &$escape($self->$method); - $line .= ')' if $method eq 'county'; - $notfirst++; - } - $line .= ',' if $method eq 'county'; - } - $line .= $separator. &$escape(code2country($self->country)) - if $self->country ne $cydefault; - - $line; + $self->location_label; } -=item line +=item has_ship_address -Synonym for location_label +Returns false since cust_location objects do not have a separate shipping +address. =cut -sub line { - my $self = shift; - $self->location_label; +sub has_ship_address { + ''; } =item location_hash -Returns a list of key/value pairs, with the following keys: address1, adddress2, -city, county, state, zip, country. +Returns a list of key/value pairs, with the following keys: address1, address2, +city, county, state, zip, country, geocode. =cut -#geocode? not yet set - -sub location_hash { - my $self = shift; - map { $_ => $self->$_ } qw( address1 address2 city county state zip country ); -} - =back =head1 BUGS |