]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Controller/TopQuickSearch/GLTransaction.pm
Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / Controller / TopQuickSearch / GLTransaction.pm
index dab0a6284c287bcad5995b5245cdf0d85b4b5c13..53d05ea420e35adae8d4260580b21a38ceff5fff 100644 (file)
@@ -45,19 +45,14 @@ sub query_autocomplete {
   my $ars = SL::DB::Manager::Invoice->get_all(        query => [ @arfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'customer' ]);
   my $aps = SL::DB::Manager::PurchaseInvoice->get_all(query => [ @apfilter ], limit => $limit, sort_by => 'transdate DESC', with_objects => [ 'vendor' ]);
 
-  # use the sum of all credit amounts as the "amount" of the gl transaction
-  foreach my $gl ( @$gls ) {
-    $gl->{'amount'} = sum map { $_->amount if $_->amount > 0 } @{$gl->transactions};
-  };
-
   my $gldata = [
     map(
       {
         {
-           transdate => $_->transdate->to_kivitendo,
+           transdate => $_->transdate->ymd(''), # only used for sorting
            label     => $_->oneline_summary,
            value     => '',
-           url       => 'gl.pl?action=edit&id=' . $_->id,
+           id        => 'gl.pl?action=edit&id=' . $_->id,
         }
       }
       @{$gls}
@@ -68,10 +63,10 @@ sub query_autocomplete {
     map(
       {
         {
-           transdate => $_->transdate->to_kivitendo,
+           transdate => $_->transdate->ymd(''),
            label     => $_->oneline_summary,
            value     => "",
-           url       => ($_->invoice ? "is" : "ar" ) . '.pl?action=edit&id=' . $_->id,
+           id        => ($_->invoice ? "is" : "ar" ) . '.pl?action=edit&id=' . $_->id,
         }
       }
       @{$ars}
@@ -82,7 +77,7 @@ sub query_autocomplete {
     map(
       {
         {
-           transdate => $_->transdate->to_kivitendo,
+           transdate => $_->transdate->ymd(''),
            label     => $_->oneline_summary,
            value     => "",
            id        => ($_->invoice ? "ir" : "ap" ) . '.pl?action=edit&id=' . $_->id,