[Rt-commit] rt branch, 4.4/queue-include-article, updated. rt-4.4.2-61-g84143cf

Craig Kaiser craig at bestpractical.com
Wed Jan 3 11:03:15 EST 2018


The branch, 4.4/queue-include-article has been updated
       via  84143cf6468f0ea6da4e290e9669dde568fbcaba (commit)
      from  94acd171de899771aa7e76c102780a99aad2d423 (commit)

Summary of changes:
 lib/RT/Queue.pm  | 5 +++++
 lib/RT/Ticket.pm | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 84143cf6468f0ea6da4e290e9669dde568fbcaba
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Wed Jan 3 11:00:39 2018 -0500

    Articles can be set in config per Queue
    
    Can set the Queues and their Artciles to include in RT_SiteConfig.pm.

diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 17a5bda..bd2308f 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -942,6 +942,11 @@ The ID value of the article will be loaded from the name, and used to get the ar
 ==head2 SetArticleIncluded
 
 Takes a name value and sets the ArticleIncluded attr for the queue to that name.
+Can also set the article to be included in RT_SiteConfig.pm:
+    Set(%ArticleIncluded,
+        'MyQueue'   =>  'MyArticle',
+        'General'   =>  'General Info'
+    );
 
 =head2 SubjectTag
 
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 418a2bb..808b127 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -281,11 +281,15 @@ sub Create {
         $args{'Status'} = $cycle->DefaultOnCreate;
     }
 
-    if ( $QueueObj->ArticleIncluded ) {
+    my %config = RT->Config->Get('ArticleIncluded');
+    if ( $QueueObj->ArticleIncluded || exists($config{$QueueObj->Name})) {
         my $MyArticle = RT::Article->new(RT->SystemUser);
+        if ( $MyArticle->ValidateName($config{$QueueObj->Name}) and $config{$QueueObj->Name} ) {
+            return (0, 0, "Invalid Article Name: $config{$QueueObj->Name}, check your RT_SiteConfig.pm");
+        }
         my $ObjectCustomFieldValue = RT::ObjectCustomFieldValue->new(RT->SystemUser);
         my $MIMEObj = $args{'MIMEObj'};
-        $MyArticle->LoadByCols(Name => $QueueObj->ArticleIncluded);
+        $MyArticle->LoadByCols(Name => $QueueObj->ArticleIncluded ? $QueueObj->ArticleIncluded : $config{$QueueObj->Name} );
         $ObjectCustomFieldValue->LoadByCols(ObjectId => $MyArticle->id);
         my $ArticleContent = MIME::Entity->build( Type => "text/plain" , Data => $ObjectCustomFieldValue->Content() );
         $MIMEObj->add_part($ArticleContent);

-----------------------------------------------------------------------


More information about the rt-commit mailing list