[Rt-commit] rtir branch, 5.0/restore-incidents-and-investigations-on-create, created. 4.0.1rc1-118-g78635159
Blaine Motsinger
blaine at bestpractical.com
Mon May 18 20:06:33 EDT 2020
The branch, 5.0/restore-incidents-and-investigations-on-create has been created
at 78635159cfbffda0bac4ff0544bbb8746e1e6b40 (commit)
- Log -----------------------------------------------------------------
commit 990ea2934f81f4243c49f939de5a0ae1684510f4
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..2709a070 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 => $investigations_queue_obj,
+ 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,13 @@ if (!$QueueObj->Name) {
Abort( loc("Queue '[_1]' could not be loaded.", $ARGS{Queue}) );
}
+# Load appropriate Investigations queue
+my $investigations_queue = defined RT->Config->Get('DefaultInvestigationsQueue') ?
+ RT->Config->Get('DefaultInvestigationsQueue') : 'Investigations';
+my $investigations_queue_obj = RT::Queue->new( $session{'CurrentUser'} );
+my ($ret, $msg) = $investigations_queue_obj->Load( $investigations_queue );
+RT::Logger->error("Unable to load $investigations_queue : $msg") unless $ret;
+
if( !RT::IR->IsIncidentQueue($QueueObj) ) {
RT::Interface::Web::Redirect(RT::IR->HREFTo( '/Create.html?' . $m->comp('/Elements/QueryString', %ARGS )));
}
@@ -421,6 +441,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 +473,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 +534,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 78635159cfbffda0bac4ff0544bbb8746e1e6b40
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Mon May 18 19:05:39 2020 -0500
WIP - Migrate to elevator-light theme
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 351668c1..d34bcee4 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') || '',
+ &>
+ </div>
+</div>
+<div class="form-row">
+ <div class="label col-3">
+ <&|/l&>Time Left</&>:
+ </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',
- 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,
@@ -132,9 +167,11 @@
</div>
+% # !!!!!!! HERE !!!!!!!
+
<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">
-----------------------------------------------------------------------
More information about the rt-commit
mailing list