From 3cecb9061c29c844790fa21ed2e92731ba14483a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 9 Dec 2009 12:47:57 +0100 Subject: [PATCH] =?utf8?q?ajax=5Fautocomplete=20f=C3=BCr=20Kunden/Lieferan?= =?utf8?q?ten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ct.pl | 21 +++++++++++++++++++++ locale/de/ct | 1 + 2 files changed, 22 insertions(+) diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 10ff70675..01de06226 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -714,4 +714,25 @@ sub delete_contact { $main::lxdebug->leave_sub(); } +sub ajax_autocomplete { + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + $form->{column} = 'name' unless $form->{column} =~ /^name$/; + $form->{vc} = 'customer' unless $form->{vc} =~ /^customer|vendor$/; + $form->{db} = $form->{vc}; # CT expects this + $form->{$form->{column}} = $form->{q} || ''; + $form->{limit} = ($form->{limit} * 1) || 10; + $form->{searchitems} ||= ''; + + CT->search(\%myconfig, $form); + + print $form->ajax_response_header(), + $form->parse_html_template('ct/ajax_autocomplete'); + + $main::lxdebug->leave_sub(); +} + sub continue { call_sub($main::form->{nextsub}); } diff --git a/locale/de/ct b/locale/de/ct index fac93f893..21d9277b6 100644 --- a/locale/de/ct +++ b/locale/de/ct @@ -213,6 +213,7 @@ $self->{subs} = { 'Q' => 'Q', 'add' => 'add', 'add_transaction' => 'add_transaction', + 'ajax_autocomplete' => 'ajax_autocomplete', 'ap_transaction' => 'ap_transaction', 'ar_transaction' => 'ar_transaction', 'build_std_url' => 'build_std_url', -- 2.20.1