[Rt-commit] rt branch, master, updated. rt-4.0.5-268-gd02bc28
Alex Vandiver
alexmv at bestpractical.com
Wed Feb 15 20:00:24 EST 2012
The branch, master has been updated
via d02bc28d4144712f37c423fd8285cdad43920e03 (commit)
via 3f33ee62caf3d7b37bc1395ffc6f552ad80b66ba (commit)
via ef856168bceecfb87f88383429f11982d57acf08 (commit)
via 71c5b88dfe0461936824832de366301a295de7ea (commit)
via 0258f0d7d465d2515830f97d13cec92c5759d8d8 (commit)
via 9f37683cba2e3ecfbfa284fc0a33f24a4d014fd3 (commit)
via 3f27169775f43171e94f721b0f0856992f0829f6 (commit)
via d0acc689e25ccb1ec60f5feea4f8d3b7d7e223de (commit)
via 61d31ad11769388bff89df2593631a352196629c (commit)
via e249f67bb8fd860be693cbd540384823b8c5036c (commit)
via 1021030b5cf3e0b277f3168242a43af655878063 (commit)
via ab535975e5aded067d14b63d61640f32149c600c (commit)
via 33451e6fc00f49381e7e003f1a04c48359d02572 (commit)
via 1336314b9e8018d4b8a8aa9d46c88e2f11203b2c (commit)
via 4c6fe5eb0610ee8dd20cbb7a6deec96db69e4c50 (commit)
via 835632495ff424892ae8d67e26a726959855878d (commit)
via 13c9428055fda4e3e383cd0b474dee1ecad988d7 (commit)
via 67ed6217e1a02b8a10c98018e834c5cea2e16414 (commit)
via cbef7ff03232d909bc8b6682ba4aa1c004291dbf (commit)
via 8ba9858f9827e5e499f9e12f2feb42898f4b491c (commit)
from 9ed192b04f1b5a46fd0b75a40122774a905ee7eb (commit)
Summary of changes:
docs/UPGRADING-4.0 | 23 ++++
etc/schema.mysql | 2 +-
etc/upgrade/4.0.6/schema.mysql | 1 +
lib/RT/Interface/Web/QueryBuilder/Tree.pm | 10 +-
lib/RT/Report/Tickets.pm | 2 +-
share/html/Elements/SelectOwner | 10 +-
share/html/Elements/SelectStatus | 12 ++-
share/html/Prefs/Search.html | 2 +-
share/html/Search/Build.html | 4 +-
share/html/Search/Elements/BuildFormatString | 6 +-
share/html/Search/Elements/PickBasics | 7 +-
share/html/Search/Elements/PickCFs | 8 +-
share/html/Search/Elements/PickCriteria | 6 +-
share/html/Ticket/Display.html | 6 +-
t/web/query_builder_queue_limits.t | 180 ++++++++++++++++++++++++++
15 files changed, 250 insertions(+), 29 deletions(-)
create mode 100644 etc/upgrade/4.0.6/schema.mysql
create mode 100644 t/web/query_builder_queue_limits.t
- Log -----------------------------------------------------------------
commit d02bc28d4144712f37c423fd8285cdad43920e03
Merge: 9ed192b 3f33ee6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Feb 15 19:42:49 2012 -0500
Merge branch '4.0-trunk'
Conflicts:
lib/RT/Interface/Web/QueryBuilder/Tree.pm
lib/RT/Report/Tickets.pm
share/html/Search/Elements/BuildFormatString
share/html/Search/Elements/PickCFs
diff --cc lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 34377c3,e7f2d5a..4e7311f
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@@ -110,10 -110,12 +110,10 @@@ sub GetReferencedQueues
return unless $node->isLeaf;
my $clause = $node->getNodeValue();
+ return unless $clause->{Key} eq 'Queue';
+ return unless $clause->{Op} eq '=';
- if ( $clause->{Key} eq 'Queue' ) {
- $queues->{ $clause->{RawValue} } = 1;
- };
- my $value = $clause->{Value};
- $value =~ s/\\(.)/$1/g if $value =~ s/^'(.*)'$/$1/;
- $queues->{ $value } = 1;
++ $queues->{ $clause->{RawValue} } = 1;
}
);
diff --cc share/html/Search/Elements/BuildFormatString
index a32cb35,5ee09cf..15829fd
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@@ -102,11 -102,11 +102,11 @@@ my @fields = qw
$m->callback( CallbackOnce => 1, CallbackName => 'SetFieldsOnce', Fields => \@fields );
my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});
- foreach my $id (keys %cfqueues) {
+ foreach my $id (keys %queues) {
- # Gotta load up the $queue object, since queues get stored by name now. my $id
+ # Gotta load up the $queue object, since queues get stored by name now.
my $queue = RT::Queue->new($session{'CurrentUser'});
$queue->Load($id);
- $CustomFields->LimitToQueue($queue->Id);
+ $CustomFields->LimitToQueue($queue->Id) if $queue->Id;
}
$CustomFields->LimitToGlobal;
diff --cc share/html/Search/Elements/PickCFs
index a7b1ee1,f2dc21f..8e5574f
--- a/share/html/Search/Elements/PickCFs
+++ b/share/html/Search/Elements/PickCFs
@@@ -54,11 -54,9 +54,11 @@@ foreach my $id (keys %queues)
# Gotta load up the $queue object, since queues get stored by name now.
my $queue = RT::Queue->new($session{'CurrentUser'});
$queue->Load($id);
- $CustomFields->LimitToQueue($queue->Id);
+ $CustomFields->LimitToQueue($queue->Id) if $queue->Id;
}
$CustomFields->LimitToGlobal;
+$CustomFields->OrderBy( FIELD => 'Name', ORDER => 'ASC' );
+
$m->callback(
CallbackName => 'MassageCustomFields',
CustomFields => $CustomFields,
diff --cc t/web/query_builder_queue_limits.t
index 0000000,a3b9765..86242e0
mode 000000,100644..100644
--- a/t/web/query_builder_queue_limits.t
+++ b/t/web/query_builder_queue_limits.t
@@@ -1,0 -1,180 +1,180 @@@
+ use strict;
+ use warnings;
+
+ use RT::Test tests => 34;
+
+ my $lifecycles = RT->Config->Get('Lifecycles');
+ $lifecycles->{foo} = {
+ initial => ['initial'],
+ active => ['open'],
+ inactive => ['resolved'],
+
+ };
+
+ RT::Lifecycle->FillCache();
+
+ my $general = RT::Test->load_or_create_queue( Name => 'General' );
+ my $foo = RT::Test->load_or_create_queue( Name => 'foo', Lifecycle => 'foo' );
+
+ my $global_cf = RT::Test->load_or_create_custom_field(
+ Name => 'global_cf',
+ Queue => 0,
+ Type => 'FreeformSingle',
+ );
+
+ my $general_cf = RT::Test->load_or_create_custom_field(
+ Name => 'general_cf',
+ Queue => 'General',
+ Type => 'FreeformSingle',
+ );
+
+ my $foo_cf = RT::Test->load_or_create_custom_field(
+ Name => 'foo_cf',
+ Queue => 'foo',
+ Type => 'FreeformSingle'
+ );
+
+ my $root = RT::Test->load_or_create_user( Name => 'root', );
+ my $user_a = RT::Test->load_or_create_user(
+ Name => 'user_a',
+ Password => 'password',
+ );
+ my $user_b = RT::Test->load_or_create_user(
+ Name => 'user_b',
+ Password => 'password',
+ );
+
+ ok(
+ RT::Test->set_rights(
+ {
+ Principal => $user_a,
+ Object => $general,
+ Right => ['OwnTicket'],
+ },
+ {
+ Principal => $user_b,
+ Object => $foo,
+ Right => ['OwnTicket'],
+ },
+ ),
+ 'granted OwnTicket right for user_a and user_b'
+ );
+
+ my ( $url, $m ) = RT::Test->started_ok;
+ ok( $m->login, 'logged in' );
+
+ $m->get_ok( $url . '/Search/Build.html' );
+
+ diag "check default statuses, cf and owners";
+ my $form = $m->form_name('BuildQuery');
+ ok( $form, 'found BuildQuery form' );
-ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf by default' );
-ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'no general_cf by default' );
-ok( !$form->find_input("ValueOf'CF.{foo_cf}'"), 'no foo_cf by default' );
++ok( $form->find_input("ValueOfCF.{global_cf}"), 'found global_cf by default' );
++ok( !$form->find_input("ValueOfCF.{general_cf}"), 'no general_cf by default' );
++ok( !$form->find_input("ValueOfCF.{foo_cf}"), 'no foo_cf by default' );
+
+ my $status_input = $form->find_input('ValueOfStatus');
+ my @statuses = sort $status_input->possible_values;
+ is_deeply(
+ \@statuses, [ '', qw/initial new open rejected resolved stalled/], 'found all statuses'
+ );
+
+ my $owner_input = $form->find_input('ValueOfActor');
+ my @owners = sort $owner_input->possible_values;
+ is_deeply(
+ \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+ );
+
+ diag "limit queue to foo";
+ $m->submit_form(
+ fields => { ValueOfQueue => 'foo' },
+ button => 'AddClause',
+ );
+
+ $form = $m->form_name('BuildQuery');
-ok( $form->find_input("ValueOf'CF.{foo_cf}'"), 'found foo_cf' );
-ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
-ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'still no general_cf' );
++ok( $form->find_input("ValueOfCF.{foo_cf}"), 'found foo_cf' );
++ok( $form->find_input("ValueOfCF.{global_cf}"), 'found global_cf' );
++ok( !$form->find_input("ValueOfCF.{general_cf}"), 'still no general_cf' );
+ $status_input = $form->find_input('ValueOfStatus');
+ @statuses = sort $status_input->possible_values;
+ is_deeply(
+ \@statuses,
+ [ '', qw/initial open resolved/ ],
+ 'found statuses from foo only'
+ );
+
+ $owner_input = $form->find_input('ValueOfActor');
+ @owners = sort $owner_input->possible_values;
+ is_deeply(
+ \@owners, [ '', qw/Nobody root user_b/], 'no user_a'
+ );
+
+ diag "limit queue to general too";
+
+ $m->submit_form(
+ fields => { ValueOfQueue => 'General' },
+ button => 'AddClause',
+ );
+
+ $form = $m->form_name('BuildQuery');
-ok( $form->find_input("ValueOf'CF.{general_cf}'"), 'found general_cf' );
-ok( $form->find_input("ValueOf'CF.{foo_cf}'"), 'found foo_cf' );
-ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
++ok( $form->find_input("ValueOfCF.{general_cf}"), 'found general_cf' );
++ok( $form->find_input("ValueOfCF.{foo_cf}"), 'found foo_cf' );
++ok( $form->find_input("ValueOfCF.{global_cf}"), 'found global_cf' );
+ $status_input = $form->find_input('ValueOfStatus');
+ @statuses = sort $status_input->possible_values;
+ is_deeply(
+ \@statuses,
+ [ '', qw/initial new open rejected resolved stalled/ ],
+ 'found all statuses again'
+ );
+ $owner_input = $form->find_input('ValueOfActor');
+ @owners = sort $owner_input->possible_values;
+ is_deeply(
+ \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users again'
+ );
+
+ diag "limit queue to != foo";
+ $m->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+ $m->submit_form(
+ form_name => 'BuildQuery',
+ fields => { ValueOfQueue => 'foo', QueueOp => '!=' },
+ button => 'AddClause',
+ );
+
+ $form = $m->form_name('BuildQuery');
-ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
-ok( !$form->find_input("ValueOf'CF.{foo_cf}'"), 'no foo_cf' );
-ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'no general_cf' );
++ok( $form->find_input("ValueOfCF.{global_cf}"), 'found global_cf' );
++ok( !$form->find_input("ValueOfCF.{foo_cf}"), 'no foo_cf' );
++ok( !$form->find_input("ValueOfCF.{general_cf}"), 'no general_cf' );
+ $status_input = $form->find_input('ValueOfStatus');
+ @statuses = sort $status_input->possible_values;
+ is_deeply(
+ \@statuses, [ '', qw/initial new open rejected resolved stalled/],
+ 'found all statuses'
+ );
+ $owner_input = $form->find_input('ValueOfActor');
+ @owners = sort $owner_input->possible_values;
+ is_deeply(
+ \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+ );
+
+ diag "limit queue to General OR foo";
+ $m->get_ok( $url . '/Search/Edit.html' );
+ $m->submit_form(
+ form_name => 'BuildQueryAdvanced',
+ fields => { Query => q{Queue = 'General' OR Queue = 'foo'} },
+ );
+ $form = $m->form_name('BuildQuery');
-ok( $form->find_input("ValueOf'CF.{general_cf}'"), 'found general_cf' );
-ok( $form->find_input("ValueOf'CF.{foo_cf}'"), 'found foo_cf' );
-ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
++ok( $form->find_input("ValueOfCF.{general_cf}"), 'found general_cf' );
++ok( $form->find_input("ValueOfCF.{foo_cf}"), 'found foo_cf' );
++ok( $form->find_input("ValueOfCF.{global_cf}"), 'found global_cf' );
+ $status_input = $form->find_input('ValueOfStatus');
+ @statuses = sort $status_input->possible_values;
+ is_deeply(
+ \@statuses,
+ [ '', qw/initial new open rejected resolved stalled/ ],
+ 'found all statuses'
+ );
+ $owner_input = $form->find_input('ValueOfActor');
+ @owners = sort $owner_input->possible_values;
+ is_deeply(
+ \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+ );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list