rev 1963 - trunk/buscador/lib/Buscador

[prev] [thread] [next] [lurker] [Date index for 2005/02/25]

From: simon
Subject: rev 1963 - trunk/buscador/lib/Buscador
Date: 15:50 on 25 Feb 2005
Author: simon
Date: 2005-02-25 15:50:21 +0000 (Fri, 25 Feb 2005)
New Revision: 1963

Modified:
   trunk/buscador/lib/Buscador/Addressing.pm
Log:
Fix entities being listed in alphabetical order


Modified: trunk/buscador/lib/Buscador/Addressing.pm
===================================================================
--- trunk/buscador/lib/Buscador/Addressing.pm	2005-02-25 15:49:33 UTC (rev 1962)
+++ trunk/buscador/lib/Buscador/Addressing.pm	2005-02-25 15:50:21 UTC (rev 1963)
@@ -208,9 +208,15 @@
 sub list : Exported {
     my ($class, $r) = @_;
     my $pager = Email::Store::Entity->do_pager($r);
-    $r->{template_args}{entities} = [ sort { lc($a->most_common_name->name) cmp lc($b->most_common_name->name) } $pager->retrieve_all ];    
+    $r->{template_args}{entities} = [ $pager->get_sorted_entities ];
 }
 
+sub get_sorted_entities {
+    my $self = shift;
+    my @stuff = sort { lc($a->most_common_name->name) cmp lc($b->most_common_name->name) } $self->retrieve_all;
+    my $it    = Class::DBI::Iterator->new('Email::Store::Entity', \@stuff ); 
+    return $it;
+}
 
 sub most_common_name { Email::Store::Entity::Name->search_most_common(shift->id)->first }
 sub most_common_address { Email::Store::Entity::Address->search_most_common(shift->id)->first }

Generated at 22:00 on 16 Mar 2005 by mariachi 0.52