[Rt-commit] rtir branch, 5.0/restore-incidents-and-investigations-on-create, created. 4.0.1rc1-147-g81ddc507

Aaron Trevena ast at bestpractical.com
Fri Jun 12 09:32:24 EDT 2020


The branch, 5.0/restore-incidents-and-investigations-on-create has been created
        at  81ddc5076047340ce3cf2ffc68a807d0bec874f7 (commit)

- Log -----------------------------------------------------------------
commit fb4aafbec37a6c01ae7d38426e6f24077675904f
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Mon May 18 14:26:14 2020 -0500

    Core RT::Extension::CreateIncidentAndInvestigation
    
    This commit moves the RT::Extension::CreateIncidentAndInvestigation
    extension back to core RTIR.
    
    The code was removed in commit 5f72e57 due to complexity which has
    since been solved by moving the dropdown to the create pages.

diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index a4ecd5a6..d8510d3f 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -313,6 +313,19 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
 
 </div>  <!-- end ticket-create-incident -->
 
+<div id="ticket-create-investigation">
+<a name="investigation"></a>
+<& /RTIR/Investigation/Elements/Create,
+    %ARGS,
+    NamePrefix => 'Investigation',
+    QueueObj => $InvestigationsQueueObj,
+    Lifecycle => RT::IR->lifecycle_investigation,
+    Constituency => $constituency,
+    SkipField => { Owner => 1, Attachments => 1, DateFields => 1 },
+    IncludeSignature => (exists $ARGS{'InvestigationContent'} ? 0 : 1),
+&>
+</div>
+
 % $m->callback( CallbackName => 'FormEnd', QueueObj => $QueueObj, Constituency => $constituency,
 %    ChildObj => $ChildObj, SplitObj => $SplitObj, ARGSRef => \%ARGS );
 
@@ -400,6 +413,12 @@ if (!$QueueObj->Name) {
 Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
  }
 
+# Load appropriate Investigations queue
+my $InvestigationsQueue = 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
+my $InvestigationsQueueObj = RT::Queue->new( $session{'CurrentUser'} );
+my ($ret, $msg) = $InvestigationsQueueObj->Load( $InvestigationsQueue );
+RT->Logger->error("Unable to load $InvestigationsQueue : $msg") unless $ret;
+
 if( !RT::IR->IsIncidentQueue($QueueObj) ) {
     RT::Interface::Web::Redirect(RT::IR->HREFTo( '/Create.html?' . $m->comp('/Elements/QueryString', %ARGS )));
 }
@@ -450,6 +469,23 @@ if ( $CreateIncident ) {
     );
 }
 
+if ( $CreateWithInvestigation ) {
+        $checks_failure += RT::IR->FilterRTAddresses(
+            ARGSRef => \%ARGS,
+            Fields => {
+                InvestigationRequestors => 'Requestor',
+                InvestigationCc => 'Cc',
+                InvestigationAdminCc => 'AdminCc',
+            },
+            results => @results,
+        );
+}
+
+if ( $CreateWithInvestigation && !$InvestigationRequestors ) {
+    push @results, loc( "You must enter a correspondent for the investigation" );
+    $checks_failure = 1;
+}
+
 $m->callback( CallbackName => 'BeforeCreateRedirect', ARGSRef => \%ARGS,
     Child => $ChildObj, results => \@results, checks_failure => \$checks_failure );
 
@@ -465,6 +501,26 @@ if ( !$checks_failure && $CreateIncident ) {
     push @results, @tmp;
 
     if( $inc_obj ) {
+        my $inv_obj;
+        if ( $CreateWithInvestigation ) {
+            my (@tmp);
+            ($inv_obj, @tmp) = $m->comp(
+                '/RTIR/Investigation/Elements/Create:Process',
+                %ARGS,
+                NamePrefix => 'Investigation',
+                DefaultsNamePrefix => '',
+            );
+            push @results, @tmp;
+            if ( $inv_obj ) {
+                my($id, $msg) = $inv_obj->AddLink(
+                    Type => 'MemberOf',
+                    Target => $inc_obj->id
+                );
+                #XXX: correct message on success
+                push @results, $msg if !$id || $msg;
+            }
+        }
+
         $m->callback(CallbackName => 'BeforeDisplay', ARGSRef => \%ARGS, Child => $ChildObj, TicketObj => $inc_obj,
             results => \@results );
 
@@ -506,7 +562,9 @@ unless ( exists $ARGS{'Content'} ) {
 $Title                   => loc("Create a new Incident")
 $QuoteTransaction        => undef
 
-$CreateIncident          => 0
+$CreateWithInvestigation => 0
+$CreateIncident          => $CreateWithInvestigation
+$InvestigationRequestors => 0
 
 $Split                   => undef
 
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 69d5680b..351668c1 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -212,6 +212,13 @@ email addresses. These people <b>will</b> receive future updates.)</&></font></i
 % }
 
 </table></&>
+
+<& /Elements/Submit,
+    Name => 'CreateWithInvestigation',
+    Label => loc("Create Incident and run Investigation"),
+    SubmitId => 'create-ticket-with-investigation'
+&>
+
 % $m->callback( CallbackName => 'AfterTable', ARGSRef => \%ARGS, TicketObj  => $ticket,
 %    QueueObj   => $QueueObj, DefaultsFrom => $TicketObj );
 </div>

commit 6b6ff8c147972dc52180229706562140c2b1cdf7
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Mon May 18 19:05:39 2020 -0500

    Migrate Investigation/Elements/Create to elevator themes

diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 351668c1..f0cb7d37 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -50,60 +50,95 @@
 
 <div class="ticket-create-basics">
 <&| /Widgets/TitleBox, title => loc("Basics"), class => 'ticket-info-basics' &>
-<table width="100%" border="0">
-% if($Constituency) {
-%
-<tr class="constituency">
-  <td class="label"><%loc('Constituency') %>:</td>
-  <td><% $Constituency %></td>
-</tr>
+
+% if ($Constituency) {
+  <div class="form-row">
+    <div class="label col-3">
+      <% loc('Constituency') %>:
+    </div>
+    <div class="value col-9">
+      <span class="current-value"><% $Constituency %></span>
+    </div>
+  </div>
 % }
-<tr class="queue">
-  <td class="label"><&|/l&>Queue</&>:</td>
-  <td>
+
+  <div class="form-row">
+    <div class="label col-3">
+      <&|/l&>Queue</&>:
+    </div>
+    <div class="value col-9">
       <& /Ticket/Elements/ShowQueue, QueueObj => $QueueObj &>
-  </td>
-</tr>
+    </div>
+  </div>
+
 % unless ( $SkipField{'Owner'} || $HideField{'Owner'} ) {
-<tr>
-    <td class="label"><&|/l&>Owner</&>:</td>
-    <td class="value"><& /Elements/SelectOwner,
-    Name     => $NamePrefix ."Owner",
-    QueueObj => $QueueObj,
-    Default  => $value_cb->('Owner') || $session{'CurrentUser'}->Id,
-&></td></tr>
+  <div class="form-row owner">
+    <div class="label col-3">
+      <&|/l&>Owner</&>:
+    </div>
+    <div class="value col-9">
+      <& /Elements/SelectOwner,
+          Name     => $NamePrefix ."Owner",
+          QueueObj => $QueueObj,
+          Default  => $value_cb->('Owner') || $session{'CurrentUser'}->Id,
+      &>
+    </div>
+  </div>
 % }
 
 % unless ( $SkipField{'TimeFields'} ) {
-<tr class="time-worked">
-    <td class="label"><&|/l&>Time Worked</&>:</td>
-    <td class="value"><& /Elements/EditTimeValue,
-        Name => $NamePrefix .'TimeWorked',
+<div class="form-row">
+  <div class="label col-3">
+    <&|/l&>Time Worked</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/EditTimeValue,
+        Name    => $NamePrefix . 'TimeWorked',
         Default => $value_cb->('TimeWorked') || '',
-    &></td>
-    </tr>
-<tr class="time-left">
-    <td class="label"><&|/l&>Time Left</&>:</td>
-    <td class="value"><& /Elements/EditTimeValue,
-        Name => $NamePrefix .'TimeLeft',
+    &>
+  </div>
+</div>
+<div class="form-row">
+  <div class="label col-3">
+    <&|/l&>Time Left</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/EditTimeValue,
+        Name    => $NamePrefix . 'TimeLeft',
         Default => $value_cb->('TimeLeft') || '',
-    &></td>
-</tr>
+    &>
+  </div>
+</div>
 % }
 
 % unless ( $SkipField{'DateFields'} ) {
-<tr><td> </td><td valign="top"><&| /Widgets/TitleBox,
-    title => loc("Dates"),
-    class=> 'ticket-info-dates',
-&><table>
-
-<tr><td class="label"><&|/l&>Starts</&>:</td>
-<td class="value"><& /Elements/SelectDate, Name => $NamePrefix .'Starts', Default => $value_cb->('Starts') || '' &></td></tr>
+<&| /Widgets/TitleBox, title => loc("Dates"), class => 'ticket-info-dates' &>
+
+<div class="form-row">
+  <div class="label col-3">
+    <&|/l&>Starts</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/SelectDate,
+        Name    => $NamePrefix . 'Starts',
+        Default => $value_cb->('Starts') || '',
+    &>
+  </div>
+</div>
 
-<tr><td class="label"><&|/l&>Due</&>:</td>
-<td class="value"><& /Elements/SelectDate, Name => $NamePrefix .'Due', Default => $value_cb->('Due') || '' &></td></tr>
+<div class="form-row">
+  <div class="label col-3">
+    <&|/l&>Due</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/SelectDate,
+        Name    => $NamePrefix . 'Due',
+        Default => $value_cb->('Due') || '',
+    &>
+  </div>
+</div>
 
-</table></&></td></tr>
+</&>
 % }
 
 % if ( ($QueueObj || $TicketObj) && !$SkipField{'CustomFields'} ) {
@@ -118,7 +153,7 @@
 &>
 % }
 
-</table></&>
+</&>
 
 % if ( ($QueueObj || $TicketObj) && !$SkipField{'CustomFields'} ) {
 <& /Elements/EditCustomFieldCustomGroupings,
@@ -134,90 +169,141 @@
 
 <div class="ticket-create-details">
 <&| /Widgets/TitleBox,
-    title => loc("Launch Investigation"),
+    title => loc("Launch a new investigation"),
     class => 'ticket-info-message',
 &>
-<table width="100%" border="0">
 
 % unless ( $SkipField{'Requestors'} || $HideField{'Requestors'} ) {
-<tr><td class="label"><&|/l&>Correspondents</&>:</td>
-<td class="value"><& /Elements/EmailInput,
-    Name => $NamePrefix .'Requestors', Default => $value_cb->('Requestors'), Size => undef,
-&></td></tr>
+<div class="form-row">
+  <div class="label col-2">
+    <&|/l&>Correspondents</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/EmailInput,
+        Name    => $NamePrefix . 'Requestors',
+        Default => $value_cb->('Requestors'),
+        Size    => undef,
+    &>
+  </div>
+</div>
 % $m->callback( CallbackName => 'AfterRequestors', ARGSRef => \%ARGS );
 % }
 
 % unless ( $SkipField{'Cc'} || $HideField{'Cc'} ) {
-<tr><td class="label"><&|/l&>Cc</&>:</td>
-<td class="value"><& /Elements/EmailInput,
-    Name => $NamePrefix .'Cc', Default => $value_cb->('Cc'), Size => undef,
-&></td></tr>
-<tr><td> </td><td class="comment">
-<i><font size="-2"><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of
-email addresses. These people <b>will</b> receive future updates.)</&></font></i>
-</td></tr>
+<div class="form-row">
+  <div class="label col-2">
+    <&|/l&>Cc</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/EmailInput,
+        Name    => $NamePrefix . 'Cc',
+        Default => $value_cb->('Cc'),
+        Size    => undef,
+    &>
+  </div>
+</div>
+
+<div class="form-row">
+  <div class="label col-2"></div>
+  <div class="value col-9">
+    <i><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&></i>
+  </div>
+</div>
 % }
 
 % unless ( $SkipField{'AdminCc'} && $HideField{'AdminCc'} ) {
-<tr><td class="label"><&|/l&>Admin Cc</&>:</td>
-<td class="value"><& /Elements/EmailInput,
-    Name => $NamePrefix .'AdminCc', Default => $value_cb->('AdminCc'), Size => undef,
-&></td></tr>
-<tr><td> </td><td class="comment">
-<i><font size="-2"><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative
-email addresses. These people <b>will</b> receive future updates.)</&></font></i>
-</td></tr>
+<div class="form-row">
+  <div class="label col-2">
+    <&|/l&>Admin Cc</&>:
+  </div>
+  <div class="value col-9">
+    <& /Elements/EmailInput,
+        Name    => $NamePrefix . 'AdminCc',
+        Default => $value_cb->('AdminCc'),
+        Size    => undef,
+    &>
+  </div>
+</div>
+
+<div class="form-row">
+  <div class="label col-2"></div>
+  <div class="value col-9">
+    <i><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&></i>
+  </div>
+</div>
 % }
 
 % unless ( $SkipField{'Subject'} || $HideField{'Subject'} ) {
-<tr><td class="label"><&|/l&>Subject</&>:</td>
-<td class="value">
-<input type="text" name="<% $NamePrefix %>Subject" size="60" maxsize="100" value="<% $value_cb->('Subject') %>" />
-</td></tr>
+<div class="form-row">
+  <div class="form-group label col-2">
+    <&|/l&>Subject</&>:
+  </div>
+  <div class="form-group value col-9">
+    <input class="form-control" type="text" name="<% $NamePrefix %>Subject" value="<% $value_cb->('Subject') %>" />
+  </div>
+</div>
 % }
 
 % if ( !$SkipField{'SignEncrypt'} && RT->Config->Get('GnuPG')->{'Enable'} ) {
-<tr><td> </td><td>
-<% loc('Sign')%> <& /Widgets/Form/Boolean:InputOnly,
-    Name => $NamePrefix .'Sign',
-    CurrentValue => $ARGS{ $NamePrefix .'Sign' },
-&>
-   
-<% loc('Encrypt')%> <& /Widgets/Form/Boolean:InputOnly,
-    Name => $NamePrefix .'Encrypt',
-    CurrentValue => $ARGS{ $NamePrefix .'Encrypt' },
-&>
-</td></tr>
+<div class="form-row">
+  <div class="label col-2">
+     
+  </div>
+  <div class="value col-9">
+    <div>
+      <% loc('Sign')%>
+      <& /Widgets/Form/Boolean:InputOnly,
+         Name         => $NamePrefix . 'Sign',
+         CurrentValue => $ARGS{ $NamePrefix . 'Sign' },
+      &>
+    </div>
+    <div>
+      <% loc('Encrypt')%>
+      <& /Widgets/Form/Boolean:InputOnly,
+         Name         => $NamePrefix . 'Encrypt',
+         CurrentValue => $ARGS{ $NamePrefix . 'Encrypt' },
+      &>
+    </div>
+  </div>
+</div>
 % }
 
 % unless ( $SkipField{'Content'} || $HideField{'Content'} ) {
-<tr><td class="labeltop"><&|/l&>Message</&>:</td>
-<td>
+<div class="form-group">
 % if ( RT->Config->Get('ArticleOnTicketCreate')) {
-<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj, MessageBoxName => $NamePrefix .'Content' &>
+  <& /Articles/Elements/BeforeMessageBox,
+     %ARGS,
+     QueueObj       => $QueueObj,
+     MessageBoxName => $NamePrefix . 'Content',
+  &>
 % }
-% $m->callback( %ARGS, MessageBoxName => $NamePrefix .'Content',
+% $m->callback( %ARGS, MessageBoxName => $NamePrefix . 'Content',
 %    CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
 % my $content = $value_cb->('Content');
-<& /Elements/MessageBox,
-    Name             => $NamePrefix .'Content',
-    Default          => $content,
-    IncludeSignature => exists $ARGS{'IncludeSignature'} ? $ARGS{'IncludeSignature'} : !$content,
-    QuoteTransaction => $value_cb->('QuoteTransaction'),
-&></td></tr>
+  <& /Elements/MessageBox,
+      Name             => $NamePrefix . 'Content',
+      Default          => $content,
+      IncludeSignature => exists $ARGS{'IncludeSignature'} ? $ARGS{'IncludeSignature'} : !$content,
+      QuoteTransaction => $value_cb->('QuoteTransaction'),
+  &>
+</div>
 % }
 
 % unless ( $SkipField{'Attachments'} ) {
 <& /RTIR/Create.html:AttachmentsForm &>
 % }
 
-</table></&>
+</&>
 
-<& /Elements/Submit,
-    Name => 'CreateWithInvestigation',
-    Label => loc("Create Incident and run Investigation"),
-    SubmitId => 'create-ticket-with-investigation'
-&>
+<div class="form-row">
+  <div class="col-12">
+    <& /Elements/Submit,
+        Name => 'CreateWithInvestigation',
+        Label => loc("Create Incident and run Investigation"),
+        SubmitId => 'create-ticket-with-investigation'
+    &>
+  </div>
+</div>
 
 % $m->callback( CallbackName => 'AfterTable', ARGSRef => \%ARGS, TicketObj  => $ticket,
 %    QueueObj   => $QueueObj, DefaultsFrom => $TicketObj );

commit 7ac8ea18e239f934eb998a0fef64237b5e74c7e3
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 20 17:47:16 2020 -0500

    Replace Cc and AdminCc helper text with tooltips
    
    This commit replaces the Cc and AdminCc helper text on the
    create investigation element with fontawesome icons and
    bootstrap tooltips.

diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index f0cb7d37..c918b87a 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -193,6 +193,7 @@
 <div class="form-row">
   <div class="label col-2">
     <&|/l&>Cc</&>:
+    <span class="far fa-question-circle icon-helper" data-toggle="tooltip" data-placement="top" data-original-title="<&|/l&>Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.</&>"></span>
   </div>
   <div class="value col-9">
     <& /Elements/EmailInput,
@@ -202,19 +203,13 @@
     &>
   </div>
 </div>
-
-<div class="form-row">
-  <div class="label col-2"></div>
-  <div class="value col-9">
-    <i><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&></i>
-  </div>
-</div>
 % }
 
 % unless ( $SkipField{'AdminCc'} && $HideField{'AdminCc'} ) {
 <div class="form-row">
   <div class="label col-2">
     <&|/l&>Admin Cc</&>:
+     <span class="far fa-question-circle icon-helper" data-toggle="tooltip" data-placement="top" data-original-title="<&|/l&>Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.</&>"></span>
   </div>
   <div class="value col-9">
     <& /Elements/EmailInput,
@@ -224,13 +219,6 @@
     &>
   </div>
 </div>
-
-<div class="form-row">
-  <div class="label col-2"></div>
-  <div class="value col-9">
-    <i><&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&></i>
-  </div>
-</div>
 % }
 
 % unless ( $SkipField{'Subject'} || $HideField{'Subject'} ) {

commit 3b7f1ed8de34425eb51c96c0d5853503feed73ec
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu May 21 14:45:24 2020 -0500

    Add DefaultInvestigationsQueue RTIR config option
    
    This option sets a different default investigations queue to create
    investigation tickets.

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 1f02cdcf..7a78f327 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -366,6 +366,15 @@ unless (defined $default_queue) {
     RT->Config->Set('DefaultQueue','Incident Reports');
 }
 
+=item C<$DefaultInvestigationsQueue>
+
+By default, investigation tickets will be created in the Investigations queue.
+You can set a different default investigations queue using this configuration
+option in RTIR_SiteConfig.pm.
+
+    Set( $DefaultInvestigationsQueue, 'Special Investigations' );
+
+=cut
 
 =back
 

commit a314f50a61899dbaafd4646ab8d2b4a67e16b59b
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu May 21 18:25:48 2020 -0500

    Allow investigation queue to be selected
    
    This commit updates the investigation on create element to allow
    changing the investigation queue.  Prior to this the queue was
    tied to the selected incident and couldn't be changed.
    
    Both selected incident and selected investigation now persist
    through the reload by reading the InvestigationQueue arg on post.

diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index d8510d3f..83b182ad 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -414,7 +414,7 @@ Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
  }
 
 # Load appropriate Investigations queue
-my $InvestigationsQueue = 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
+my $InvestigationsQueue = $ARGS{InvestigationQueue} || 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
 my $InvestigationsQueueObj = RT::Queue->new( $session{'CurrentUser'} );
 my ($ret, $msg) = $InvestigationsQueueObj->Load( $InvestigationsQueue );
 RT->Logger->error("Unable to load $InvestigationsQueue : $msg") unless $ret;
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index c918b87a..fd38ecfa 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -46,7 +46,6 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <input type="hidden" name="<% $NamePrefix %>Status" value="<% $ARGS{ $NamePrefix .'Status' } || $QueueObj->LifecycleObj->DefaultOnCreate %>" />
-<input type="hidden" class="hidden" name="<% $NamePrefix %>Queue" value="<% $QueueObj->Id %>" />
 
 <div class="ticket-create-basics">
 <&| /Widgets/TitleBox, title => loc("Basics"), class => 'ticket-info-basics' &>
@@ -67,7 +66,14 @@
       <&|/l&>Queue</&>:
     </div>
     <div class="value col-9">
-      <& /Ticket/Elements/ShowQueue, QueueObj => $QueueObj &>
+      <& /RTIR/Elements/SelectRTIRQueue,
+          Name => $NamePrefix . 'Queue',
+          Default => $QueueObj->Name,
+          Lifecycle => $QueueObj->Lifecycle,
+          AutoSubmit => 1,
+          ShowNullOption => 0,
+          Constituency => $Constituency
+      &>
     </div>
   </div>
 

commit b80d086cfb1f48ed0e2b8f05aa63c0d5deefe064
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu May 21 18:54:14 2020 -0500

    Use DefaultInvestigationsQueue on incident create
    
    This commit updates the investigation on create element for the
    incident create page to use the DefaultInvestigationsQueue
    config option.
    
    DefaultInvestigationsQueue will be used as the default selected
    investigation queue on page load but does not override manually
    selected investigation queues.
    
    If the user can't load DefaultInvestigationsQueue then load one
    they can SeeQueue and CreateTicket for.

diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 83b182ad..bcde447d 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -414,10 +414,31 @@ Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
  }
 
 # Load appropriate Investigations queue
-my $InvestigationsQueue = $ARGS{InvestigationQueue} || 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
+my $InvestigationsQueue = $ARGS{InvestigationQueue} || RT->Config->Get('DefaultInvestigationsQueue') || 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
 my $InvestigationsQueueObj = RT::Queue->new( $session{'CurrentUser'} );
-my ($ret, $msg) = $InvestigationsQueueObj->Load( $InvestigationsQueue );
-RT->Logger->error("Unable to load $InvestigationsQueue : $msg") unless $ret;
+$InvestigationsQueueObj->Load( $InvestigationsQueue );
+
+# Users limited by constituency may not be able to use the queue defined in DefaultInvestigationsQueue.
+# Look up what queue the user has SeeQueue and CreateTicket for and use that instead.
+unless ( $InvestigationsQueueObj->Name ) {
+    RT->Logger->debug( "Investigation Queue '$InvestigationsQueue' could not be loaded for user " . $session{'CurrentUser'}->Id . "." );
+
+    my $investigation_queues = RT::Queues->new($session{'CurrentUser'});
+
+    $investigation_queues->Limit(
+        FIELD => 'Lifecycle',
+        OPERATOR => '=',
+        VALUE => RT::IR->lifecycle_investigation,
+    );
+
+    while (my $object = $investigation_queues->Next) {
+        # Ensure the user can CreateTicket in the queue
+        next unless $session{CurrentUser}->HasRight( Object => $object, Right => 'CreateTicket' );
+
+        $InvestigationsQueueObj = $object;
+        last;
+    }
+}
 
 if( !RT::IR->IsIncidentQueue($QueueObj) ) {
     RT::Interface::Web::Redirect(RT::IR->HREFTo( '/Create.html?' . $m->comp('/Elements/QueryString', %ARGS )));

commit 81ddc5076047340ce3cf2ffc68a807d0bec874f7
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Mon Jun 8 18:51:06 2020 +0100

    Reinstate "Incident"/"Launch Investigation" page menu
    
    Reinstated tabbed switching view between incident and investigation
    Fixed passing results to FilterRTAddresses as array when should be arrayref

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 7a78f327..1f02cdcf 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -366,15 +366,6 @@ unless (defined $default_queue) {
     RT->Config->Set('DefaultQueue','Incident Reports');
 }
 
-=item C<$DefaultInvestigationsQueue>
-
-By default, investigation tickets will be created in the Investigations queue.
-You can set a different default investigations queue using this configuration
-option in RTIR_SiteConfig.pm.
-
-    Set( $DefaultInvestigationsQueue, 'Special Investigations' );
-
-=cut
 
 =back
 
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index bcde447d..2948e018 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -47,6 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <& /RTIR/Elements/Header,
     Title => $Title,
+    onload => "function () { hide('ticket-create-investigation') }",
 &>
 <& /Elements/Tabs &>
 
@@ -414,11 +415,11 @@ Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
  }
 
 # Load appropriate Investigations queue
-my $InvestigationsQueue = $ARGS{InvestigationQueue} || RT->Config->Get('DefaultInvestigationsQueue') || 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
+my $InvestigationsQueue = $ARGS{InvestigationQueue} || 'Investigations' . ( $constituency ? ' - ' . $constituency : '' );
 my $InvestigationsQueueObj = RT::Queue->new( $session{'CurrentUser'} );
 $InvestigationsQueueObj->Load( $InvestigationsQueue );
 
-# Users limited by constituency may not be able to use the queue defined in DefaultInvestigationsQueue.
+# Users limited by constituency may not be able to use the default or specified investigations queue
 # Look up what queue the user has SeeQueue and CreateTicket for and use that instead.
 unless ( $InvestigationsQueueObj->Name ) {
     RT->Logger->debug( "Investigation Queue '$InvestigationsQueue' could not be loaded for user " . $session{'CurrentUser'}->Id . "." );
@@ -498,7 +499,7 @@ if ( $CreateWithInvestigation ) {
                 InvestigationCc => 'Cc',
                 InvestigationAdminCc => 'AdminCc',
             },
-            results => @results,
+            results => \@results,
         );
 }
 
@@ -561,6 +562,21 @@ else {
     $SubmitLabel = loc('Create');
 }
 
+PageMenu->child(
+    incident => raw_html =>
+        q{<a href="#incident"}
+        . q{onclick="return switchVisibility('ticket-create-incident','ticket-create-investigation');"}
+        . q{>} . loc('Incident') . q{</a>}
+ );
+
+PageMenu->child(
+    investigation => raw_html =>
+        q[<a href="#investigation"]
+        . q[ onclick="return switchVisibility('ticket-create-investigation','ticket-create-incident');"]
+        . q[>] . loc('Launch Investigation') . q[</a>]
+    );
+
+
 unless ( exists $ARGS{'Content'} ) {
     my $Transactions;
     if ( $SplitObj ) {

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


More information about the rt-commit mailing list