summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-01-09 04:06:26 +0000
committerivan <ivan>2009-01-09 04:06:26 +0000
commit20bddf47a41b6d064b3cfa4c41e55c157cf0c3de (patch)
tree61b285cb23ccb27b145bdee84ff0c7421477eaba /FS
parent2b8ffc98529637ffddfe7cbf6b4f9b8deb90f0fa (diff)
pick/enter a location when ordering a package, RT#4499
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Mason.pm1
-rw-r--r--FS/FS/cust_location.pm21
-rw-r--r--FS/FS/cust_main.pm12
3 files changed, 34 insertions, 0 deletions
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 0a608ddb0..e0f58b814 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -105,6 +105,7 @@ Initializes the Mason environment, loads all Freeside and RT libraries, etc.
use FS::cust_main qw(smart_search);
use FS::cust_main::Import;
use FS::cust_main_county;
+ use FS::cust_location;
use FS::cust_pay;
use FS::cust_pkg;
use FS::part_pkg_taxclass;
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index 0544dcfba..50d2a1846 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -158,6 +158,27 @@ sub country_full {
code2country($self->country);
}
+=item line
+
+Returns this location on one line
+
+=cut
+
+sub line {
+ my $self = shift;
+ my $cydefault = FS::conf->new->config('countrydefault') || 'US';
+
+ my $line = $self->address1;
+ $line .= ', '. $self->address2 if $self->address2;
+ $line .= ', '. $self->city;
+ $line .= ' ('. $self->county. ' county)' if $self->county;
+ $line .= ', '. $self->state if $self->state;
+ $line .= ' '. $self->zip if $self->zip;
+ $line .= ' '. code2country($self->country) if $self->country ne $cydefault;
+
+ $line;
+}
+
=back
=head1 BUGS
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 2b94dca33..fb6808107 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -36,6 +36,7 @@ use FS::cust_credit;
use FS::cust_refund;
use FS::part_referral;
use FS::cust_main_county;
+use FS::cust_location;
use FS::tax_rate;
use FS::cust_tax_location;
use FS::part_pkg_taxrate;
@@ -1721,6 +1722,17 @@ sub cust_pkg {
shift->all_pkgs(@_);
}
+=item cust_location
+
+Returns all locations (see L<FS::cust_location>) for this customer.
+
+=cut
+
+sub cust_location {
+ my $self = shift;
+ qsearch('cust_location', { 'custnum' => $self->custnum } );
+}
+
=item ncancelled_pkgs
Returns all non-cancelled packages (see L<FS::cust_pkg>) for this customer.