Commit 68a3e8af authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Merge branch '3.0.0-releng' into 3.0-trunk

parents a5acd00b 9b32fdbe
......@@ -8,6 +8,7 @@ docs/UPGRADING
docs/UPGRADING-2.4
docs/UPGRADING-2.6
docs/UPGRADING-3.0
etc/add_constituency.in
etc/initialdata
etc/logo/gif/rtir-logo-badge-3d.gif
etc/logo/gif/rtir-logo-badge-shadow.gif
......@@ -42,6 +43,7 @@ etc/upgrade/2.5.1/update_saved_searches.pl.in
etc/upgrade/2.6.2/content
etc/upgrade/2.9.0/content
etc/upgrade/3.0.0rc2/content
etc/upgrade/upgrade.pl.in
html/Callbacks/RTIR/autohandler/Default
html/Callbacks/RTIR/Elements/EditCustomField/EditComponentName
html/Callbacks/RTIR/Elements/Header/Default
......@@ -188,6 +190,7 @@ lib/RT/Condition/RTIR_RequireReportActivation.pm
lib/RT/Condition/RTIR_StaffResponse.pm
lib/RT/IR.pm
lib/RT/IR/Config.pm
lib/RT/IR/Test.pm.in
lib/RT/IR/Test/Web.pm
Makefile.PL
MANIFEST This list of files
......@@ -251,6 +254,7 @@ t/report/status.t
t/rtfm/basics.t
t/rtfm/on-create.t
t/rtfm/on-update.t
t/searches/menu.t
t/searches/simple.t
t/upgrade/2.6.0-to-2.9.0.t
t/walk-web.t
......@@ -9,9 +9,9 @@
^\.git
^t/tmp/
^MYMETA\.*
^etc/add_constituency
^etc/upgrade/upgrade.pl
^etc/add_constituency$
^etc/upgrade/upgrade.pl$
^etc/upgrade/2.5.1/update_saved_searches.pl$
^lib/RT/IR/Test.pm
^lib/RT/IR/Test.pm$
^\.prove
\.sw[op]$
......@@ -32,4 +32,4 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
version: 3.0.0rc1
version: 3.0.0
......@@ -6,7 +6,7 @@ author('Best Practical Solutions <sales@bestpractical.com>');
version_from('lib/RT/IR.pm');
# update README and docs/UPGRADING
requires_rt('4.0.14rc1');
requires_rt('4.0.14');
# XXX: This should be reported by M::I::RTx
my ($lib_path) = $INC{'RT.pm'} =~ /^(.*)[\\\/]/;
......@@ -51,4 +51,14 @@ substitute( {
tests("t/*.t t/*/*.t");
postamble('
snapshot: dist sign-dist dist-shasums
sign-dist:
gpg -a --detach-sign $(DISTVNAME).tar.gz
dist-shasums:
sha1sum $(DISTVNAME).tar.gz*
');
WriteAll();
......@@ -14,7 +14,7 @@ touch with us at <sales@bestpractical.com>.
REQUIRED PACKAGES:
------------------
o RT 4.0.14rc1 or later, configured, installed and tested.
o RT 4.0.14 or later, configured, installed and tested.
o Net::Whois::RIPE 1.31 is bundled with RTIR for compatibility with the
API RTIR uses and for a fix to run without warnings under perl 5.18.
......
......@@ -24,7 +24,7 @@ lose data.
=item 2
Upgrade your RT installation to RT 4.0.14rc1 or newer following
Upgrade your RT installation to RT 4.0.14 or newer following
its upgrade instructions. Make sure you follow all of the
steps and upgrade both the code and the database.
......
......@@ -24,11 +24,10 @@ improve the performance of the upgrade.
These should be removed following a successful since they are unlikely
to be useful in normal RTIR usage.
DROP INDEX UPGRADE_TRANSACTIONS_TYPE;
DROP INDEX UPGRADE_TRANSACTIONS_NEW;
DROP INDEX UPGRADE_TRANSACTIONS_OLD;
DROP INDEX UPGRADE_OCFV_STATUS;
DROP INDEX UPGRADE_TRANSACTIONS_TYPE ON Transactions;
DROP INDEX UPGRADE_TRANSACTIONS_NEW ON Transactions;
DROP INDEX UPGRADE_TRANSACTIONS_OLD ON Transactions;
DROP INDEX UPGRADE_OCFV_STATUS ON Transactions;
=head2 Lifecycles
......
......@@ -312,9 +312,10 @@ Set($ReplyString , '');
=item C<$RTIR_OldestRelatedTickets>
Controls how far back, in days, RTIR should look for tickets which
might contain a specific string, such as an IP address. Sixty
days by default.
Controls how far back, in days, RTIR should look for tickets which might
contain a specific string. This is only used for Content searches,
searches based on IP or other Custom Fields are not limited by age
because the current implementation has poor performance.
=cut
......
......@@ -56,10 +56,11 @@ my $query_string = sub {
my $args = $DECODED_ARGS;
my @query_fields = qw(Query Format RowsPerPage Page OrderBy Order);
my $search_arguments = sub {
my %res = ();
my $caller_args = $m->caller_args(1);
my @query_fields = qw(Query Format RowsPerPage Page OrderBy Order);
if ( $caller_args->{'SearchArgs'} ) {
@res{ @query_fields } = @{ $caller_args->{'SearchArgs'} }{ @query_fields };
} else {
......@@ -75,7 +76,7 @@ my $search = $root->child( search => title => loc('Search'), path => '/RTIR/Sear
$search->child( new => title => loc('New Search'), path => '/RTIR/Search/?NewQuery=1' );
{
my $current_search = $session{"CurrentSearchHash"} || {};
my $current_search = $session{'CurrentSearchHash'} ? { map { $_ => $session{'CurrentSearchHash'}{$_} } @query_fields } : {};
my $has_query = 1 if ( $args->{'Query'} or $current_search->{'Query'} );
if ( $has_query ) {
......
......@@ -47,7 +47,12 @@
%# END BPS TAGGED BLOCK }}}
<%INIT>
$Query = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;
if ( $BaseQuery && $Query ) {
$Query = join ' AND ', map "( $_ )", $BaseQuery, $Query;
}
else {
$Query ||= $BaseQuery;
}
$BaseURL = RT->Config->Get('WebPath')."/$BaseURL" unless $BaseURL =~ m{^/};
$BaseURL .= ( $BaseURL =~ /\?/ )? '&': '?' unless $BaseURL =~ m{[&?]$};
......
......@@ -71,7 +71,14 @@
<%INIT>
my $title = loc('Reporting');
my $FullQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;
my $FullQuery;
if ( $BaseQuery && $Query ) {
$FullQuery = join ' AND ', map "( $_ )", $BaseQuery, $Query;
}
else {
$FullQuery = $BaseQuery || $Query;
}
</%INIT>
......
......@@ -82,8 +82,12 @@ RT::IR::Config::CheckObsoleteCFSyntax($Format,$location);
RT::IR::Config::CheckObsoleteCFSyntax($Query,$location);
if ( $Type ) {
$BaseQuery ||= RT::IR->Query( Queue => $Queue );
$Query ||= RT::IR->ActiveQuery( Queue => $Queue );
if ( $Query ) {
$BaseQuery ||= RT::IR->Query( Queue => $Queue );
}
else {
$Query = RT::IR->ActiveQuery( Queue => $Queue );
}
}
my $BaseURL = "RTIR/Search/Results.html";
......
......@@ -61,6 +61,11 @@ unless ( exists $session{'my_rtir_portlets'} ) {
my $portlets = $session{'my_rtir_portlets'};
if ( defined $q && length $q ) {
if ($q =~ /^#?(\d+)$/) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."RTIR/Display.html?id=".$1);
}
my $query = RT::IR->ParseSimpleSearch(
Query => $q,
CurrentUser => $session{'CurrentUser'},
......
......@@ -52,7 +52,7 @@ use warnings;
package RT::IR;
our $VERSION = '3.0.0rc1';
our $VERSION = '3.0.0';
use Scalar::Util qw(blessed);
......
use strict;
use warnings;
use RT::IR::Test tests => undef;
RT::Test->started_ok;
my $m = default_agent();
my %ticket;
for my $subject (qw/foo bar baz/) {
for my $type ( 'incident', 'ir', 'investigation', 'block' ) {
my $create_sub = "create_$type";
push @{ $ticket{$type} },
$m->$create_sub(
{
Subject => "$type $subject",
$type eq 'incident' ? () : ( Incident => $ticket{incident}[-1] ),
}
);
}
}
# Merge
for my $type ( 'incident', 'ir', 'investigation', 'block' ) {
$m->display_ticket( $ticket{$type}[0] );
$m->follow_link_ok( { text => 'Merge' } );
$m->title_like(qr/Merge .+ #$ticket{$type}[0]:/);
for my $id ( @{ $ticket{$type} }[ 1 .. 2 ] ) {
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$id$} ), "found link to $type $id" );
}
$m->follow_link_ok( { text => "Edit Search", $type eq 'incident' ? () : ( n => 2 ) } );
$m->form_name('BuildQuery');
$m->submit_form_ok(
{
with_fields => { idOp => '!=', ValueOfid => $ticket{$type}[1] },
button => 'DoSearch'
},
"add new term 'id != $ticket{$type}[1]'"
);
ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[1]$} ),
"didn't find link to $type $ticket{$type}[1]" );
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[2]$} ),
"found link to $type $ticket{$type}[2]" );
}
# Link ToIncident
{
$m->display_ticket( $ticket{ir}[0] );
$m->follow_link_ok( { text => '[Link]' } );
$m->title_is("Link Report #$ticket{ir}[0] to selected Incident");
ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[0]$} ),
"didn't find link to incident $ticket{incident}[0]" );
for my $incident_id ( @{ $ticket{incident} }[ 1 .. 2 ] ) {
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$incident_id$} ),
"found link to incident $incident_id" );
}
$m->follow_link_ok( { text => "Edit Search", n => 2 } );
$m->form_name('BuildQuery');
my ($input_query) = $m->find_all_inputs( name => 'Query' );
is( $input_query->value, q{( Queue = 'Incidents' ) AND Status = 'open'}, 'Query input is correct' );
$m->submit_form_ok(
{
with_fields => { idOp => '!=', ValueOfid => $ticket{incident}[1] },
button => 'DoSearch'
},
"add new term 'id != $ticket{incident}[1]'"
);
ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[1]$} ),
"didn't find link to incident $ticket{incident}[1]" );
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[2]$} ),
"found link to incident $ticket{incident}[2]" );
}
# Link FromIncident
{
$m->display_ticket( $ticket{incident}[0] );
$m->follow_link_ok( { text => 'Link', url_regex => qr{Link/FromIncident} } );
$m->title_is("Link selected Report to Incident #$ticket{incident}[0]");
ok(
!$m->find_link(
url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$}
),
"didn't find link to incident report $ticket{ir}[0]"
);
for my $ir ( @{ $ticket{ir} }[ 1 .. 2 ] ) {
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ir$} ), "found link to incident report $ir" );
}
$m->follow_link_ok( { text => "Edit Search", n => 2 } );
$m->form_name('BuildQuery');
my ($input_query) = $m->find_all_inputs( name => 'Query' );
is(
$input_query->value,
q{( Queue = 'Incident Reports' ) AND ( Status = 'new' OR Status = 'open' )},
'Query input is correct'
);
$m->submit_form_ok(
{
with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[1] },
button => 'DoSearch'
},
"add new term 'id != $ticket{ir}[1]'"
);
ok(
!$m->find_link(
url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[1]$}
),
"didn't find link to incident report $ticket{ir}[1]"
);
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[2]$} ),
"found link to incident report $ticket{ir}[2]" );
}
# Incident Reply to Reporters
{
$m->display_ticket( $ticket{incident}[0] );
$m->follow_link_ok( { text => 'Reply to Reporters' } );
$m->title_like(qr/#$ticket{incident}[0]: Reply to Reporters/);
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$} ),
"found link to incident report $ticket{ir}[0]" );
for my $type (qw/investigation block/) {
ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
"didn't find link to $type $ticket{$type}[0]" );
}
$m->form_name('TicketUpdate');
my ($checkbox) = $m->find_all_inputs( name => 'SelectedReports' );
is( $checkbox->value, $ticket{ir}[0], '$ticket{ir}[0] is checked' );
$m->follow_link_ok( { text => "Edit Search", n => 2 } );
$m->form_name('BuildQuery');
$m->submit_form_ok(
{
with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[0] },
button => 'DoSearch'
},
"add new term 'id != $ticket{ir}[0]'"
);
ok(
!$m->find_link(
url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$},
text => $ticket{ir}[0],
n => 2, # there is one in "Attach Reports" widget
),
"didn't find link to incident report $ticket{ir}[0]"
);
for my $type (qw/investigation block/) {
ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
"didn't find link to $type $ticket{$type}[0]" );
}
}
# Incident Reply to All
{
$m->display_ticket( $ticket{incident}[0] );
$m->follow_link_ok( { text => 'Reply to All' } );
$m->title_like(qr/#$ticket{incident}[0]: Reply to All/);
for my $type (qw/ir investigation block/) {
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
"found link to $type $ticket{$type}[0]" );
}
$m->form_name('TicketUpdate');
my ($checkbox) = $m->find_all_inputs( name => 'SelectedReports' );
is( $checkbox->value, $ticket{ir}[0], '$ticket{ir}[0] is checked' );
($checkbox) = $m->find_all_inputs( name => 'SelectedInvestigations' );
is( $checkbox->value, $ticket{investigation}[0], '$ticket{investigation}[0] is checked' );
($checkbox) = $m->find_all_inputs( name => 'SelectedBlocks' );
is( $checkbox->value, $ticket{block}[0], '$ticket{block}[0] is checked' );
$m->follow_link_ok( { text => "Edit Search", n => 2 } );
$m->form_name('BuildQuery');
$m->submit_form_ok(
{
with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[0] },
button => 'DoSearch'
},
"add new term 'id != $ticket{ir}[0]'"
);
ok(
!$m->find_link(
url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$},
text => $ticket{ir}[0],
n => 2, # there is one in "Attach Reports" widget
),
"didn't find link to incident report $ticket{ir}[0]"
);
for my $type (qw/investigation block/) {
ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
"found link to $type $ticket{$type}[0]" );
}
}
done_testing;
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use RT::IR::Test tests => 20;
use RT::IR::Test tests => 24;
RT::Test->started_ok;
my $agent = default_agent();
......@@ -24,4 +24,10 @@ my $agent = default_agent();
$agent->get_ok( '/RTIR/index.html?q=192.168.1.1' );
$agent->content_like(qr{test ir});
$agent->get_ok( "/RTIR/index.html?q=$inc_id" );
is($agent->uri,$agent->rt_base_url."RTIR/Display.html?id=$inc_id","Directed to the Incident Page");
$agent->get_ok( "/RTIR/index.html?q=$ir_id" );
is($agent->uri,$agent->rt_base_url."RTIR/Display.html?id=$ir_id","Directed to the Report Page");
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment