summaryrefslogtreecommitdiff
path: root/rt/etc/initialdata
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-10-27 12:12:23 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-10-27 12:12:23 -0400
commit221ec4469fe66fe3f2a91122d887525b0a49fbe6 (patch)
tree3f7739a0067c0a23a5a872ce16c8a795da24fa5b /rt/etc/initialdata
parent72a0a28efb317980aeec19462f197052c44a0e68 (diff)
RT# 75628 - Added AutoreplyOrCorrespondence template to freeside core RT.
Diffstat (limited to 'rt/etc/initialdata')
-rw-r--r--rt/etc/initialdata104
1 files changed, 104 insertions, 0 deletions
diff --git a/rt/etc/initialdata b/rt/etc/initialdata
index 9085050..aa2010f 100644
--- a/rt/etc/initialdata
+++ b/rt/etc/initialdata
@@ -319,6 +319,110 @@ you may reply to this message.</p>
],
},
{ Queue => '0',
+ Name => 'AutoreplyOrCorrespondence', # loc
+ Description => 'Plaintext AutoreplyOrCorrespondence template', # loc
+ Content => q[{
+ use RT::Template;
+ my $creator_name = $Ticket->CreatorObj->Name;
+ my $requestors = $Ticket->Requestors->UserMembersObj;
+ my ( $c_requestor, $r_count ) = ( 0, 0 );
+ while ( my $r = $requestors->Next() ) {
+ if ( $r->Name eq $creator_name ) {
+ $c_requestor++;
+ }
+ else {
+ $r_count++;
+ }
+ }
+ my $template = new RT::Template($RT::SystemUser);
+ my $template_name;
+
+ #if the creator is not a requestor or
+ #there is more than one requestor ( who's not the creator )
+ #use the Correspondence template
+ if ( ! $c_requestor || $r_count ) {
+ $template_name = 'Correspondence';
+ }
+ else {
+ #otherwise use the Autoreply template
+ $template_name = 'Autoreply';
+ }
+
+ #Load the Queue Template
+ $template->LoadQueueTemplate(
+ Queue => $Ticket->Queue,
+ Name => $template_name,
+ );
+ #if there's no Queue Template attempt to find a Global one.
+ unless ( $template->id ) {
+ $template->LoadGlobalTemplate( $template_name );
+ unless ( $template->id ) {
+ $RT::Logger->error("Could not load template : $template_name")
+ }
+ }
+ #Process embedded fields & expressions of true templates;
+ #note that we can only meaningfully use the body
+ my($ret, $msg) = $template->Parse(
+ TicketObj => $Ticket,
+ TransactionObj => $Transaction,
+ );
+ $ret ? $template->MIMEObj->stringify : $msg;
+ }
+],
+ },
+ { Queue => '0',
+ Name => 'AutoreplyOrCorrespondence in HTML', # loc
+ Description => 'HTML AutoreplyOrCorrespondence template', # loc
+ Content => q[{
+ use RT::Template;
+ my $creator_name = $Ticket->CreatorObj->Name;
+ my $requestors = $Ticket->Requestors->UserMembersObj;
+ my ( $c_requestor, $r_count ) = ( 0, 0 );
+ while ( my $r = $requestors->Next() ) {
+ if ( $r->Name eq $creator_name ) {
+ $c_requestor++;
+ }
+ else {
+ $r_count++;
+ }
+ }
+ my $template = new RT::Template($RT::SystemUser);
+ my $template_name;
+
+ #if the creator is not a requestor or
+ #there is more than one requestor ( who's not the creator )
+ #use the Correspondence template
+ if ( ! $c_requestor || $r_count ) {
+ $template_name = 'Correspondence in HTML';
+ }
+ else {
+ #otherwise use the Autoreply in HTML template
+ $template_name = 'Autoreply in HTML';
+ }
+
+ #Load the Queue Template
+ $template->LoadQueueTemplate(
+ Queue => $Ticket->Queue,
+ Name => $template_name,
+ );
+ #if there's no Queue Template attempt to find a Global one.
+ unless ( $template->id ) {
+ $template->LoadGlobalTemplate( $template_name );
+ unless ( $template->id ) {
+ $RT::Logger->error("Could not load template : $template_name")
+ }
+ }
+ #Process embedded fields & expressions of true templates;
+ #note that we can only meaningfully use the body
+ my($ret, $msg) = $template->Parse(
+ TicketObj => $Ticket,
+ TransactionObj => $Transaction,
+ );
+ $ret ? $template->MIMEObj->stringify : $msg;
+ }
+],
+ },
+ { Queue => '0',
Name => 'Transaction', # loc
Description => 'Plain text transaction template', # loc
Content => 'RT-Attach-Message: yes