projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3dee3e5
)
ActsAsList-Helfer: get_full_list() liefert alle Items in der selben Liste wie $self
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 6 Mar 2013 14:04:40 +0000
(15:04 +0100)
committer
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 6 Mar 2013 16:06:11 +0000
(17:06 +0100)
SL/DB/Helper/ActsAsList.pm
patch
|
blob
|
history
diff --git
a/SL/DB/Helper/ActsAsList.pm
b/SL/DB/Helper/ActsAsList.pm
index
566422a
..
49f39a9
100644
(file)
--- a/
SL/DB/Helper/ActsAsList.pm
+++ b/
SL/DB/Helper/ActsAsList.pm
@@
-4,7
+4,7
@@
use strict;
use parent qw(Exporter);
our @EXPORT = qw(move_position_up move_position_down add_to_list remove_from_list reorder_list configure_acts_as_list
use parent qw(Exporter);
our @EXPORT = qw(move_position_up move_position_down add_to_list remove_from_list reorder_list configure_acts_as_list
- get_previous_in_list get_next_in_list);
+ get_previous_in_list get_next_in_list
get_full_list
);
use Carp;
use Carp;
@@
-123,6
+123,16
@@
sub get_previous_in_list {
return get_previous_or_next($self, 'previous');
}
return get_previous_or_next($self, 'previous');
}
+sub get_full_list {
+ my ($self) = @_;
+
+ my $group_by = get_spec(ref $self, 'group_by') || [];
+ $group_by = [ $group_by ] if $group_by && !ref $group_by;
+ my @where = map { ($_ => $self->$_) } @{ $group_by };
+
+ return $self->_get_manager_class->get_all(where => \@where, sort_by => column_name($self) . ' ASC');
+}
+
sub reorder_list {
my ($class_or_self, @ids) = @_;
sub reorder_list {
my ($class_or_self, @ids) = @_;
@@
-417,6
+427,11
@@
already the first one.
Fetches the next item in the list. Returns C<undef> if C<$self> is
already the last one.
Fetches the next item in the list. Returns C<undef> if C<$self> is
already the last one.
+=item C<get_full_list>
+
+Fetches all items in the same list as C<$self> and returns them as an
+array reference.
+
=item C<reorder_list @ids>
Re-orders the objects given in C<@ids> by their position in C<@ids> by
=item C<reorder_list @ids>
Re-orders the objects given in C<@ids> by their position in C<@ids> by