X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FTopQuickSearch%2FContact.pm;h=e0e915d91448f3f866699ea7ce1f7188d189a069;hb=5f810b4b61f933cfe253bf6113283c4a264768b0;hp=5607a5b8296e8bfead09a97565c2be5ba37d67be;hpb=6c63020409f486043d63c3a324db96a4a162ff67;p=kivitendo-erp.git diff --git a/SL/Controller/TopQuickSearch/Contact.pm b/SL/Controller/TopQuickSearch/Contact.pm index 5607a5b82..e0e915d91 100644 --- a/SL/Controller/TopQuickSearch/Contact.pm +++ b/SL/Controller/TopQuickSearch/Contact.pm @@ -5,10 +5,10 @@ use parent qw(SL::Controller::TopQuickSearch::Base); use SL::Controller::CustomerVendor; use SL::DB::Vendor; -use SL::DBUtils qw(selectfirst_array_query); +use SL::DBUtils qw(selectfirst_array_query like); use SL::Locale::String qw(t8); -sub auth { 'customer_vendor_edit' } +sub auth { undef } sub name { 'contact' } @@ -19,14 +19,26 @@ sub description_field { t8('Contacts') } sub query_autocomplete { my ($self) = @_; + my $cv_query = <get_all( query => [ or => [ - cp_name => { ilike => "%$::form->{term}%" }, - cp_givenname => { ilike => "%$::form->{term}%" }, - cp_email => { ilike => "%$::form->{term}%" }, + cp_name => { ilike => like($::form->{term}) }, + cp_givenname => { ilike => like($::form->{term}) }, + cp_email => { ilike => like($::form->{term}) }, ], - cp_cv_id => [ \'SELECT id FROM customer UNION SELECT id FROM vendor' ], + cp_cv_id => [ \$cv_query ], ], limit => 10, sort_by => 'cp_name', @@ -46,7 +58,7 @@ sub select_autocomplete { my $contact = SL::DB::Manager::Contact->find_by(cp_id => $::form->{id}); - SL::Controller::CustomerVendor->new->url_for(action => 'edit', id => $contact->cp_cv_id, db => db_for_contact($contact)); + SL::Controller::CustomerVendor->new->url_for(action => 'edit', id => $contact->cp_cv_id, contact_id => $contact->cp_id, db => db_for_contact($contact), fragment => 'contacts'); } sub do_search {