[Rt-commit] rt branch, records_history, created. rt-3.8.8-104-gbe54c4a
Ruslan Zakirov
ruz at bestpractical.com
Wed Jun 30 00:13:28 EDT 2010
The branch, records_history has been created
at be54c4a037648121263eb199557061d3e128bc6d (commit)
- Log -----------------------------------------------------------------
commit 0d4ee78ffe180e15862b6b9c610c93d0f32be5fe
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Jun 18 13:46:37 2010 +0400
retab + minor refactoring
diff --git a/lib/RT/URI/fsck_com_rt.pm b/lib/RT/URI/fsck_com_rt.pm
index d6c194d..840a426 100755
--- a/lib/RT/URI/fsck_com_rt.pm
+++ b/lib/RT/URI/fsck_com_rt.pm
@@ -46,24 +46,16 @@
#
# END BPS TAGGED BLOCK }}}
-package RT::URI::fsck_com_rt;
-
-use RT::Ticket;
-
-use base 'RT::URI::base';
-
use strict;
+use warnings;
-
-
+package RT::URI::fsck_com_rt;
+use base 'RT::URI::base';
=head2 LocalURIPrefix
Returns the prefix for a local URI.
-
-
-
=cut
sub LocalURIPrefix {
@@ -84,20 +76,17 @@ sub ObjectType {
my $type = 'ticket';
if (ref($object) && (ref($object) ne 'RT::Ticket')) {
- $type = ref($object);
+ $type = ref($object);
}
return ($type);
}
-
-
=head2 URIForObject RT::Record
Returns the RT URI for a local RT::Record object
-
=cut
sub URIForObject {
@@ -119,6 +108,7 @@ sub ParseURI {
my $uri = shift;
if ( $uri =~ /^\d+$/ ) {
+ use RT::Ticket;
my $ticket = RT::Ticket->new( $self->CurrentUser );
$ticket->Load( $uri );
$self->{'uri'} = $ticket->URI;
@@ -160,23 +150,20 @@ sub ParseURI {
Returns true if this URI is for a local ticket.
Returns undef otherwise.
-
-
=cut
sub IsLocal {
- my $self = shift;
+ my $self = shift;
my $local_uri_prefix = $self->LocalURIPrefix;
if ( $self->{'uri'} =~ /^\Q$local_uri_prefix/i ) {
return 1;
}
- else {
- return undef;
- }
+ else {
+ return undef;
+ }
}
-
=head2 Object
Returns the object for this URI, if it's local. Otherwise returns undef.
@@ -186,7 +173,6 @@ Returns the object for this URI, if it's local. Otherwise returns undef.
sub Object {
my $self = shift;
return ($self->{'object'});
-
}
=head2 Scheme
@@ -198,7 +184,7 @@ Return the URI scheme for RT records
sub Scheme {
my $self = shift;
- return "fsck.com-rt";
+ return "fsck.com-rt";
}
=head2 HREF
@@ -211,12 +197,14 @@ Otherwise, return its URI
sub HREF {
my $self = shift;
- if ($self->IsLocal && $self->Object && ($self->ObjectType eq 'ticket')) {
- return ( RT->Config->Get('WebURL') . "Ticket/Display.html?id=".$self->Object->Id);
- }
- else {
- return ($self->URI);
+ return $self->URI unless $self->IsLocal;
+
+ my $obj = $self->Object;
+ if ( $obj && $self->ObjectType eq 'ticket' ) {
+ return RT->Config->Get('WebURL') ."Ticket/Display.html?id=". $obj->id;
}
+
+ return $self->URI;
}
=head2 AsString
@@ -228,10 +216,10 @@ Returns either a localized string 'ticket #23' or the full URI if the object is
sub AsString {
my $self = shift;
if ($self->IsLocal && $self->Object) {
- return $self->loc("[_1] #[_2]", $self->ObjectType, $self->Object->Id);
+ return $self->loc("[_1] #[_2]", $self->ObjectType, $self->Object->Id);
}
else {
- return $self->URI;
+ return $self->URI;
}
}
commit b0833b88848bd2abf1a95c492aceafffae05e7d2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Jun 18 13:48:24 2010 +0400
add links API tests
diff --git a/t/api/link.t b/t/api/link.t
index 1fd66bb..eac9ae2 100644
--- a/t/api/link.t
+++ b/t/api/link.t
@@ -1,24 +1,209 @@
use strict;
use warnings;
-use RT;
-use RT::Test tests => 5;
-
-
-{
+use RT::Test tests => 77;
+use RT::Test::Web;
use RT::Link;
my $link = RT::Link->new($RT::SystemUser);
ok (ref $link);
-ok (UNIVERSAL::isa($link, 'RT::Link'));
-ok (UNIVERSAL::isa($link, 'RT::Base'));
-ok (UNIVERSAL::isa($link, 'RT::Record'));
-ok (UNIVERSAL::isa($link, 'DBIx::SearchBuilder::Record'));
+isa_ok( $link, 'RT::Link');
+isa_ok( $link, 'RT::Base');
+isa_ok( $link, 'RT::Record');
+isa_ok( $link, 'DBIx::SearchBuilder::Record');
+
+my $queue = RT::Test->load_or_create_queue(Name => 'General');
+ok($queue->Id, "loaded the General queue");
+
+my $parent = RT::Ticket->new($RT::SystemUser);
+my ($pid, undef, $msg) = $parent->Create(
+ Queue => $queue->id,
+ Subject => 'parent',
+);
+ok $pid, 'created a ticket #'. $pid or diag "error: $msg";
+
+my $child = RT::Ticket->new($RT::SystemUser);
+my ($cid, undef, $msg) = $child->Create(
+ Queue => $queue->id,
+ Subject => 'child',
+);
+ok $cid, 'created a ticket #'. $cid or diag "error: $msg";
+
+{
+ clean_links();
+ my ($status, $msg) = $parent->AddLink;
+ ok(!$status, "didn't create a link: $msg");
+
+ ($status, $msg) = $parent->AddLink( Base => $parent->id );
+ ok(!$status, "didn't create a link: $msg");
+
+ ($status, $msg) = $parent->AddLink( Base => $parent->id, Type => 'HasMember' );
+ ok(!$status, "didn't create a link: $msg");
+}
+
+{
+ clean_links();
+ my ($status, $msg) = $parent->AddLink(
+ Type => 'MemberOf', Base => $child->id,
+ );
+ ok($status, "created a link: $msg");
+
+ my $children = $parent->Members;
+ $children->RedoSearch; $children->GotoFirstItem;
+ is $children->Count, 1, 'link is there';
+
+ my $link = $children->First;
+ ok $link->id, 'correct link';
+
+ is $link->Type, 'MemberOf', 'type';
+ is $link->LocalTarget, $parent->id, 'local target';
+ is $link->LocalBase, $child->id, 'local base';
+ is $link->Target, 'fsck.com-rt://example.com/ticket/'. $parent->id, 'local target';
+ is $link->Base, 'fsck.com-rt://example.com/ticket/'. $child->id, 'local base';
+
+ isa_ok $link->TargetObj, 'RT::Ticket';
+ is $link->TargetObj->id, $parent->id, 'correct ticket';
+
+ isa_ok $link->TargetURI, 'RT::URI';
+ is $link->TargetURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->TargetURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $parent->id,
+ 'correct URI'
+ ;
+ ok $link->TargetURI->IsLocal, 'local object';
+ is $link->TargetURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $parent->id,
+ 'correct href'
+ ;
+
+ isa_ok $link->BaseObj, 'RT::Ticket';
+ is $link->BaseObj->id, $child->id, 'correct ticket';
+
+ isa_ok $link->BaseURI, 'RT::URI';
+ is $link->BaseURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->BaseURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $child->id,
+ 'correct URI'
+ ;
+ ok $link->BaseURI->IsLocal, 'local object';
+ is $link->BaseURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $child->id,
+ 'correct href'
+ ;
+}
+
+{
+ clean_links();
+ my ($status, $msg) = $parent->AddLink(
+ Type => 'MemberOf', Base => $child->URI,
+ );
+ ok($status, "created a link: $msg");
+
+ my $children = $parent->Members;
+ $children->RedoSearch; $children->GotoFirstItem;
+ is $children->Count, 1, 'link is there';
+
+ my $link = $children->First;
+ ok $link->id, 'correct link';
+
+ is $link->Type, 'MemberOf', 'type';
+ is $link->LocalTarget, $parent->id, 'local target';
+ is $link->LocalBase, $child->id, 'local base';
+ is $link->Target, 'fsck.com-rt://example.com/ticket/'. $parent->id, 'local target';
+ is $link->Base, 'fsck.com-rt://example.com/ticket/'. $child->id, 'local base';
+
+ isa_ok $link->TargetObj, 'RT::Ticket';
+ is $link->TargetObj->id, $parent->id, 'correct ticket';
+
+ isa_ok $link->TargetURI, 'RT::URI';
+ is $link->TargetURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->TargetURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $parent->id,
+ 'correct URI'
+ ;
+ ok $link->TargetURI->IsLocal, 'local object';
+ is $link->TargetURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $parent->id,
+ 'correct href'
+ ;
+
+ isa_ok $link->BaseObj, 'RT::Ticket';
+ is $link->BaseObj->id, $child->id, 'correct ticket';
+
+ isa_ok $link->BaseURI, 'RT::URI';
+ is $link->BaseURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->BaseURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $child->id,
+ 'correct URI'
+ ;
+ ok $link->BaseURI->IsLocal, 'local object';
+ is $link->BaseURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $child->id,
+ 'correct href'
+ ;
+}
+
+{
+ clean_links();
+ my ($status, $msg) = $parent->AddLink(
+ Type => 'MemberOf', Base => 't:'. $child->id,
+ );
+ ok($status, "created a link: $msg");
+
+ my $children = $parent->Members;
+ $children->RedoSearch; $children->GotoFirstItem;
+ is $children->Count, 1, 'link is there';
+
+ my $link = $children->First;
+ ok $link->id, 'correct link';
+ is $link->Type, 'MemberOf', 'type';
+ is $link->LocalTarget, $parent->id, 'local target';
+ is $link->LocalBase, $child->id, 'local base';
+ is $link->Target, 'fsck.com-rt://example.com/ticket/'. $parent->id, 'local target';
+ is $link->Base, 'fsck.com-rt://example.com/ticket/'. $child->id, 'local base';
+
+ isa_ok $link->TargetObj, 'RT::Ticket';
+ is $link->TargetObj->id, $parent->id, 'correct ticket';
+
+ isa_ok $link->TargetURI, 'RT::URI';
+ is $link->TargetURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->TargetURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $parent->id,
+ 'correct URI'
+ ;
+ ok $link->TargetURI->IsLocal, 'local object';
+ is $link->TargetURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $parent->id,
+ 'correct href'
+ ;
+
+ isa_ok $link->BaseObj, 'RT::Ticket';
+ is $link->BaseObj->id, $child->id, 'correct ticket';
+
+ isa_ok $link->BaseURI, 'RT::URI';
+ is $link->BaseURI->Scheme, 'fsck.com-rt', 'correct scheme';
+ is $link->BaseURI->URI,
+ 'fsck.com-rt://example.com/ticket/'. $child->id,
+ 'correct URI'
+ ;
+ ok $link->BaseURI->IsLocal, 'local object';
+ is $link->BaseURI->AsHREF,
+ RT::Test::Web->rt_base_url .'Ticket/Display.html?id='. $child->id,
+ 'correct href'
+ ;
+}
+sub clean_links {
+ my $links = RT::Links->new( $RT::SystemUser );
+ while ( my $link = $links->Next ) {
+ my ($status, $msg) = $link->Delete;
+ $RT::Logger->error("Couldn't delete a link: $msg")
+ unless $status;
+ }
}
1;
commit 977e435b886e27a7316227ad91da4e7620525464
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Jun 18 13:49:40 2010 +0400
make t: links just an alias for fsck_com_rt:, fix local detection
diff --git a/lib/RT/URI/t.pm b/lib/RT/URI/t.pm
index 9b0dcbe..47805b8 100644
--- a/lib/RT/URI/t.pm
+++ b/lib/RT/URI/t.pm
@@ -69,48 +69,33 @@
#
#
# END LICENSE BLOCK
-package RT::URI::t;
-
-use RT::Ticket;
-use RT::URI::base;
use strict;
+use warnings;
+
+package RT::URI::t;
use base 'RT::URI::fsck_com_rt';
-my $scheme = "t";
+=head1 NAME
+
+RT::URI::t - aliad for RT::URI::fsck_com_rt that supports 't:12345' URIs
=head2 ParseURI URI
When handed an t: URI, figures out if it is an RT ticket. This is an
alternate short form of specifying a full ticket URI.
-
=cut
sub ParseURI {
my $self = shift;
my $uri = shift;
- # "t:<articlenum>"
# Pass this off to fsck_com_rt, which is equipped to deal with
# tickets after stripping off the t: prefix.
- if ($uri =~ /^$scheme:(\d+)/) {
- return $self->SUPER::ParseURI($1);
- } else {
- $self->{'uri'} = $uri;
- return undef;
- }
-}
-
-=head2 Scheme
-
-Return the URI scheme
-
-=cut
-
-sub Scheme {
- return $scheme;
+ $uri =~ s/^t://;
+ return $self->SUPER::ParseURI($uri);
}
1;
commit 6e3a9d91fb91ebb2a043f5d66ecc8dbb717051cb
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Jun 19 02:49:27 2010 +0400
upgrade script that deals with local links that are not local
diff --git a/etc/upgrade/3.8.9/content b/etc/upgrade/3.8.9/content
new file mode 100644
index 0000000..5c42b78
--- /dev/null
+++ b/etc/upgrade/3.8.9/content
@@ -0,0 +1,40 @@
+ at Initial = (
+ sub {
+ use strict;
+ $RT::Logger->debug('Make sure local links are local');
+
+ use RT::URI::fsck_com_rt;
+ my $prefix = RT::URI::fsck_com_rt->LocalURIPrefix . '/ticket/';
+
+ foreach my $dir (qw(Target Base)) {
+ my $found;
+ do {
+ $found = 0;
+ my $links = RT::Links->new( $RT::SystemUser );
+ $links->Limit( FIELD => $dir, OPERATOR => 'STARTSWITH', VALUE => $prefix );
+ $links->Limit( FIELD => 'Local'.$dir, VALUE => 0 );
+ $links->Limit(
+ ENTRYAGGREGATOR => 'OR',
+ FIELD => 'Local'.$dir,
+ OPERATOR => 'IS',
+ VALUE => 'NULL',
+ );
+ $links->RowsPerPage( 1000 );
+ while ( my $link = $links->Next ) {
+ $found++;
+ my $uri = $link->$dir();
+ $uri =~ s/^\Q$prefix//;
+ if ( int($uri) eq $uri && $uri > 0 ) {
+ my $method = 'SetLocal'. $dir;
+ my ($status, $msg) = $link->$method( $uri );
+ unless ( $status ) {
+ die "Couldn't change local $dir: $msg";
+ }
+ } else {
+ die "$dir URI looks like local, but is not parseable";
+ }
+ }
+ } while $found == 1000;
+ }
+ },
+);
commit 8a5647b9db225deef563bb989f4172ccff08ba40
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Jun 22 14:52:46 2010 +0800
escape < and > for graphviz labels
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 77a0ce5..512668d 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -233,7 +233,7 @@ sub AddTicket {
my @fields = $self->_PropertiesToFields( %args );
if ( @fields ) {
unshift @fields, $args{'Ticket'}->id;
- my $label = join ' | ', map { s/(?=[{}|])/\\/g; $_ } @fields;
+ my $label = join ' | ', map { s/(?=[{}|><])/\\/g; $_ } @fields;
$label = "{ $label }" if ($args{'Direction'} || 'TB') =~ /^(?:TB|BT)$/;
$node_style{'label'} = gv_escape( $label );
$node_style{'shape'} = 'record';
commit 45a18e0cb2c541562d09893a7fc1418f462862db
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Jun 22 15:16:04 2010 +0800
tweak AdminComment template: remove /^RE:\s*/, also spaces after [Comment], see also #14924
diff --git a/etc/initialdata b/etc/initialdata
index 89db2cc..c29f627 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -270,7 +270,7 @@ you may reply to this message.
Name => 'Admin Comment', # loc
Description => 'Default admin comment template', # loc
Content =>
-'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $s =~ s/^Re//i; $s;}
+'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]\\s*//g; $s =~ s/^Re:\\s*//i; $s;}
RT-Attach-Message: yes
commit 4b18e2f094154a506cd7c916501324c2f972d63f
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Tue Jun 22 13:37:08 2010 +0200
New right "AdminCustomFieldValues" on Customfields to allow delegation of adding/modifying/removing CustomFields Values
diff --git a/lib/RT/CustomFieldValue_Overlay.pm b/lib/RT/CustomFieldValue_Overlay.pm
index 5511e52..9fe6c55 100644
--- a/lib/RT/CustomFieldValue_Overlay.pm
+++ b/lib/RT/CustomFieldValue_Overlay.pm
@@ -79,7 +79,7 @@ sub Create {
unless ( $cf->id ) {
return (0, $self->loc("Couldn't load Custom Field #[_1]", $cf_id));
}
- unless ( $cf->CurrentUserHasRight('AdminCustomField') ) {
+ unless ( $cf->CurrentUserHasRight('AdminCustomField') || $cf->CurrentUserHasRight('AdminCustomFieldValues') ) {
return (0, $self->loc('Permission Denied'));
}
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 355dd20..e156227 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -112,6 +112,7 @@ RT::CustomField->_ForObjectType( 'RT::Group' => "Groups", );
our $RIGHTS = {
SeeCustomField => 'See custom fields', # loc_pair
AdminCustomField => 'Create, delete and modify custom fields', # loc_pair
+ AdminCustomFieldValues => 'Create, delete and modify custom fields values', # loc_pair
ModifyCustomField => 'Add, delete and modify custom field values for objects' #loc_pair
};
@@ -400,7 +401,7 @@ sub AddValue {
my $self = shift;
my %args = @_;
- unless ($self->CurrentUserHasRight('AdminCustomField')) {
+ unless ($self->CurrentUserHasRight('AdminCustomField') || $self->CurrentUserHasRight('AdminCustomFieldValues')) {
return (0, $self->loc('Permission Denied'));
}
@@ -429,7 +430,7 @@ Does not remove this value for any article which has had it selected
sub DeleteValue {
my $self = shift;
my $id = shift;
- unless ( $self->CurrentUserHasRight('AdminCustomField') ) {
+ unless ( $self->CurrentUserHasRight('AdminCustomField') || $self->CurrentUserHasRight('AdminCustomFieldValues') ) {
return (0, $self->loc('Permission Denied'));
}
diff --git a/lib/RT/I18N/fr.po b/lib/RT/I18N/fr.po
index 8f5aa6f..622ff2e 100755
--- a/lib/RT/I18N/fr.po
+++ b/lib/RT/I18N/fr.po
@@ -790,6 +790,10 @@ msgstr "AdminCcs"
msgid "AdminCustomField"
msgstr "GérerChampPersonnalisé"
+#: lib/RT/CustomField_Overlay.pm:115
+msgid "AdminCustomFieldValues"
+msgstr "GérerValeursDeChampPersonnalisé"
+
#: lib/RT/Group_Overlay.pm:87
msgid "AdminGroup"
msgstr "GérerGroupes"
@@ -1784,6 +1788,10 @@ msgstr "Créer des tickets hors-ligne"
msgid "Create, delete and modify custom fields"
msgstr "Ajouter, supprimer et modifier des champs personnalisés"
+#: lib/RT/CustomField_Overlay.pm:115
+msgid "Create, delete and modify custom fields values"
+msgstr "Ajouter, supprimer et modifier des valeurs de champs personnalisés"
+
#: lib/RT/Queue_Overlay.pm:88
msgid "Create, delete and modify queues"
msgstr "Ajouter, supprimer et modifier les files"
diff --git a/share/html/Admin/Elements/CustomFieldTabs b/share/html/Admin/Elements/CustomFieldTabs
index 30f5adf..fb95394 100644
--- a/share/html/Admin/Elements/CustomFieldTabs
+++ b/share/html/Admin/Elements/CustomFieldTabs
@@ -88,10 +88,10 @@ if ($id) {
}
}
-if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) {
$tabs->{"A"} = { title => loc('Select'),
path => "Admin/CustomFields/",
};
+if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) {
$tabs->{"B"} = { title => loc('Create'),
path => "Admin/CustomFields/Modify.html?Create=1",
separator => 1,
commit 79599d4d8880050b93ac9e4d1b774b82685309d6
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Tue Jun 22 16:58:53 2010 +0200
Show CustomField configuration tab only if user has right to change something (broken behaviour in previous commit)
diff --git a/share/html/Admin/Elements/CustomFieldTabs b/share/html/Admin/Elements/CustomFieldTabs
index fb95394..627877f 100644
--- a/share/html/Admin/Elements/CustomFieldTabs
+++ b/share/html/Admin/Elements/CustomFieldTabs
@@ -88,9 +88,12 @@ if ($id) {
}
}
+if ( $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')
+ || $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomFieldValues') ) {
$tabs->{"A"} = { title => loc('Select'),
path => "Admin/CustomFields/",
};
+}
if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) {
$tabs->{"B"} = { title => loc('Create'),
path => "Admin/CustomFields/Modify.html?Create=1",
commit d9394159614ef51c575aa0af82921385905928f4
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Thu Jun 24 14:32:06 2010 +0200
Don't say a saved search has been deleted if it's not true because user has no right to do it.
diff --git a/share/html/Search/Elements/EditSearches b/share/html/Search/Elements/EditSearches
index 62871fd..07139a6 100644
--- a/share/html/Search/Elements/EditSearches
+++ b/share/html/Search/Elements/EditSearches
@@ -180,7 +180,11 @@ elsif ( $ARGS{'SavedSearchDelete'} ) {
my ($container, $id) = _parse_saved_search( $SavedSearch->{'Id'} );
if ( $container && $container->id ) {
# We have the object the entry is an attribute on; delete the entry...
- $container->Attributes->DeleteEntry( Name => 'SavedSearch', id => $id );
+ my ($val, $msg) = $container->Attributes->DeleteEntry( Name => 'SavedSearch', id => $id );
+ unless ( $val ) {
+ push @results, $msg;
+ return @results;
+ }
}
$SavedSearch->{'Id'} = 'new';
$SavedSearch->{'Object'} = undef;
commit c8f0e722c5cb81e72e2e3abc89ddfc0c396bc0f7
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Thu Jun 24 15:03:48 2010 +0200
Fix "update" permissions for SavedSearch that allowed people to modify a group saved search without EditSavedSearches on it
diff --git a/lib/RT/Attribute_Overlay.pm b/lib/RT/Attribute_Overlay.pm
index 4d201da..c93c153 100644
--- a/lib/RT/Attribute_Overlay.pm
+++ b/lib/RT/Attribute_Overlay.pm
@@ -73,7 +73,7 @@ our $ACL_MAP = {
};
# There are a number of attributes that users should be able to modify for themselves, such as saved searches
-# we could do this with a different set of "modify" rights, but that gets very hacky very fast. this is even faster and even
+# we could do this with a different set of "update" rights, but that gets very hacky very fast. this is even faster and even
# hackier. we're hardcoding that a different set of rights are needed for attributes on oneself
our $PERSONAL_ACL_MAP = {
SavedSearch => { create => 'ModifySelf',
@@ -393,7 +393,7 @@ sub _Value {
sub _Set {
my $self = shift;
- unless ($self->CurrentUserHasRight('modify')) {
+ unless ($self->CurrentUserHasRight('update')) {
return (0,$self->loc('Permission Denied'));
}
@@ -404,7 +404,7 @@ sub _Set {
=head2 CurrentUserHasRight
-One of "display" "modify" "delete" or "create" and returns 1 if the user has that right for attributes of this name for this object.Returns undef otherwise.
+One of "display" "update" "delete" or "create" and returns 1 if the user has that right for attributes of this name for this object.Returns undef otherwise.
=cut
commit fbbea56f36f87b8907036f1349eee5d99ed9056a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jun 28 15:26:42 2010 +0800
not allow heading and trailing spaces for CustomFieldValues, as ObjectCustomFieldValues doesn't allow that anyway
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index f75607a..5662226 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -199,6 +199,8 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
foreach my $attr qw(Name Description SortOrder Category) {
my $param = join("-", $paramtag, $value->Id, $attr);
next unless exists $ARGS{$param};
+ $ARGS{$param} =~ s/^\s+//;
+ $ARGS{$param} =~ s/\s+$//;
next if ($value->$attr()||'') eq ($ARGS{$param}||'');
my $mutator = "Set$attr";
@@ -210,8 +212,10 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
# Add any new values
if ( defined $ARGS{ $paramtag ."-new-Name" } && length $ARGS{ $paramtag ."-new-Name" } ) {
my ($id, $msg) = $CustomFieldObj->AddValue(
- map { $_ => $ARGS{ $paramtag ."-new-$_" } }
- qw( Name Description SortOrder Category )
+ map {
+ $ARGS{$paramtag."-new-$_"} =~ s/^\s+//;
+ $ARGS{$paramtag."-new-$_"} =~ s/\s+$//;
+ $_ => $ARGS{ $paramtag ."-new-$_" } } qw/ Name Description SortOrder Category/
);
push (@results, $msg);
}
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index 39a8080..26c1fcf 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 41;
+use RT::Test tests => 46;
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
@@ -31,9 +31,9 @@ diag "Create a CF" if $ENV{'TEST_VERBOSE'};
ok $cfid, "found id of the CF in the form, it's #$cfid";
}
-diag "add 'qwe', 'ASD' and '0' as values to the CF" if $ENV{'TEST_VERBOSE'};
+diag "add 'qwe', 'ASD', '0' and ' foo ' as values to the CF" if $ENV{'TEST_VERBOSE'};
{
- foreach my $value(qw(qwe ASD 0)) {
+ foreach my $value(qw(qwe ASD 0), 'foo ') {
$m->submit_form(
form_name => "ModifyCustomField",
fields => {
@@ -42,6 +42,10 @@ diag "add 'qwe', 'ASD' and '0' as values to the CF" if $ENV{'TEST_VERBOSE'};
button => 'Update',
);
$m->content_like( qr/Object created/, 'added a value to the CF' ); # or diag $m->content;
+ my $v = $value;
+ $v =~ s/^\s+$//;
+ $v =~ s/\s+$//;
+ $m->content_like( qr/value="$v"/, 'the added value is right' );
}
}
commit 4313c4b943e7b6c365ee46bcf9d353e91f1bd1a4
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jun 28 16:00:55 2010 +0800
better msg for the 'can not parse links' error
diff --git a/lib/RT/URI.pm b/lib/RT/URI.pm
index 70654e1..b11ae72 100755
--- a/lib/RT/URI.pm
+++ b/lib/RT/URI.pm
@@ -144,7 +144,10 @@ sub FromURI {
$self->_GetResolver($scheme);
unless ($self->Resolver->ParseURI($uri)) {
- $RT::Logger->warning("Resolver ".ref($self->Resolver)." could not parse $uri");
+ $RT::Logger->warning( "Resolver "
+ . ref( $self->Resolver )
+ . " could not parse $uri, maybe Organization config was changed?"
+ );
$self->{resolver} = RT::URI::base->new( $self->CurrentUser ); # clear resolver
return (undef);
}
diff --git a/share/html/Elements/MyReminders b/share/html/Elements/MyReminders
index 53e3f99..662c7c2 100755
--- a/share/html/Elements/MyReminders
+++ b/share/html/Elements/MyReminders
@@ -55,6 +55,7 @@
% $i++;
% if ($reminder->RefersTo->First) {
% my $ticket= $reminder->RefersTo->First->TargetObj;
+% if ( $ticket ) {
<tr class="<%$i%2 ? 'evenline' : 'oddline'%>"><td><a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$ticket->id%>"><%$reminder->Subject%></a><br />
<blockquote>
#<%$ticket->id%>: <%$ticket->Subject%><br />
@@ -62,7 +63,13 @@
</blockquote>
</td>
</tr>
-% }}
+% }
+% else {
+ <div class="error"><div class="error">
+Couldn't find TargetObj for reminder <% $reminder->id %>.<br/>
+Maybe Organization config was changed? Please contact administrator.
+ </div></div>
+% }}}
</table>
</&>
commit 9a9514e219cd94e9d98ba72cb8f2a0ee2b834fca
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Mon Jun 28 11:59:09 2010 -0400
Better wording for this config warning
the middle sentence still wants work
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 6134716..051117a 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -797,8 +797,8 @@ sub SetFromConfig {
# RTIR's options is set in main site config or RTFM's
warn
"Change of config option '$name' at $args{'File'} line $args{'Line'} has been ignored."
- ." It's may be ok, but we want you to be aware."
- ." This option earlier has been set in $source{'File'} line $source{'Line'}."
+ ." It may be ok, but we want you to be aware."
+ ." This option has been set earlier in $source{'File'} line $source{'Line'}."
;
}
commit 88396dead2fe8549e89f5bffde5779fd31975469
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Mon Jun 28 16:50:24 2010 -0400
Better document what this feature does
Otherwise people think this is a replacement for
CorrespondAddress/CommentAddress
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 109f1fb..de268bb 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -399,8 +399,11 @@ Set($SetOutgoingMailFrom, 0);
=item C<$OverrideOutgoingMailFrom>
C<$OverrideOutgoingMailFrom> is used for overwriting the Correspond
-address of the queue. The option is a hash reference of queue name to
-email address.
+address of the queue as it is handed to sendmail -f. This helps force
+the From_ header away from www-data or other email addresses that show
+up in the "Sent by" line in Outlook.
+
+The option is a hash reference of queue name to email address.
If there is no ticket involved, then the value of the C<Default> key will be
used.
commit be54c4a037648121263eb199557061d3e128bc6d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Jun 29 20:18:11 2010 +0400
use LimitNotEmpty method as on Oracle CLOB != '' is bad
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index d1630ea..c1821bc 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -560,11 +560,7 @@ sub ContentAsMIME {
OPERATOR => 'NOT STARTSWITH',
VALUE => 'multipart/',
);
- $attachments->Limit(
- FIELD => 'Content',
- OPERATOR => '!=',
- VALUE => '',
- );
+ $attachments->LimitNotEmpty;
while ( my $a = $attachments->Next ) {
$entity->make_multipart unless $entity->is_multipart;
$entity->add_part( $a->ContentAsMIME );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list