summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-10-08 23:00:26 -0700
committerIvan Kohler <ivan@freeside.biz>2013-10-08 23:00:26 -0700
commitfe4515eb37d76849dd08c62782d86bc7ba311dcd (patch)
tree6952cc3598de0c72b6a3eab1d53bde07a16c27f2 /rt/lib
parentf2766e203e1aa144d046a26cf13e01e1f5b00f64 (diff)
parent81ae0992cf8506c6a77485548ebde25eb946a9a9 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts: FS/FS/cust_main.pm
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/RT/Interface/Web.pm65
-rw-r--r--rt/lib/RT/URI/freeside/Internal.pm35
2 files changed, 60 insertions, 40 deletions
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
index 4a6bfda..2dc16e3 100644
--- a/rt/lib/RT/Interface/Web.pm
+++ b/rt/lib/RT/Interface/Web.pm
@@ -2070,7 +2070,6 @@ sub _ProcessUpdateMessageRecipients {
if (grep $_ eq 'Requestor' || $_ eq 'Requestors', @{ $args{ARGSRef}->{'SkipNotification'} || [] }) {
push @txn_squelch, map $_->address, Email::Address->parse( $message_args->{Requestor} );
push @txn_squelch, $args{TicketObj}->Requestors->MemberEmailAddresses;
-
}
push @txn_squelch, @{$args{ARGSRef}{SquelchMailTo}} if $args{ARGSRef}{SquelchMailTo};
@@ -2092,6 +2091,39 @@ sub _ProcessUpdateMessageRecipients {
}
}
+sub ProcessAttachments {
+ my %args = (
+ ARGSRef => {},
+ @_
+ );
+
+ my $ARGSRef = $args{ARGSRef} || {};
+ # deal with deleting uploaded attachments
+ foreach my $key ( keys %$ARGSRef ) {
+ if ( $key =~ m/^DeleteAttach-(.+)$/ ) {
+ delete $session{'Attachments'}{$1};
+ }
+ $session{'Attachments'} = { %{ $session{'Attachments'} || {} } };
+ }
+
+ # store the uploaded attachment in session
+ if ( defined $ARGSRef->{'Attach'} && length $ARGSRef->{'Attach'} )
+ { # attachment?
+ my $attachment = MakeMIMEEntity( AttachmentFieldName => 'Attach' );
+
+ my $file_path = Encode::decode_utf8("$ARGSRef->{'Attach'}");
+ $session{'Attachments'} =
+ { %{ $session{'Attachments'} || {} }, $file_path => $attachment, };
+ }
+
+ # delete temporary storage entry to make WebUI clean
+ unless ( keys %{ $session{'Attachments'} } and $ARGSRef->{'UpdateAttach'} )
+ {
+ delete $session{'Attachments'};
+ }
+}
+
+
=head2 MakeMIMEEntity PARAMHASH
Takes a paramhash Subject, Body and AttachmentFieldName.
@@ -2174,37 +2206,6 @@ sub MakeMIMEEntity {
}
-sub ProcessAttachments {
- my %args = (
- ARGSRef => {},
- @_
- );
-
- my $ARGSRef = $args{ARGSRef} || {};
- # deal with deleting uploaded attachments
- foreach my $key ( keys %$ARGSRef ) {
- if ( $key =~ m/^DeleteAttach-(.+)$/ ) {
- delete $session{'Attachments'}{$1};
- }
- $session{'Attachments'} = { %{ $session{'Attachments'} || {} } };
- }
-
- # store the uploaded attachment in session
- if ( defined $ARGSRef->{'Attach'} && length $ARGSRef->{'Attach'} )
- { # attachment?
- my $attachment = MakeMIMEEntity( AttachmentFieldName => 'Attach' );
-
- my $file_path = Encode::decode_utf8("$ARGSRef->{'Attach'}");
- $session{'Attachments'} =
- { %{ $session{'Attachments'} || {} }, $file_path => $attachment, };
- }
-
- # delete temporary storage entry to make WebUI clean
- unless ( keys %{ $session{'Attachments'} } and $ARGSRef->{'UpdateAttach'} )
- {
- delete $session{'Attachments'};
- }
-}
=head2 ParseDateToISO
diff --git a/rt/lib/RT/URI/freeside/Internal.pm b/rt/lib/RT/URI/freeside/Internal.pm
index b096286..d1479b5 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,37 @@ 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 = $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;