[Rt-commit] rtir branch, 4.0/custom-report-formats, created. 4.0.0-47-ga69e4eb
Jim Brandt
jbrandt at bestpractical.com
Tue Jun 27 14:46:20 EDT 2017
The branch, 4.0/custom-report-formats has been created
at a69e4ebdea23d9fd56d319e86dcedc2383fdca60 (commit)
- Log -----------------------------------------------------------------
commit 60d84f89f829a528d1a77cc97c632ba12710150c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jun 27 14:10:31 2017 -0400
Add test to check custom search format
diff --git a/t/searches/custom_formats.t b/t/searches/custom_formats.t
new file mode 100644
index 0000000..003cce9
--- /dev/null
+++ b/t/searches/custom_formats.t
@@ -0,0 +1,45 @@
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => undef, config => q{Set(%RTIRSearchResultFormats,
+ 'ReportDefault' => q{'<b><a href="__RTIRTicketURI__">__id__</a></b>/TITLE:#',
+'<b><a href="__RTIRTicketURI__">__Subject__</a></b>/TITLE:Subject',
+QueueName,
+Status,
+LastUpdatedRelative,
+CreatedRelative,
+__NEWLINE__,
+'',
+Requestors,
+OwnerName,
+ToldRelative,
+DueRelative,
+TimeLeft,
+'__CustomField.{How Reported}__'});};
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+diag 'Confirm custom IR format is used';
+{
+ my $ir_id = $agent->create_ir( {
+ Subject => 'test ir',
+ Requestors => 'test at example.com',
+ }, {
+ IP => '192.168.1.1',
+ });
+ my $inc_id = $agent->create_incident_for_ir(
+ $ir_id, { Subject => 'test inc' },
+ );
+ $agent->get_ok( '/RTIR/index.html', 'get rtir at glance page' );
+ $agent->follow_link_ok(
+ { text => "Incident Reports", n => '1' },
+ "Followed 'Incidents Reports' link"
+ );
+ $agent->content_like( qr/test/, "the ticket is on the page");
+ $agent->content_like( qr/How Reported/, "How Reported is on the page");
+}
+
+undef $agent;
+done_testing;
commit a69e4ebdea23d9fd56d319e86dcedc2383fdca60
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jun 27 14:43:20 2017 -0400
Discover Lifecycle if not passed to load proper Format
RTIR supports many custom search result formats, including
a format for each special lifecycle type. The results page
was checking for a custom type format based on the Lifecycle, but
in some cases the lifecycle isn't passed as part of the Query.
Discover it based on the query so custom search result formats
can be loaded and used.
diff --git a/html/RTIR/Search/Results.html b/html/RTIR/Search/Results.html
index 5fc2d19..d069c62 100644
--- a/html/RTIR/Search/Results.html
+++ b/html/RTIR/Search/Results.html
@@ -68,6 +68,15 @@
<%INIT>
my $title = loc("Results");
+# Some queries, like those from the RTIR home page, won't provide Lifecycle
+if ( not $Lifecycle ){
+ my ($our, @lifecycles) = RT::IR->OurQuery( $Query );
+ if ( $our and scalar @lifecycles == 1 ) {
+ # If we found only one lifecycle, set it so we get the right Format below
+ $Lifecycle = $lifecycles[0];
+ }
+}
+
my $Type = RT::IR::TicketType( Lifecycle => $Lifecycle ) || '';
$Format ||= RT->Config->Get('RTIRSearchResultFormats')->{ $Type . 'Default' };
-----------------------------------------------------------------------
More information about the rt-commit
mailing list