From: Moritz Bunkus Date: Fri, 26 Apr 2013 12:34:14 +0000 (+0200) Subject: Verknüpfte Belege Einkauf/Verkauf/Projekte: Listen nach Datum sortieren X-Git-Tag: release-3.1.0beta1~456 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=16c6be411e2eddf778e665b0da6c452c42b676af;p=kivitendo-erp.git Verknüpfte Belege Einkauf/Verkauf/Projekte: Listen nach Datum sortieren --- 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) = @_;