[Rt-commit] rt branch, 4.0/saner-articles-order-before-msgbox, updated. rt-4.0.4-80-gd336e0e

Ruslan Zakirov ruz at bestpractical.com
Fri Dec 23 11:25:04 EST 2011


The branch, 4.0/saner-articles-order-before-msgbox has been updated
       via  d336e0e822fde9aff19dfc385ad8e78223090769 (commit)
      from  9224a546788fba4cd66d427e418944267635bb31 (commit)

Summary of changes:
 lib/RT/Articles.pm                            |    9 +++++++++
 share/html/Articles/Elements/BeforeMessageBox |    4 ----
 2 files changed, 9 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit d336e0e822fde9aff19dfc385ad8e78223090769
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Dec 23 19:10:36 2011 +0400

    default sane ordering for Articles
    
    put OrderBy into ::Articles::_Init instead of greping
    for all places where we need sort articles

diff --git a/lib/RT/Articles.pm b/lib/RT/Articles.pm
index b25c514..ddd5074 100644
--- a/lib/RT/Articles.pm
+++ b/lib/RT/Articles.pm
@@ -55,6 +55,15 @@ use base 'RT::SearchBuilder';
 
 sub Table {'Articles'}
 
+sub _Init {
+    my $self = shift;
+    $self->OrderByCols(
+        { FIELD => 'SortOrder', ORDER => 'ASC' },
+        { FIELD => 'Name',      ORDER => 'ASC' },
+    );
+    return $self->SUPER::_Init( @_ );
+}
+
 =head2 Next
 
 Returns the next article that this user can see.
diff --git a/share/html/Articles/Elements/BeforeMessageBox b/share/html/Articles/Elements/BeforeMessageBox
index b1c0c21..6d2cc96 100644
--- a/share/html/Articles/Elements/BeforeMessageBox
+++ b/share/html/Articles/Elements/BeforeMessageBox
@@ -192,10 +192,6 @@ if ( my $tmp = $ARGS{ $name_prefix ."Articles_Content" } ) {
                              VALUE           => $tmp,
                              ENTRYAGGREGATOR => "OR" );
     $articles_basics->LimitAppliedClasses( Queue => $QueueObj );
-    $articles_basics->OrderByCols(
-        { FIELD => 'SortOrder', ORDER => 'ASC' },
-        { FIELD => 'Name',      ORDER => 'ASC' },
-    );
 }
 
 my $hotlist = RT::Articles->new( $session{'CurrentUser'} );

-----------------------------------------------------------------------


More information about the Rt-commit mailing list