[Rt-commit] rt branch, 3.999-trunk, updated. 9e27011cd2e530b816e11e224136332dc8ab751e

clkao at bestpractical.com clkao at bestpractical.com
Wed Nov 11 00:22:29 EST 2009


The branch, 3.999-trunk has been updated
       via  9e27011cd2e530b816e11e224136332dc8ab751e (commit)
       via  73e641ad05c09bead2b3e6f870c3593497ac7520 (commit)
      from  72c3edcb7492c6494f94bac38f356bd1efa3fec2 (commit)

Summary of changes:
 lib/RT/Collection.pm                  |    6 +++---
 lib/RT/Model/AttachmentCollection.pm  |    5 -----
 lib/RT/Model/ScripActionCollection.pm |    7 -------
 lib/RT/Model/TemplateCollection.pm    |   16 ----------------
 4 files changed, 3 insertions(+), 31 deletions(-)

- Log -----------------------------------------------------------------
commit 73e641ad05c09bead2b3e6f870c3593497ac7520
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Nov 11 12:56:14 2009 +0800

    Use record_class instead of instantiate dummy object.

diff --git a/lib/RT/Collection.pm b/lib/RT/Collection.pm
index 697a463..d6b4fe7 100755
--- a/lib/RT/Collection.pm
+++ b/lib/RT/Collection.pm
@@ -188,11 +188,11 @@ sub items_order_by {
     my $self  = shift;
     my $items = shift;
 
-    my $dummy = $self->new_item;
+    my $item_class = $self->record_class;
 
-    if ( $dummy->can('sort_order') ) {
+    if ( $item_class->can('sort_order') ) {
         return [ sort { $a->sort_order <=> $b->sort_order } @{$items} ];
-    } elsif ( $dummy->can('name') ) {
+    } elsif ( $item_class->can('name') ) {
         return [ sort { lc( $a->name ) cmp lc( $b->name ) } @{$items} ];
     }
 

commit 9e27011cd2e530b816e11e224136332dc8ab751e
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Nov 11 13:19:01 2009 +0800

    Remove new_item from Collection classes, which is provided by JDBI::Collection.

diff --git a/lib/RT/Model/AttachmentCollection.pm b/lib/RT/Model/AttachmentCollection.pm
index 0fb7524..366514e 100755
--- a/lib/RT/Model/AttachmentCollection.pm
+++ b/lib/RT/Model/AttachmentCollection.pm
@@ -181,11 +181,6 @@ sub limit_by_ticket {
     return;
 }
 
-sub new_item {
-    my $self = shift;
-    return RT::Model::Attachment->new( current_user => $self->current_user );
-}
-
 
 sub next {
     my $self = shift;
diff --git a/lib/RT/Model/ScripActionCollection.pm b/lib/RT/Model/ScripActionCollection.pm
index b749712..3b3654e 100755
--- a/lib/RT/Model/ScripActionCollection.pm
+++ b/lib/RT/Model/ScripActionCollection.pm
@@ -99,12 +99,5 @@ sub limit_to_type {
 }
 
 
-sub new_item {
-    my $self = shift;
-    return ( RT::Model::ScripAction->new );
-
-}
-
-
 1;
 
diff --git a/lib/RT/Model/TemplateCollection.pm b/lib/RT/Model/TemplateCollection.pm
index 7696671..d300470 100755
--- a/lib/RT/Model/TemplateCollection.pm
+++ b/lib/RT/Model/TemplateCollection.pm
@@ -142,22 +142,6 @@ sub limit_to_queue {
 
 
 
-=head2 new_item
-
-Returns a new empty template object
-
-=cut
-
-sub new_item {
-    my $self = shift;
-
-    use RT::Model::Template;
-    my $item = RT::Model::Template->new( current_user => $self->current_user );
-    return ($item);
-}
-
-
-
 =head2 next
 
 Returns the next template that this user can see.

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


More information about the Rt-commit mailing list