Mailing List Archive

Different signature per queue
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.


---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017
Re: Different signature per queue [ In reply to ]
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!^\s*Content-Type\s*:\s+(.*)\s*$!!mi;
my $ContentType = $1 || ' text/plain';
if ( $ContentType eq 'text/html' ) {
$$SignatureRef = "-- <br />" . $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)
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017
Re: Different signature per queue [ In reply to ]
> 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.


---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017
Re: Different signature per queue [ In reply to ]
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 :)

--
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

---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017