From 16c6be411e2eddf778e665b0da6c452c42b676af Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 26 Apr 2013 14:34:14 +0200 Subject: [PATCH] =?utf8?q?Verkn=C3=BCpfte=20Belege=20Einkauf/Verkauf/Proje?= =?utf8?q?kte:=20Listen=20nach=20Datum=20sortieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/DeliveryOrder.pm | 4 ++++ SL/DB/Invoice.pm | 4 ++++ SL/DB/Order.pm | 4 ++++ SL/DB/PurchaseInvoice.pm | 4 ++++ SL/Presenter/Record.pm | 10 +++++++++- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index ca36cbda7..8e235fc35 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -51,4 +51,8 @@ sub displayable_state { ($self->delivered ? $::locale->text('delivered') : $::locale->text('not delivered')); } +sub date { + goto &transdate; +} + 1; diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 861c92ae4..0d21ef8b2 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -241,6 +241,10 @@ sub displayable_state { return $self->closed ? $::locale->text('closed') : $::locale->text('open'); } +sub date { + goto &transdate; +} + 1; __END__ diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index b9959aa7e..63d23f79f 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -132,6 +132,10 @@ sub number { return $self->${ \ $number_method{$self->type} }(@_); } +sub date { + goto &transdate; +} + 1; __END__ diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index da34a27b8..ec9090cab 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -27,4 +27,8 @@ sub is_sales { return 0; } +sub date { + goto &transdate; +} + 1; diff --git a/SL/Presenter/Record.pm b/SL/Presenter/Record.pm index 18c719092..082fbd019 100644 --- a/SL/Presenter/Record.pm +++ b/SL/Presenter/Record.pm @@ -22,7 +22,7 @@ sub grouped_record_list { %params = map { exists $params{$_} ? ($_ => $params{$_}) : () } qw(edit_record_links with_columns object_id object_model); - my %groups = _group_records($list); + my %groups = _sort_grouped_lists(_group_records($list)); my $output = ''; $output .= _sales_quotation_list( $self, $groups{sales_quotations}, %params) if $groups{sales_quotations}; @@ -159,6 +159,14 @@ sub _group_records { return %groups; } +sub _sort_grouped_lists { + my (%groups) = @_; + + $groups{$_} = [ sort { $a->date <=> $b->date } @{ $groups{$_} } ] for keys %groups; + + return %groups; +} + sub _sales_quotation_list { my ($self, $list, %params) = @_; -- 2.20.1