[Rt-commit] rt branch, 3.8-trunk, updated. ec690175bd9c80da2733c30c4c2933b1291fb43d
Ruslan Zakirov
ruz at bestpractical.com
Wed Aug 19 13:45:48 EDT 2009
The branch, 3.8-trunk has been updated
via ec690175bd9c80da2733c30c4c2933b1291fb43d (commit)
via 945436b39085d919fd2b17ec9879da8195603df4 (commit)
via b93a4855007569d23f64455f672bd4ae647f0891 (commit)
via 631d7220c7bf15f65ceeb476435f71d2e4e5f179 (commit)
via 0d2884a7769bf894ea54067c561f6c4fbb8e3fd7 (commit)
from fc668bfe85dbf11f6bcf28f8803ce80cd34ea3ff (commit)
Summary of changes:
lib/RT/CustomField_Overlay.pm | 4 +-
lib/RT/ObjectCustomFieldValue_Overlay.pm | 34 +++++++++++++++++++----------
lib/RT/Test.pm | 32 ++++++++++++++++++++++------
lib/RT/Tickets_Overlay.pm | 32 +++++++++++++++++++--------
4 files changed, 71 insertions(+), 31 deletions(-)
- Log -----------------------------------------------------------------
commit 0d2884a7769bf894ea54067c561f6c4fbb8e3fd7
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Wed Aug 19 18:12:02 2009 +0400
* in some cases MaxValues can be undef what means 0 - unlimitted
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 0af2fd0..6bf7eda 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -652,7 +652,7 @@ Returns false if it accepts multiple values
sub SingleValue {
my $self = shift;
- if ($self->MaxValues == 1) {
+ if (($self->MaxValues||0) == 1) {
return 1;
}
else {
@@ -662,7 +662,7 @@ sub SingleValue {
sub UnlimitedValues {
my $self = shift;
- if ($self->MaxValues == 0) {
+ if (($self->MaxValues||0) == 0) {
return 1;
}
else {
commit 631d7220c7bf15f65ceeb476435f71d2e4e5f179
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Wed Aug 19 18:14:55 2009 +0400
fix regression in performace of searches by Owner.x
When x is id or Name and operator is not range op then
tickets should be searched using main table(tickets) instead
of using long joins via CGM tables
diff --git a/lib/RT/Tickets_Overlay.pm b/lib/RT/Tickets_Overlay.pm
index 40b4624..b8f9756 100755
--- a/lib/RT/Tickets_Overlay.pm
+++ b/lib/RT/Tickets_Overlay.pm
@@ -804,16 +804,28 @@ sub _WatcherLimit {
# Owner was ENUM field, so "Owner = 'xxx'" allowed user to
# search by id and Name at the same time, this is workaround
# to preserve backward compatibility
- if ( $field eq 'Owner' && !$rest{SUBKEY} && $op =~ /^!?=$/ ) {
- my $o = RT::User->new( $self->CurrentUser );
- $o->Load( $value );
- $self->_SQLLimit(
- FIELD => 'Owner',
- OPERATOR => $op,
- VALUE => $o->Id,
- %rest,
- );
- return;
+ if ( $field eq 'Owner' ) {
+ if ( $op =~ /^!?=$/ && (!$rest{'SUBKEY'} || $rest{'SUBKEY'} eq 'Name' || $rest{'SUBKEY'} eq 'EmailAddress') ) {
+ my $o = RT::User->new( $self->CurrentUser );
+ my $method = ($rest{'SUBKEY'}||'') eq 'EmailAddress' ? 'LoadByEmail': 'Load';
+ $o->$method( $value );
+ $self->_SQLLimit(
+ FIELD => 'Owner',
+ OPERATOR => $op,
+ VALUE => $o->id,
+ %rest,
+ );
+ return;
+ }
+ if ( ($rest{'SUBKEY'}||'') eq 'id' ) {
+ $self->_SQLLimit(
+ FIELD => 'Owner',
+ OPERATOR => $op,
+ VALUE => $value,
+ %rest,
+ );
+ return;
+ }
}
$rest{SUBKEY} ||= 'EmailAddress';
commit b93a4855007569d23f64455f672bd4ae647f0891
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Wed Aug 19 18:17:25 2009 +0400
refactor schema intialization for tests
some extensions may not have schema, ACLs or data, avoid errors
and some annoying warnings
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 3661e1d..f32b720 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -331,15 +331,33 @@ sub bootstrap_plugins {
my $plugin = RT::Plugin->new( name => $name );
Test::More::diag( "Initializing DB for the $name plugin" )
if $ENV{'TEST_VERBOSE'};
- Test::More::diag( "etc path of the plugin is '". $plugin->Path('etc') ."'" )
+
+ my $etc_path = $plugin->Path('etc');
+ Test::More::diag( "etc path of the plugin is '$etc_path'" )
if $ENV{'TEST_VERBOSE'};
- my ($ret, $msg) = $RT::Handle->InsertSchema( undef, $plugin->Path('etc') );
- Test::More::ok($ret || $msg =~ /^Couldn't find schema/, "Created schema: ".($msg||''));
- ($ret, $msg) = $RT::Handle->InsertACL( undef, $plugin->Path('etc') );
- Test::More::ok($ret || $msg =~ /^Couldn't find ACLs/, "Created ACL: ".($msg||''));
- ($ret, $msg) = $RT::Handle->InsertData( File::Spec->catfile( $plugin->Path('etc'), 'initialdata' ) );
- Test::More::ok($ret || $msg =~ /^Couldn't load data from/, "Inserted data: ".($msg||''));
+ if ( -e $etc_path ) {
+ my ($ret, $msg) = $RT::Handle->InsertSchema( undef, $etc_path );
+ Test::More::ok($ret || $msg =~ /^Couldn't find schema/, "Created schema: ".($msg||''));
+
+ ($ret, $msg) = $RT::Handle->InsertACL( undef, $etc_path );
+ Test::More::ok($ret || $msg =~ /^Couldn't find ACLs/, "Created ACL: ".($msg||''));
+
+ my $data_file = File::Spec->catfile( $etc_path, 'initialdata' );
+ if ( -e $data_file ) {
+ ($ret, $msg) = $RT::Handle->InsertData( $data_file );;
+ Test::More::ok($ret, "Inserted data".($msg||''));
+ } else {
+ Test::More::ok(1, "There is no data file" );
+ }
+ }
+ else {
+# we can not say if plugin has no data or we screwed with etc path
+ Test::More::ok(1, "There is no etc dir: no schema" );
+ Test::More::ok(1, "There is no etc dir: no ACLs" );
+ Test::More::ok(1, "There is no etc dir: no data" );
+ }
+
$RT::Handle->Connect; # XXX: strange but mysql can loose connection
}
}
commit 945436b39085d919fd2b17ec9879da8195603df4
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Wed Aug 19 19:45:17 2009 +0400
make it possible to use Web* in LinkValueTo
For self-referencing linking of CF values it's important to be able
to use __WebPath__ in the template
diff --git a/lib/RT/ObjectCustomFieldValue_Overlay.pm b/lib/RT/ObjectCustomFieldValue_Overlay.pm
index 6075f4f..37ad056 100644
--- a/lib/RT/ObjectCustomFieldValue_Overlay.pm
+++ b/lib/RT/ObjectCustomFieldValue_Overlay.pm
@@ -211,31 +211,41 @@ The id of the object in question.
The value of this custom field for the object in question.
+=item __WebDomain__, __WebPort__, __WebPath__, __WebBaseURL__ and __WebURL__
+
+The value of the config option.
+
=back
=cut
+{
+my %placeholders = (
+ id => { value => sub { $_[0]->ObjectId }, escape => 1 },
+ CustomField => { value => sub { $_[0]->Content }, escape => 1 },
+ WebDomain => { value => sub { RT->Config->Get('WebDomain') } },
+ WebPort => { value => sub { RT->Config->Get('WebPort') } },
+ WebPath => { value => sub { RT->Config->Get('WebPath') } },
+ WebBaseURL => { value => sub { RT->Config->Get('WebBaseURL') } },
+ WebURL => { value => sub { RT->Config->Get('WebURL') } },
+);
+
sub _FillInTemplateURL {
my $self = shift;
my $url = shift;
- my %placeholders = (
- id => $self->ObjectId,
- CustomField => $self->Content,
- );
-
# default value, uri-escape
for my $key (keys %placeholders) {
- my $value = $placeholders{$key};
-
- $value = '' if !defined($value);
- RT::Interface::Web::EscapeURI(\$value);
-
- $url =~ s/__${key}__/$value/g;
+ $url =~ s{__${key}__}{
+ my $value = $placeholders{$key}{'value'}->( $self );
+ $value = '' if !defined($value);
+ RT::Interface::Web::EscapeURI(\$value) if $placeholders{$key}{'escape'};
+ $value
+ }gxe;
}
return $url;
-}
+} }
=head2 ValueLinkURL
commit ec690175bd9c80da2733c30c4c2933b1291fb43d
Merge: 945436b fc668bf
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Wed Aug 19 21:45:31 2009 +0400
Merge branch '3.8-trunk' of git+ssh://diesel.bestpractical.com/git/rt into 3.8-trunk
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list