X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FURI%2Ffreeside%2FInternal.pm;h=f7b9bab0bc783df5eda3dd227d740fc40a36932f;hb=ddf8a73dc4f6fd76f5fdc148935543a85884dc4a;hp=33831bcacc46d441665dd8642c029c3971832352;hpb=d5f8aa5cf1787238224add1a836f0d7577f3b9b7;p=freeside.git diff --git a/rt/lib/RT/URI/freeside/Internal.pm b/rt/lib/RT/URI/freeside/Internal.pm index 33831bcac..f7b9bab0b 100644 --- a/rt/lib/RT/URI/freeside/Internal.pm +++ b/rt/lib/RT/URI/freeside/Internal.pm @@ -210,8 +210,8 @@ sub CustomerResolver { sub CustomerInfo { my $self = shift; - $self = $self->CustomerResolver; return $self->{CustomerInfo} if $self->{CustomerInfo}; + $self = $self->CustomerResolver; my $rec = $self->_FreesideGetRecord() if $self; if (!$rec) { @@ -234,10 +234,6 @@ sub CustomerInfo { my $referral = qsearchs('part_referral', { refnum => $cust_main->refnum }); my @part_tags = $cust_main->part_tag; - my @lf = $cust_main->location_fields; - my $bill_location = $cust_main->bill_location; - my $ship_location = $cust_main->ship_location; - my $info = { %$rec, @@ -254,13 +250,18 @@ sub CustomerInfo { BillingType => FS::payby->longname($cust_main->payby), }; + my @lf = $cust_main->location_fields; + my $bill_location = $cust_main->bill_location; + my $ship_location = $cust_main->ship_location; + foreach my $field (@lf) { - $info->{"bill_$field"} = $bill_location->get($field); - $info->{"ship_$field"} = $ship_location->get($field); + $info->{"bill_$field"} = $bill_location->get($field) if $bill_location; + $info->{"ship_$field"} = $ship_location->get($field) if $ship_location; } - $info->{"bill_location"} = $bill_location->location_label(no_prefix => 1); - $info->{"ship_location"} = $ship_location->location_label(no_prefix => 1); - + $info->{"bill_location"} = $bill_location->location_label(no_prefix => 1) + if $bill_location; + $info->{"ship_location"} = $ship_location->location_label(no_prefix => 1) + if $ship_location; return $self->{CustomerInfo} = $info; } @@ -268,16 +269,27 @@ sub CustomerInfo { sub ServiceInfo { my $self = shift; $self->{fstable} eq 'cust_svc' or return; + return $self->{ServiceInfo} if $self->{ServiceInfo}; + my $rec = $self->_FreesideGetRecord() or return; my $cust_svc = $rec->{'_object'}; my $svc_x = $cust_svc->svc_x; my $part_svc = $cust_svc->part_svc; - return $self->{ServiceInfo} ||= { + my $locationnum = $cust_svc->cust_pkg->locationnum; + my $cust_location = qsearchs('cust_location', { locationnum => $locationnum}); + my @lf = FS::cust_main->location_fields; + + # location fields are not prefixed + my $info = { $cust_svc->hash, $svc_x->hash, + $cust_location->hash, ServiceType => $part_svc->svc, Label => $self->AsString, - } + }; + $info->{'location'} = $cust_location->location_label(no_prefix => 1); + + return $self->{ServiceInfo} = $info; } 1;