X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FTopQuickSearch%2FGLTransaction.pm;h=baa6da0ce02d1d52c014bdfe4145c0ff665c3bdb;hb=0b20f3379a3466235b6992f4f26398127bd4f4f1;hp=77854ff4cca9cda1443ee11310f74cdcb2a4a795;hpb=4e070acf473ae9992a3561594cce55123be0a7ec;p=kivitendo-erp.git diff --git a/SL/Controller/TopQuickSearch/GLTransaction.pm b/SL/Controller/TopQuickSearch/GLTransaction.pm index 77854ff4c..baa6da0ce 100644 --- a/SL/Controller/TopQuickSearch/GLTransaction.pm +++ b/SL/Controller/TopQuickSearch/GLTransaction.pm @@ -8,9 +8,10 @@ use SL::DB::Invoice; use SL::DB::PurchaseInvoice; use SL::DB::AccTransaction; use SL::Locale::String qw(t8); +use SL::DBUtils qw(like); use List::Util qw(sum); -sub auth { 'general_ledger' } +sub auth { 'general_ledger|gl_transactions|ap_transactions|ar_transactions' } sub name { 'gl_transaction' } @@ -24,11 +25,11 @@ sub query_autocomplete { my $limit = $::form->{limit} || 40; # max number of results per type (AR/AP/GL) my $term = $::form->{term} || ''; - my $descriptionquery = { ilike => '%' . $term . '%' }; - my $referencequery = { ilike => '%' . $term . '%' }; - my $apinvnumberquery = { ilike => '%' . $term . '%' }; - my $namequery = { ilike => '%' . $term . '%' }; - my $arinvnumberquery = { ilike => '%' . $term }; + my $descriptionquery = { ilike => like($term) }; + my $referencequery = { ilike => like($term) }; + my $apinvnumberquery = { ilike => like($term) }; + my $namequery = { ilike => like($term) }; + my $arinvnumberquery = { ilike => '%' . SL::Util::trim($term) }; # ar match is more restrictive. Left fuzzy beginning so it also matches "Storno zu $INVNUMBER" # and numbers like 000123 if you only enter 123. # When used in quicksearch short numbers like 1 or 11 won't match because of the