From 34948207f2723795ee4de1ba0b83f5da4f5e53c5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 7 Feb 2013 13:21:47 +0100 Subject: [PATCH] =?utf8?q?Pflichtenheft-Model:=20Accessoren=20f=C3=BCr=20T?= =?utf8?q?extbl=C3=B6cke,=20Abschnitte?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/RequirementSpec.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SL/DB/RequirementSpec.pm b/SL/DB/RequirementSpec.pm index 31dcfe89d..2c2725e50 100644 --- a/SL/DB/RequirementSpec.pm +++ b/SL/DB/RequirementSpec.pm @@ -2,6 +2,8 @@ package SL::DB::RequirementSpec; use strict; +use Carp; + use SL::DB::MetaSetup::RequirementSpec; use SL::DB::Manager::RequirementSpec; use SL::Locale::String; @@ -41,4 +43,18 @@ sub _before_save_initialize_not_null_columns { return 1; } +sub text_blocks_for_position { + my ($self, $output_position) = @_; + + return [ sort { $a->position <=> $b->position } grep { $_->output_position == $output_position } @{ $self->text_blocks } ]; +} + +sub sections { + my ($self, @rest) = @_; + + croak "This sub is not a writer" if @rest; + + return [ sort { $a->position <=> $b->position } grep { !$_->parent_id } @{ $self->items } ]; +} + 1; -- 2.20.1