Revision 87a09fb1
Von Kivitendo Admin vor fast 8 Jahren hinzugefügt
SL/Controller/TopQuickSearch/GLTransaction.pm | ||
---|---|---|
10 | 10 |
use SL::Locale::String qw(t8); |
11 | 11 |
use SL::DBUtils qw(like); |
12 | 12 |
use List::Util qw(sum); |
13 |
use List::UtilsBy qw(rev_sort_by); |
|
13 | 14 |
|
14 | 15 |
sub auth { 'general_ledger|gl_transactions|ap_transactions|ar_transactions' } |
15 | 16 |
|
... | ... | |
45 | 46 |
my $ars = SL::DB::Manager::Invoice->get_all( query => [ @arfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'customer' ]); |
46 | 47 |
my $aps = SL::DB::Manager::PurchaseInvoice->get_all(query => [ @apfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'vendor' ]); |
47 | 48 |
|
48 |
my $gldata = [ |
|
49 |
map( |
|
50 |
{ |
|
51 |
{ |
|
52 |
transdate => $_->transdate->to_kivitendo, |
|
53 |
label => $_->oneline_summary, |
|
54 |
value => '', |
|
55 |
id => 'gl.pl?action=edit&id=' . $_->id, |
|
56 |
} |
|
57 |
} |
|
58 |
@{$gls} |
|
59 |
), |
|
60 |
]; |
|
61 |
|
|
62 |
my $ardata = [ |
|
63 |
map( |
|
64 |
{ |
|
65 |
{ |
|
66 |
transdate => $_->transdate->to_kivitendo, |
|
67 |
label => $_->oneline_summary, |
|
68 |
value => "", |
|
69 |
id => ($_->invoice ? "is" : "ar" ) . '.pl?action=edit&id=' . $_->id, |
|
70 |
} |
|
71 |
} |
|
72 |
@{$ars} |
|
73 |
), |
|
74 |
]; |
|
75 |
|
|
76 |
my $apdata = [ |
|
77 |
map( |
|
78 |
{ |
|
79 |
{ |
|
80 |
transdate => $_->transdate->to_kivitendo, |
|
81 |
label => $_->oneline_summary, |
|
82 |
value => "", |
|
83 |
id => ($_->invoice ? "ir" : "ap" ) . '.pl?action=edit&id=' . $_->id, |
|
84 |
} |
|
85 |
} |
|
86 |
@{$aps} |
|
87 |
), |
|
88 |
]; |
|
89 |
|
|
90 |
my $data; |
|
91 |
push(@{$data},@{$gldata}); |
|
92 |
push(@{$data},@{$ardata}); |
|
93 |
push(@{$data},@{$apdata}); |
|
94 |
|
|
95 |
@$data = reverse sort { $a->{'transdate'} cmp $b->{'transdate'} } @$data; |
|
96 |
|
|
97 |
$data; |
|
49 |
my @data = rev_sort_by { $_->{'sortorder'} } |
|
50 |
map { |
|
51 |
{ |
|
52 |
sortorder => $_->transdate->strftime('%Y%m%d'), # transdate is only used for sorting |
|
53 |
label => $_->oneline_summary, |
|
54 |
value => '', |
|
55 |
id => $_->url_link, |
|
56 |
} |
|
57 |
} @{$gls}, @{$ars}, @{$aps}; |
|
58 |
|
|
59 |
return \@data; |
|
98 | 60 |
} |
99 | 61 |
|
100 | 62 |
sub select_autocomplete { |
Auch abrufbar als: Unified diff
FiBu Schnellsuche - Sortierung und Refactoring
die Sortierreihenfolge war durch das to_kivitendo falsch, stattdessen
strftime('%Y%m%d') verwenden.
Dadurch, daß alle Belege die gleichen Methoden haben, können auch die drei
Arrays zusammen verarbeitet werden.