[rt-users] Original request on Resolve page
Matt Zagrabelny
mzagrabe at d.umn.edu
Wed Jun 22 09:43:48 EDT 2016
On Tue, Jun 21, 2016 at 4:56 AM, Guadagnino Cristiano
<guadagnino.cristiano at creval.it> wrote:
> Hi all,
> we thought it would be nice to be able to see the original request when
> resolving a ticket.
>
> Does anybody know how to implement this (or maybe someone already did)?
I'm not sure if there is anything in "core" for this, but I hacked
something together years ago. I'm not sure if I'd choose the same code
to accomplish the feat now, but this works in our environment:
package RT::Ticket;
no warnings qw(redefine);
use Text::Trim;
use Carp;
sub Problem {
my $self = shift;
my %args = (
return_not_determined => 1,
Type => '',
@_,
);
my $transactions = $self->Transactions;
while (my $transaction = $transactions->Next) {
if (($transaction->Type || q{}) eq 'Create') {
my $content = trim(
$transaction->Content(
Type => $args{Type},
)
);
return $content if $self->IsProblemOkay(problem => $content);
}
}
my $subject = trim($self->Subject);
return $subject if $self->IsProblemOkay(problem => $subject);
if ($args{return_not_determined}) {
return 'Problem not determined.';
}
else {
return q{};
}
}
sub IsProblemOkay {
my $self = shift;
my %args = (
problem => undef,
@_,
);
return (defined $args{problem} && $args{problem} =~ /\S/);
}
You'll need to hijack the RT::Ticket namespace to add those
subroutines. Then you can use it in templates and other places like:
$Ticket->Problem
HTH,
-m
> Thank you in advance
> Cris
> ---------
> RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
> * Los Angeles - September, 2016
More information about the rt-users
mailing list