[Rt-commit] rtir branch WIP-5.0/add-process-reference-articles created. 5.0.1-81-gc7e50ae6

BPS Git Server git at git.bestpractical.com
Wed Jul 6 19:21:17 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtir".

The branch, WIP-5.0/add-process-reference-articles has been created
        at  c7e50ae674a29145fd2f6c14f400053f6bcaeb58 (commit)

- Log -----------------------------------------------------------------
commit c7e50ae674a29145fd2f6c14f400053f6bcaeb58
Author: Brian Conry <bconry at bestpractical.com>
Date:   Wed Jul 6 14:06:56 2022 -0500

    Add portlet for incident process documentation
    
    This change adds an optional portlet (default: off) to the Incident
    display that can display an article based on an incident custom field.
    By default looks in the 'Processes' Class for the article with a Name
    that matches the value of the 'Classification' CF.
    
    Creates the 'Processes' Class if it doesn't already exist.

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 8d836ef0..7a7e7dff 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -640,6 +640,33 @@ By default RTIR enables 'httpurl_overwrite', 'ip', 'email' and 'domain'.
 
 Set(@Active_MakeClicky, qw(httpurl_overwrite ip email domain));
 
+=item C<$RTIR_ShowIncidentProcessArticles>
+
+Controls the display of a "process documentation" portlet on incidents.
+
+When active, and the incident custom field specified by
+C<$RTIR_ProcessDocumentCriteriaCF> matches the name of an article in the
+C<$RTIR_ProcessDocumentationClass> class, that article will be displayed in a
+portlet on the incident as guidance for the user.
+
+By default RTIR does not show this portlet.
+
+=cut
+
+Set($RTIR_ShowIncidentProcessArticles, 0);
+
+=item C<$RTIR_ProcessDocumentationClass>
+
+This is the name of Class that the articles must be in to be found and
+displayed as process documentation when C<$RTIR_ShowIncidentProcessArticles> is
+set.
+
+Defaults to 'Processes'
+
+=cut
+
+Set($RTIR_ProcessDocumentationClass, 'Processes');
+
 =back
 
 =head1 Custom Fields
@@ -721,6 +748,17 @@ that are not included in L<Net::Domain::TLD> yet. It's true by default.
 
 Set($RTIR_StrictDomainTLD, 1);
 
+=item C<$RTIR_ProcessDocumentCriteriaCF>
+
+This is the name of the incident custom field that will be used to look up an
+article to display when C<$RTIR_ShowIncidentProcessArticles> is set.
+
+Defaults to 'Classification'.
+
+=cut
+
+Set($RTIR_ProcessDocumentCriteriaCF, 'Classification');
+
 =back
 
 =head1 Countermeasures
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index e384faa2..698a764c 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -306,6 +306,15 @@
 
 <& /RTIR/Elements/ShowCVEDetails, Ticket => $TicketObj &>
 
+% if ( RT->Config->Get('RTIR_ShowIncidentProcessArticles') ) {
+    <& /Elements/ArticleContentAsPortlet,
+        PortletTitle   => 'Incident Process',
+        ArticleObj     => $ProcessArticleObj,
+        ContentIfEmpty => 'No documentation available',
+        TitleClass     => 'ticket-info-reminders',
+    &>
+% }
+
 % $m->callback( %ARGS, Ticket => $TicketObj, CallbackName => 'RightColumnEnd' );
   </div>
 </div>
@@ -528,6 +537,25 @@ my $attachments = $TicketObj->Attachments;
 $TicketObj->CurrentUser->AddRecentlyViewedTicket($TicketObj)
     if $TicketObj->CurrentUser->can('AddRecentlyViewedTicket');
 
+my $ProcessArticleObj;
+
+if ( RT->Config->Get('RTIR_ShowIncidentProcessArticles') ) {
+    my $Criteria = $TicketObj->FirstCustomFieldValue( RT->Config->Get('RTIR_ProcessDocumentCriteriaCF' ));
+
+    if ( $Criteria ) {
+        my $ArticleClass = RT::Class->new( $session{CurrentUser} );
+        $ArticleClass->LoadByCols( Name => RT->Config->Get('RTIR_ProcessDocumentationClass') );
+
+        if ( $ArticleClass->Id ) {
+            my $Articles = RT::Articles->new( $session{CurrentUser} );
+            $Articles->Limit( FIELD => "Class", VALUE => $ArticleClass->Id );
+            $Articles->Limit( FIELD => "Name", VALUE => $Criteria );
+
+            $ProcessArticleObj = $Articles->First;
+        }
+    }
+}
+
 </%INIT>
 
 <%ARGS>

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


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list