[Rt-commit] rtir branch, 3.0/incident-children-config, updated. 2.6.1-483-g0902172
Ruslan Zakirov
ruz at bestpractical.com
Thu Oct 13 05:20:13 EDT 2011
The branch, 3.0/incident-children-config has been updated
via 0902172dc373d65646cb067cd3d722cc8b9db5cf (commit)
via 9a68ee8d11946d8d8ad10a92f5962bdfef63e53d (commit)
via f6c916bd8cf33cf6f129a328d556c900fa32a1a1 (commit)
via 5f016c20eaf1eefadef96df98908be892ab97a51 (commit)
via 26dfbaafb6ba1f8affe292f2641899fa545e894e (commit)
via a5aa5c9879f6f475af32d7d92de6ee485be4067a (commit)
from 56e878d72c7e813f8d4d2bb6c06a007c59497145 (commit)
Summary of changes:
html/RTIR/Create.html | 30 ++++++++++-------
html/RTIR/Elements/AttachReports | 5 ++-
html/RTIR/Elements/SelectIncident | 65 +++++++++++++++++++++++++------------
t/custom-fields/on-transactions.t | 3 +-
4 files changed, 66 insertions(+), 37 deletions(-)
- Log -----------------------------------------------------------------
commit a5aa5c9879f6f475af32d7d92de6ee485be4067a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 12:21:39 2011 +0400
test that we actually created incident
diff --git a/t/custom-fields/on-transactions.t b/t/custom-fields/on-transactions.t
index 2967419..34a9d5f 100644
--- a/t/custom-fields/on-transactions.t
+++ b/t/custom-fields/on-transactions.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::IR::Test tests => 80;
+use RT::IR::Test tests => 81;
my $cf_name = 'test';
my $cf;
@@ -38,6 +38,7 @@ RT::Test->started_ok;
my $agent = default_agent();
my $inc_id = $agent->create_incident( { Subject => "incident" } );
+ok $inc_id, "created an incident";
my @tickets;
foreach my $qname ('Incident Reports', 'Investigations', 'Blocks') {
commit 26dfbaafb6ba1f8affe292f2641899fa545e894e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 12:33:59 2011 +0400
mason coerce single object arguments into arrays
we for sure don't want this
diff --git a/html/RTIR/Elements/AttachReports b/html/RTIR/Elements/AttachReports
index 4419012..8972b36 100644
--- a/html/RTIR/Elements/AttachReports
+++ b/html/RTIR/Elements/AttachReports
@@ -8,10 +8,11 @@
&>
</&>
<%ARGS>
- at Ticket => ()
+$Ticket => undef
$Name => 'AttachTickets'
</%ARGS>
<%INIT>
+my @Ticket = grep defined, ref($Ticket) eq 'ARRAY'? @$Ticket : $Ticket;
return unless @Ticket;
my @parents;
commit 5f016c20eaf1eefadef96df98908be892ab97a51
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 12:34:57 2011 +0400
pick current user from first ticket
diff --git a/html/RTIR/Elements/AttachReports b/html/RTIR/Elements/AttachReports
index 8972b36..bc829a7 100644
--- a/html/RTIR/Elements/AttachReports
+++ b/html/RTIR/Elements/AttachReports
@@ -25,7 +25,7 @@ foreach my $e ( @Ticket ) {
}
return unless @parents;
-my $siblings = RT::Tickets->new( $Ticket->CurrentUser );
+my $siblings = RT::Tickets->new( $Ticket[0]->CurrentUser );
$siblings->FromSQL( RT::IR->Query(
Queue => 'Incident Reports',
MemberOf => \@parents,
commit f6c916bd8cf33cf6f129a328d556c900fa32a1a1
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 12:39:29 2011 +0400
return back information about spliting ticket
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index c49bd33..da9396e 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -60,6 +60,13 @@
<&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &>
<table width="100%" border="0">
+% if ( $SplitObj ) {
+ <tr class="split">
+ <td class="label"><&|/l&>Split from</&>:</td>
+ <td class="value"><% $SplitObj->id %></td>
+ </tr>
+% }
+
<& /Ticket/Elements/EditBasics,
InTable => 1,
fields => [
commit 9a68ee8d11946d8d8ad10a92f5962bdfef63e53d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 13:16:37 2011 +0400
no $Incident in the loop, only $id
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index da9396e..fcfcf7d 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -351,18 +351,18 @@ foreach my $id ( grep $_, @Incident ) {
my $error = 1;
my $inc = RT::Ticket->new( $session{'CurrentUser'} );
- $inc->Load( $Incident );
+ $inc->Load( $id );
unless ( $inc->id ) {
- push @results, loc("Couldn't load incident #[_1]", $Incident );
+ push @results, loc("Couldn't load incident #[_1]", $id );
}
elsif ( $inc->QueueObj->Name ne 'Incidents' ) {
- push @results, loc('Ticket #[_1] is not an Incident', $Incident );
+ push @results, loc('Ticket #[_1] is not an Incident', $id );
}
elsif ( !$skip_create && $constituency_field
&& RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject'
&& lc $ARGS{$constituency_field} ne lc $inc->FirstCustomFieldValue('Constituency') )
{
- push @results, loc('Incident #[_1] has constituency [_2], choose the same value for a new ticket or use another Incident', $Incident, $inc->FirstCustomFieldValue('Constituency') );
+ push @results, loc('Incident #[_1] has constituency [_2], choose the same value for a new ticket or use another Incident', $id, $inc->FirstCustomFieldValue('Constituency') );
}
else {
push @IncidentObj, $inc;
commit 0902172dc373d65646cb067cd3d722cc8b9db5cf
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Thu Oct 13 13:18:07 2011 +0400
implementation of new /RTIR/Elements/SelectIncident
all existing test pass
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index fcfcf7d..c452313 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -67,20 +67,17 @@
</tr>
% }
+ <& /RTIR/Elements/SelectIncident,
+ Type => $Type,
+ Default => \@Incident,
+ SplitObj => $SplitObj,
+ &>
+
<& /Ticket/Elements/EditBasics,
InTable => 1,
fields => [
{
name => 'Status',
- comp => '/Elements/SelectIncident',
- args => {
- Name => 'Incident',
- Default => @Incident,
- QueueObj => $QueueObj,
- },
- },
- {
- name => 'Status',
comp => '/Elements/SelectStatus',
args => {
Name => "Status",
diff --git a/html/RTIR/Elements/SelectIncident b/html/RTIR/Elements/SelectIncident
index 21c5c12..96f51af 100644
--- a/html/RTIR/Elements/SelectIncident
+++ b/html/RTIR/Elements/SelectIncident
@@ -1,25 +1,48 @@
-% if ( $SplitObj ) {
- <tr class="split">
- <td class="label"><&|/l&>Split from</&>:</td>
- <td class="value"><% $SplitObj->id %></td>
- </tr>
-% if ( $parentvalue ) {
- <tr class="incident">
- <td class="label"><&|/l&>Will be linked to Incident(s)</&>:</td>
- <td class="value"><% $parentvalue %></td>
- </tr>
+<tr class="incident">
+ <td class="label"><&|/l&>Incident</&>:</td>
+ <td class="value">
+% if ( @potential ) {
+ <& /RTIR/Search/Elements/ShowResults,
+ Query => $query,
+ Rows => 0,
+ Format => $format,
+ DisplayFormat => $dformat,
+ AllowSorting => 0,
+ ShowHeader => 0,
+ &>
% }
-% elsif ( $Incident ) {
- <tr class="incident">
- <td class="label"><&|/l&>Incident</&>:</td>
- <td class="value"><input type="text" name="Incident" size="16" maxsize="16" value="<% $Incident || '' %>" /></td>
- </tr>
- <tr>
- <td class="label"> </td>
- <td class="comment">
- (<&|/l&>Id of an Incident to link a new ticket to</&>. <% $Type eq 'Block'? '<strong>'.loc('Required').'</strong>': loc('Optional') |n %>.)
- </td>
- </tr>
+ <input type="text" name="<% $Name %>" size="16" maxsize="16" value="" />
+% if ( $config->{'Multiple'} ) {
+ <input type="submit" name="<% "More$Name" %>" value="<% loc('More') %>" class="button" />
% }
+ </td>
+</tr>
+<tr>
+ <td class="label"> </td>
+ <td class="comment">
+ (<&|/l&>Id of an Incident to link a new ticket to</&>.
+ <% $config->{'Required'}? '<strong>'.loc('Required').'</strong>': loc('Optional') |n %>.)
+ </td>
+</tr>
+<%ARGS>
+$Type
+$Name => 'Incident'
+$SplitObj => undef
+ at Default => ()
+</%ARGS>
+<%INIT>
+my @potential = @Default;
+if ( $SplitObj ) {
+ push @potential, map $_->id, @{ RT::IR->Incidents( $SplitObj )->ItemsArrayRef || [] };
+}
+my $config = RT->Config->Get('RTIR_IncidentChildren')->{ $Type };
+my $query = RT::IR->Query(
+ Queue => 'Incidents',
+ And => join ' OR ', map "id = $_", @potential
+);
+my $format = RT->Config->Get('RTIRSearchResultFormats')->{'LinkIncident'};
+my $dformat = '\'__'. ($config->{'Multiple'}? 'CheckBox' : 'RadioButton') .".{$Name}__\', "
+ . $format;
+</%INIT>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list