[Rt-commit] rt branch, 4.0/upgrading-basedon, updated. rt-4.0.0-238-g207ec55
Alex Vandiver
alexmv at bestpractical.com
Wed May 18 21:11:07 EDT 2011
The branch, 4.0/upgrading-basedon has been updated
via 207ec55c250e46bd68bc26304db765333a5c7d26 (commit)
from 9d09522d2c256a5e6ce627670495d5165ae8a87b (commit)
Summary of changes:
etc/upgrade/3.9.7/content | 5 +++++
lib/RT/Record.pm | 15 ++++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit 207ec55c250e46bd68bc26304db765333a5c7d26
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed May 18 21:10:53 2011 -0400
Make attribute ordering consistent
diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index 337932a..504ddf1 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -30,6 +30,11 @@ my $move_attributes = sub {
$cfs->UnLimit;
$cfs->FindAllRows;
while ( my $cf = $cfs->Next ) {
+ # Explicitly remove 'ORDER BY id asc' to emulate the
+ # previous functionality, where Pg might return the the
+ # rows in arbitrary order
+ $cf->Attributes->OrderByCols();
+
my $attr = $cf->FirstAttribute('BasedOn');
next unless $attr;
$cf->SetBasedOn($attr->Content);
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index a2fb1e3..fcc7bed 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -152,13 +152,12 @@ Return this object's attributes as an RT::Attributes object
sub Attributes {
my $self = shift;
-
unless ($self->{'attributes'}) {
- $self->{'attributes'} = RT::Attributes->new($self->CurrentUser);
- $self->{'attributes'}->LimitToObject($self);
+ $self->{'attributes'} = RT::Attributes->new($self->CurrentUser);
+ $self->{'attributes'}->LimitToObject($self);
+ $self->{'attributes'}->OrderByCols({FIELD => 'id'});
}
- return ($self->{'attributes'});
-
+ return ($self->{'attributes'});
}
@@ -234,10 +233,8 @@ sub DeleteAttribute {
Returns the first attribute with the matching name for this object (as an
L<RT::Attribute> object), or C<undef> if no such attributes exist.
-
-Note that if there is more than one attribute with the matching name on the
-object, the choice of which one to return is basically arbitrary. This may be
-made well-defined in the future.
+If there is more than one attribute with the matching name on the
+object, the first value that was set is returned.
=cut
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list