DeliveryPlan: calc_qtys mit SL::Helper::ShippedQty berechnen
[kivitendo-erp.git] / SL / Controller / TopQuickSearch.pm
index 8c6661e..c3ad7f3 100644 (file)
@@ -16,8 +16,15 @@ my @available_modules = (
   'SL::Controller::TopQuickSearch::Part',
   'SL::Controller::TopQuickSearch::Service',
   'SL::Controller::TopQuickSearch::Assembly',
+  'SL::Controller::TopQuickSearch::Assortment',
   'SL::Controller::TopQuickSearch::Contact',
+  'SL::Controller::TopQuickSearch::SalesQuotation',
+  'SL::Controller::TopQuickSearch::SalesOrder',
+  'SL::Controller::TopQuickSearch::RequestForQuotation',
+  'SL::Controller::TopQuickSearch::PurchaseOrder',
   'SL::Controller::TopQuickSearch::GLTransaction',
+  'SL::Controller::TopQuickSearch::Customer',
+  'SL::Controller::TopQuickSearch::Vendor',
 );
 my %modules_by_name;
 
@@ -57,10 +64,20 @@ sub available_modules {
   map { $_->new } @available_modules;
 }
 
+sub enabled_modules {
+  my %enabled_names = map {
+    $_ => 1
+  } @{ $::instance_conf->get_quick_search_modules };
+
+  grep {
+    $enabled_names{$_->name}
+  } $_[0]->available_modules
+}
+
 sub active_modules {
   grep {
     $::auth->assert($_->auth, 1)
-  } $_[0]->available_modules
+  } $_[0]->enabled_modules
 }
 
 sub init_module {
@@ -105,21 +122,22 @@ SL::Controller::TopQuickSearch - Framework for pluggable quicksearch fields in t
 
 =head1 SYNOPSIS
 
-use SL::Controller::TopQuickSearch;
-my $search = SL::Controller::TopQuickSearch->new;
+  use SL::Controller::TopQuickSearch;
+  my $search = SL::Controller::TopQuickSearch->new;
+  $::request->layout->add_javascripts('kivi.QuickSearch.js');
 
-# in layout
-[%- FOREACH module = search.available_modules %]
-<input type='text' id='top-search-[% module.name %]'>
-[%- END %]
+  # in template
+  [%- FOREACH module = search.enabled_modules %]
+  <input type='text' id='top-search-[% module.name %]'>
+  [%- END %]
 
 =head1 DESCRIPTION
 
 This controller provides abstraction for different search plugins, and ensures
 that all follow a common useability scheme.
 
-Modules should be configurable, but currently are not. Diabling modules can be
-done by removing them from available_modules.
+Modules should be configurable per user, but currently are not. Disabling
+modules can be done by removing them from available_modules or in client_config.
 
 =head1 BEHAVIOUR REQUIREMENTS
 
@@ -157,26 +175,19 @@ redirect should occur.
 Each search must check rights and must not present a backdoor into data that
 the user should not see.
 
-=back
+=item *
 
-=head1 INTERFACE
+By design the search must not try to guess C<exact matches>.
 
-Plugins need to provide:
+=back
 
- - name
- - localized description for config
- - localized description for textfield
- - autocomplete callback
- - redirect callback
+=head1 INTERFACE
 
-the frontend will only generate urls of the forms:
-  action=TopQuickSearch/autocomplete&module=<module>&term=<term>
-  action=TopQuickSearch/search&module=<module>&term=<term>
+The full interface is described in L<SL::Controller::TopQuickSeach::Base>
 
 =head1 TODO
 
- - filter available searches with auth
- - toggling with cofiguration doesn't work yet
+  * user configuration
 
 =head1 BUGS