diff options
Diffstat (limited to 'rt')
-rw-r--r-- | rt/lib/RT/Interface/Web.pm | 65 | ||||
-rw-r--r-- | rt/lib/RT/URI/freeside/Internal.pm | 35 | ||||
-rw-r--r-- | rt/share/html/Ticket/Elements/Customers | 10 | ||||
-rwxr-xr-x | rt/share/html/Ticket/Update.html | 2 |
4 files changed, 68 insertions, 44 deletions
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm index 4a6bfda88..2dc16e3f3 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 b0962860d..d1479b5f9 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; 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; diff --git a/rt/share/html/Ticket/Update.html b/rt/share/html/Ticket/Update.html index 26a37e80a..8a3d8e30d 100755 --- a/rt/share/html/Ticket/Update.html +++ b/rt/share/html/Ticket/Update.html @@ -290,6 +290,7 @@ if ( $ARGS{'SubmitTicket'} ) { my %squelched = ProcessTransactionSquelching( \%ARGS ); $ARGS{'SquelchMailTo'} = [keys %squelched] if keys %squelched; +warn @{ $ARGS{'SquelchMailTo'} } if $ARGS{'SquelchMailTo'}; my $CFs = $TicketObj->TransactionCustomFields; my $ValidCFs = $m->comp( @@ -311,6 +312,7 @@ if ( $ARGS{'SubmitTicket'} ) { ); $checks_failure = 1 unless $status; } +warn @{ $ARGS{'SquelchMailTo'} } if $ARGS{'SquelchMailTo'}; # check email addresses for RT's { |