use SL::Locale::String qw(t8);
use SL::PriceSource::ALL;
use SL::Template;
+use SL::Controller::TopQuickSearch;
__PACKAGE__->run_before('check_auth');
use Rose::Object::MakeMethods::Generic (
- 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name
+ 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name available_quick_search_modules
all_project_statuses all_project_types
posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options) ],
);
[ map { [ $_->name, $_->description ] } @classes ];
}
+sub init_available_quick_search_modules {
+ [ SL::Controller::TopQuickSearch->new->available_modules ];
+}
+
#
# filters
#
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 {
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
=head1 INTERFACE
-Plugins need to provide:
-
- - name
- - localized description for config
- - localized description for textfield
- - autocomplete callback
- - redirect callback
-
-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
=head1 BUGS
=item C<description_config>
-Localized name used in the configuration (NYI)
+Localized name used in the configuration.
=item C<description_field>
sub auth { 'general_ledger' }
-sub name { 'gl_transction' }
+sub name { 'gl_transaction' }
sub description_config { t8('GL search') }
project_type_id => { type => 'integer' },
purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' },
purchase_order_show_delete => { type => 'boolean', default => 'true' },
+ quick_search_modules => { type => 'array' },
reqdate_interval => { type => 'integer', default => '0' },
require_transaction_description_ps => { type => 'boolean', default => 'false', not_null => 1 },
requirement_spec_section_order_part_id => { type => 'integer' },
'All clients' => 'Alle Mandanten',
'All general ledger entries' => 'Alle Hauptbucheinträge',
'All groups' => 'Alle Gruppen',
+ 'All modules' => 'Alle Module',
'All of the exports you have selected were already closed.' => 'Alle von Ihnen ausgewählten Exporte sind bereits abgeschlossen.',
'All partsgroups' => 'Alle Warengruppen',
'All price sources' => 'Alle Preisquellen',
'Employees' => 'Benutzer',
'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).' => 'Leere Lager-Auswahl wird ignoriert, selbst wenn noch ein Lagerplatz ausgewählt ist. Alle Daten können durch zurück und vorwärts korrigiert werden.',
'Empty transaction!' => 'Buchung ist leer!',
+ 'Enabled Quick Searched' => 'Aktivierte Schnellsuchen',
+ 'Enabled modules' => 'Aktivierte Module',
'End date' => 'Enddatum',
'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
'Enter longdescription' => 'Langtext eingeben',
'Quarterly' => 'quartalsweise',
'Query Type' => 'Art der Abfrage',
'Queue' => 'Warteschlange',
+ 'Quick Searches that will be shown in the header in this client' => 'Schnellsuchen, die in der Kopfzeile in diesem Mandanten gezeigt werden sollen',
'Quotation' => 'Angebot',
'Quotation Date' => 'Angebotsdatum',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
--- /dev/null
+-- @tag: defaults_add_quick_search_modules
+-- @description: Mandantenkonfiguration für Schnellsuche
+-- @depends: release_3_4_0
+-- @encoding: utf-8
+
+ALTER TABLE defaults ADD COLUMN quick_search_modules TEXT[];
+
+UPDATE defaults SET quick_search_modules = '{"contact","gl_transaction"}';
<td>[% L.yes_no_tag('defaults.show_longdescription_select_item', SELF.defaults.show_longdescription_select_item) %]</td>
</tr>
+ <tr><td class="listheading" colspan="4">[% LxERP.t8("Enabled Quick Searched") %]</td></tr>
+ <tr>
+ <td align="right">[% 'Quick Searches that will be shown in the header in this client' | $T8 %]</td>
+ <td colspan=2>
+ <div class="clearfix">
+ [% L.select_tag("defaults.quick_search_modules[]", SELF.available_quick_search_modules, value_key="name", title_key="description_config", id="defaults_quick_searches", multiple=1, default=SELF.defaults.quick_search_modules) %]
+ [% L.multiselect2side("defaults_quick_searches", labelsx=LxERP.t8("All modules"), labeldx=LxERP.t8("Enabled modules")) %]
+ </div>
+ </td>
+ </tr>
+
</table>
</div>
[<a href="controller.pl?action=LoginScreen/user_login" target="_blank" title="[% 'Open a further kivitendo window or tab' | $T8 %]">[% 'New window/tab' | $T8 %]</a>]
[<a href="JavaScript:top.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>]
-[%- FOREACH search = quick_search.active_modules %]
+[%- FOREACH search = quick_search.enabled_modules %]
[<input id="top-quick-search-[% search.name %]" module="[% search.name %]" placeholder="[% search.description_field %]" maxlength="20">]
[%- END %]