summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rt/lib/RT/URI/freeside/Internal.pm36
-rw-r--r--rt/share/html/Ticket/Elements/Customers10
2 files changed, 34 insertions, 12 deletions
diff --git a/rt/lib/RT/URI/freeside/Internal.pm b/rt/lib/RT/URI/freeside/Internal.pm
index b0962860d..5dc92d421 100644
--- a/rt/lib/RT/URI/freeside/Internal.pm
+++ b/rt/lib/RT/URI/freeside/Internal.pm
@@ -152,6 +152,9 @@ sub AsStringLong {
if ( $table eq 'cust_main' ) {
my $rec = $self->_FreesideGetRecord();
+ if (!$rec) {
+ return '<I>Customer #'.$self->{'fspkey'}.' (not found)</I>';
+ }
return '<A HREF="' . $self->HREF . '">' .
small_custview( $rec->{'_object'},
scalar(FS::Conf->new->config('countrydefault')),
@@ -192,21 +195,38 @@ sub CustomerResolver {
}
elsif ( $self->{fstable} eq 'cust_svc' ) {
my $rec = $self->_FreesideGetRecord();
- return if !$rec;
- my $cust_pkg = $rec->{'_object'}->cust_pkg;
- if ( $cust_pkg ) {
- my $URI = RT::URI->new($self->CurrentUser);
- $URI->FromURI('freeside://freeside/cust_main/'.$cust_pkg->custnum);
- return $URI->Resolver;
+ if ($rec) {
+ my $cust_pkg = $rec->{'_object'}->cust_pkg;
+ if ( $cust_pkg ) {
+ my $URI = RT::URI->new($self->CurrentUser);
+ $URI->FromURI('freeside://freeside/cust_main/'.$cust_pkg->custnum);
+ return $URI->Resolver;
+ }
}
+ return;
}
return;
}
sub CustomerInfo {
my $self = shift;
- $self = $self->CustomerResolver or return;
- my $rec = $self->_FreesideGetRecord() or return;
+ $self = $self->CustomerResolver;
+ my $rec;
+ my $rec = $self->_FreesideGetRecord() if $self;
+ if (!$rec) {
+ # AsStringLong will report an error;
+ # here, just avoid breaking things
+ my $error = {
+ AgentName => '',
+ CustomerClass => '',
+ CustomerTags => [],
+ Referral => '',
+ InvoiceEmail => '',
+ BillingType => '',
+ };
+ return $error;
+ }
+
my $cust_main = delete $rec->{_object};
my $agent = $cust_main->agent;
my $class = $cust_main->cust_class;
diff --git a/rt/share/html/Ticket/Elements/Customers b/rt/share/html/Ticket/Elements/Customers
index d90ef1c44..fed678380 100644
--- a/rt/share/html/Ticket/Elements/Customers
+++ b/rt/share/html/Ticket/Elements/Customers
@@ -43,10 +43,12 @@ while (my $link = $customers->Next) {
} elsif ( $uri =~ /cust_svc\/(\d+)/ ) {
my $svc = $link->TargetURI->Resolver;
my $cust = $svc->CustomerResolver;
- my $custnum = $cust->{fspkey};
- $cust_main{$custnum} ||= $cust;
- $cust_svc{$custnum} ||= [];
- push @{$cust_svc{$custnum}}, $svc;
+ if ( $cust ) {
+ my $custnum = $cust->{fspkey};
+ $cust_main{$custnum} ||= $cust if $cust;
+ $cust_svc{$custnum} ||= [];
+ push @{$cust_svc{$custnum}}, $svc if $svc;
+ }
}
}
@custnums = sort { $a <=> $b } keys %cust_main;