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

Blaine Motsinger blaine at bestpractical.com
Tue May 19 17:05:43 EDT 2020


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

- Log -----------------------------------------------------------------
commit ebc13027a45c0de1124e3fab2bab68a392acd97c
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 186c9e08..4346e860 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -311,6 +311,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 );
 
@@ -371,6 +384,12 @@ if (!$QueueObj->Name) {
 Abort( loc("Queue '[_1]' could not be loaded.", $ARGS{Queue}) );
  }
 
+# Load appropriate Investigations queue
+my $InvestigationsQueue = 'Investigations';
+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 )));
 }
@@ -421,6 +440,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 );
 
@@ -436,6 +472,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 );
 
@@ -477,7 +533,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 879a8b8de0398ba5965990a029756c922eb9aec1
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/Incident/Create.html b/html/RTIR/Incident/Create.html
index 4346e860..0df81748 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -388,7 +388,7 @@ Abort( loc("Queue '[_1]' could not be loaded.", $ARGS{Queue}) );
 my $InvestigationsQueue = 'Investigations';
 my $InvestigationsQueueObj = RT::Queue->new( $session{'CurrentUser'} );
 my ($ret, $msg) = $InvestigationsQueueObj->Load( $InvestigationsQueue );
-RT::Logger->error("Unable to load $InvestigationsQueue : $msg") unless $ret;
+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 )));
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 351668c1..77e5ce54 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-md-3">
+      <% loc('Constituency') %>:
+    </div>
+    <div class="value col-md-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-md-3">
+      <&|/l&>Queue</&>:
+    </div>
+    <div class="value col-md-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-md-3">
+      <&|/l&>Owner</&>:
+    </div>
+    <div class="value col-md-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-md-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 );

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


More information about the rt-commit mailing list