[freeside-commits] branch FREESIDE_3_BRANCH updated. e171647bc34d730d982c0e08d9731bbeb414be31
Mark Wells
mark at 420.am
Fri Sep 27 13:12:32 PDT 2013
The branch, FREESIDE_3_BRANCH has been updated
via e171647bc34d730d982c0e08d9731bbeb414be31 (commit)
from d1953d60d032b0b3066704c20ff75bf8585cd32e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e171647bc34d730d982c0e08d9731bbeb414be31
Author: Mark Wells <mark at freeside.biz>
Date: Fri Sep 27 13:08:19 2013 -0700
prevent nonexistent customer links from breaking ticket display, #25063
diff --git a/rt/lib/RT/URI/freeside/Internal.pm b/rt/lib/RT/URI/freeside/Internal.pm
index b096286..5dc92d4 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 d90ef1c..fed6783 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;
-----------------------------------------------------------------------
Summary of changes:
rt/lib/RT/URI/freeside/Internal.pm | 36 ++++++++++++++++++++++++-------
rt/share/html/Ticket/Elements/Customers | 10 +++++---
2 files changed, 34 insertions(+), 12 deletions(-)
More information about the freeside-commits
mailing list