Different signature per queue


#1

Trying to make different signature per queue. Don’t want to use templates
but $SignatureAboveQuote.

I understand this can be done by changing html/Elements/MessageBox. Didn’t
find some callback for this.

Want to do something like:

if ($Ticket->QueueObj->Name contains “first”)
$signature = “first signature”;
else
if ($Ticket->QueueObj->Name contains “second”)
$signature = “second signature”;

Wondering how to access $Ticket->QueueObj->Name within MessageBox? Thanks in
advance.


#2

Le 08/11/2016 � 11:18, John Angel a �crit :

Trying to make different signature per queue. Don’t want to use templates
but $SignatureAboveQuote.

Here I use the callback
rt/local/html/Callbacks/MyCompany/Elements/MessageBox/Default with the
following content:

<%INIT>

Use queue template “Signature” as signature if any, overwise, use the

currentuser’s one
if ( $id ) {
my $SystemTicket = RT::Ticket->new( $RT::SystemUser );
$SystemTicket->Load( $id );
my $QueueSignature = RT::Template->new( $RT::SystemUser );
my ($val, $msg) = $QueueSignature->LoadQueueTemplate( Queue =>
$SystemTicket->QueueObj->Id, Name => ‘Signature’ );
if ( $val && $QueueSignature->Content ) {
my ($queue_signature, ) =
$QueueSignature->_ParseContent(TicketObj => $SystemTicket);
$queue_signature =~ s!^\sContent-Type\s:\s+(.)\s$!!mi;
my $ContentType = $1 || ’ text/plain’;
if ( $ContentType eq ‘text/html’ ) {
$$SignatureRef = "--
" . $queue_signature;
} else {
$$SignatureRef = “-- \n” . $queue_signature;
}
} else {
$RT::Logger->info(“Unable to load queue template
signature: $msg”);
}
}
</%INIT>
<%ARGS>
$SignatureRef => undef
$id => undef
</%ARGS>

you need to setup a template named “Signature” on queue where you wan’t
queue signature, then the above code will use this signature in place of
user one.

If you don’t wan’t to use a template, you can use above code as example
to access ticket queue name.

(it’s on RT 4.2, but should work on 4.4)


#3

Here I use the callback
rt/local/html/Callbacks/MyCompany/Elements/MessageBox/Default with the
following content:

That’s great help and works like a charm, many thanks Emmanuel.


#4

Le 10/11/2016 � 14:49, John Angel a �crit :

Here I use the callback
rt/local/html/Callbacks/MyCompany/Elements/MessageBox/Default with the
following content:
That’s great help and works like a charm, many thanks Emmanuel.

nice to hear :slight_smile:

Easter-eggs Sp�cialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - M�tro Gait�
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com


#5

It is working fine, but I can’t add embedded image in the template.
Whole img tag is just missing from the signature in the ticket.

In /opt/rt4/local/lib/RT/Interface/Web_Local.pm IMG and ALT attributes are added to @SCRUBBER_ALLOWED_TAGS

Image is something like:
<img width=133 height=55 style="width:1.3888in;height:.5694in" alt="logo.png" src="data:image/png;base64,ENCODEDDATA">

Even without width, height and style image is not shown.