Kundenstammdatensuche: Filter auf ZUGFeRD-Einstellungen
[kivitendo-erp.git] / bin / mozilla / ct.pl
1 #=====================================================================
2 # LX-Office ERP
3 # Copyright (C) 2004
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
10 #
11 #  Author: Dieter Simader
12 #   Email: dsimader@sql-ledger.org
13 #     Web: http://www.sql-ledger.org
14 #
15 #  Contributors: Reed White <alta@alta-research.com>
16 #
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
21 #
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29 # MA 02110-1335, USA.
30 #======================================================================
31 #
32 # customer/vendor module
33 #
34 #======================================================================
35
36 # $locale->text('Customers')
37 # $locale->text('Vendors')
38 # $locale->text('Add Customer')
39 # $locale->text('Add Vendor')
40 # $locale->text('Edit Customer')
41 # $locale->text('Edit Vendor')
42 # $locale->text('Customer saved!')
43 # $locale->text('Vendor saved!')
44 # $locale->text('Customer deleted!')
45 # $locale->text('Cannot delete customer!')
46 # $locale->text('Vendor deleted!')
47 # $locale->text('Cannot delete vendor!')
48
49 use POSIX qw(strftime);
50
51 use SL::CT;
52 use SL::CTI;
53 use SL::CVar;
54 use SL::Request qw(flatten);
55 use SL::DB::Business;
56 use SL::DB::Default;
57 use SL::DB::DeliveryTerm;
58 use SL::ReportGenerator;
59 use SL::Locale::String qw(t8);
60 use SL::MoreCommon qw(uri_encode);
61
62 require "bin/mozilla/common.pl";
63 require "bin/mozilla/reportgenerator.pl";
64
65 use strict;
66 1;
67
68 # end of main
69
70 sub _zugferd_settings {
71   return ([ -1, $::locale->text('Use settings from client configuration') ],
72           [  0, $::locale->text('Do not create ZUGFeRD invoices') ],
73           [  1, $::locale->text('Create ZUGFeRD invoices') ],
74           [  2, $::locale->text('Create ZUGFeRD invoices in test mode') ]);
75 }
76
77 sub search {
78   $main::lxdebug->enter_sub();
79
80   $main::auth->assert('customer_vendor_edit');
81
82   my $form     = $main::form;
83   my $locale   = $main::locale;
84
85   $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
86
87   $form->get_lists("business_types" => "ALL_BUSINESS_TYPES",
88                    "salesmen"       => "ALL_SALESMEN");
89   $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
90
91   $form->{CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
92   ($form->{CUSTOM_VARIABLES_FILTER_CODE},
93    $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables'      => $form->{CUSTOM_VARIABLES},
94                                                                            'include_prefix' => 'l_',
95                                                                            'include_value'  => 'Y');
96
97   $form->{title}    = $form->{IS_CUSTOMER} ? $locale->text('Customers') : $locale->text('Vendors');
98
99   $form->{ZUGFERD_SETTINGS} = [ _zugferd_settings() ];
100
101   setup_ct_search_action_bar();
102
103   $form->header();
104   print $form->parse_html_template('ct/search');
105
106   $main::lxdebug->leave_sub();
107 }
108
109 sub search_contact {
110   $::lxdebug->enter_sub;
111   $::auth->assert('customer_vendor_edit');
112
113   $::form->{CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'Contacts');
114   ($::form->{CUSTOM_VARIABLES_FILTER_CODE},
115    $::form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables'    => $::form->{CUSTOM_VARIABLES},
116                                                                            'include_prefix' => 'l.',
117                                                                            'filter_prefix'  => 'filter.',
118                                                                            'include_value'  => 'Y');
119
120   $::form->{title} = $::locale->text('Search contacts');
121
122   setup_ct_search_contact_action_bar();
123   $::form->header;
124   print $::form->parse_html_template('ct/search_contact');
125
126   $::lxdebug->leave_sub;
127 }
128
129 sub list_names {
130   $main::lxdebug->enter_sub();
131
132   $main::auth->assert('customer_vendor_edit');
133
134   my $form     = $main::form;
135   my %myconfig = %main::myconfig;
136   my $locale   = $main::locale;
137
138   $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
139
140   report_generator_set_default_sort('name', 1);
141
142   CT->search(\%myconfig, \%$form);
143
144   my $cvar_configs = CVar->get_configs('module' => 'CT');
145
146   my @options;
147   if ($form->{status} eq 'all') {
148     push @options, $locale->text('All');
149   } elsif ($form->{status} eq 'orphaned') {
150     push @options, $locale->text('Orphaned');
151   }
152
153   my @zugferd_settings_list = _zugferd_settings();
154   my $zugferd_filter        = $form->{create_zugferd_invoices} eq '' ? undef : $zugferd_settings_list[$form->{create_zugferd_invoices} + 1]->[1];
155
156   push @options, $locale->text('Name') . " : $form->{name}"                                       if $form->{name};
157   push @options, $locale->text('Contact') . " : $form->{contact}"                                 if $form->{contact};
158   push @options, $locale->text('Number') . qq| : $form->{"$form->{db}number"}|                    if $form->{"$form->{db}number"};
159   push @options, $locale->text('E-mail') . " : $form->{email}"                                    if $form->{email};
160   push @options, $locale->text('Contact person (surname)')           . " : $form->{cp_name}"      if $form->{cp_name};
161   push @options, $locale->text('Billing/shipping address (city)')    . " : $form->{addr_city}"    if $form->{addr_city};
162   push @options, $locale->text('Billing/shipping address (zipcode)') . " : $form->{addr_zipcode}" if $form->{addr_zipcode};
163   push @options, $locale->text('Billing/shipping address (street)')  . " : $form->{addr_street}"  if $form->{addr_street};
164   push @options, $locale->text('Billing/shipping address (country)') . " : $form->{addr_country}" if $form->{addr_country};
165   push @options, $locale->text('Billing/shipping address (GLN)')     . " : $form->{addr_gln}"     if $form->{addr_gln};
166   push @options, $locale->text('Quick Search')                       . " : $form->{all}"          if $form->{all};
167   push @options, $locale->text('ZUGFeRD settings')                   . " : $zugferd_filter"       if $zugferd_filter;
168
169   if ($form->{business_id}) {
170     my $business = SL::DB::Manager::Business->find_by(id => $form->{business_id});
171     if ($business) {
172       my $label = $form->{IS_CUSTOMER} ? $::locale->text('Customer type') : $::locale->text('Vendor type');
173       push @options, $label . " : " . $business->description;
174     }
175   }
176   if ($form->{salesman_id}) {
177     my $salesman = SL::DB::Manager::Employee->find_by(id => $form->{salesman_id});
178     if ($salesman) {
179       push @options, $locale->text('Salesman') . " : " . $salesman->name;
180     }
181   }
182
183   if ( $form->{insertdatefrom} or $form->{insertdateto} ) {
184     push @options, $locale->text('Insert Date');
185     push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{insertdatefrom}, 1) if $form->{insertdatefrom};
186     push @options, $locale->text('Bis')  . " " . $locale->date(\%myconfig, $form->{insertdateto},   1) if $form->{insertdateto};
187   };
188
189   my @columns = (
190     'id',        'name',    "$form->{db}number",   'contact', 'main_contact_person',
191     'phone',    'discount',
192     'fax',       'email',   'taxnumber',           'street',    'zipcode' , 'city',
193     'business',  'payment', 'invnumber', 'ordnumber',           'quonumber', 'salesman',
194     'country',   'gln',     'insertdate',           'pricegroup', 'contact_origin', 'invoice_mail',
195     'creditlimit', 'ustid', 'commercial_court', 'delivery_order_mail'
196   );
197
198   my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
199   my @searchable_custom_variables  = grep { $_->{searchable} }  @{ $cvar_configs };
200   my %column_defs_cvars            = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables;
201
202   push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables;
203
204   my %column_defs = (
205     'id'                => { 'text' => $locale->text('ID'), },
206     "$form->{db}number" => { 'text' => $locale->text('Number'), },
207     'name'              => { 'text' => $form->{IS_CUSTOMER} ? $::locale->text('Customer Name') : $::locale->text('Vendor Name'), },
208     'contact'           => { 'text' => $locale->text('Contact'), },
209     'main_contact_person'  => { 'text' => $locale->text('Main Contact Person'), },
210     'phone'             => { 'text' => $locale->text('Phone'), },
211     'fax'               => { 'text' => $locale->text('Fax'), },
212     'email'             => { 'text' => $locale->text('E-mail'), },
213     'cc'                => { 'text' => $locale->text('Cc'), },
214     'taxnumber'         => { 'text' => $locale->text('Tax Number'), },
215     'business'          => { 'text' => $locale->text('Type of Business'), },
216     'invnumber'         => { 'text' => $locale->text('Invoice'), },
217     'ordnumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Sales Order') : $locale->text('Purchase Order'), },
218     'quonumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Quotation')   : $locale->text('Request for Quotation'), },
219     'street'            => { 'text' => $locale->text('Street'), },
220     'zipcode'           => { 'text' => $locale->text('Zipcode'), },
221     'city'              => { 'text' => $locale->text('City'), },
222     'country'           => { 'text' => $locale->text('Country'), },
223     'gln'               => { 'text' => $locale->text('GLN'), },
224     'salesman'          => { 'text' => $locale->text('Salesman'), },
225     'discount'          => { 'text' => $locale->text('Discount'), },
226     'payment'           => { 'text' => $locale->text('Payment Terms'), },
227     'insertdate'        => { 'text' => $locale->text('Insert Date'), },
228     'pricegroup'        => { 'text' => $locale->text('Pricegroup'), },
229     'invoice_mail'      => { 'text' => $locale->text('Email of the invoice recipient'), },
230     'delivery_order_mail' => { 'text' => $locale->text('Email of the delivery order recipient'), },
231     'contact_origin'    => { 'text' => $locale->text('Origin of personal data'), },
232     'creditlimit'       => { 'text' => $locale->text('Credit Limit'), },
233     'ustid'             => { 'text' => $locale->text('VAT ID'), },
234     'commercial_court'  => { 'text' => $locale->text('Commercial court'), },
235     create_zugferd_invoices => { text => $locale->text('ZUGFeRD settings'), },
236     %column_defs_cvars,
237   );
238
239   map { $column_defs{$_}->{visible} = $form->{"l_$_"} eq 'Y' } @columns;
240
241   my @hidden_variables  = ( qw(
242       db status obsolete name contact email cp_name addr_street addr_zipcode
243       addr_city addr_country addr_gln business_id salesman_id insertdateto insertdatefrom all
244     ), "$form->{db}number",
245     map({ "cvar_$_->{name}" } @searchable_custom_variables),
246     map({'cvar_'. $_->{name} .'_from'} grep({$_->{type} eq 'date'} @searchable_custom_variables)),
247     map({'cvar_'. $_->{name} .'_to'}   grep({$_->{type} eq 'date'} @searchable_custom_variables)),
248     map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)),
249     map({ "l_$_" } @columns),
250   );
251
252   my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
253   my $callback          = build_std_url('action=list_names', grep { $form->{$_} } @hidden_nondefault);
254   $form->{callback}     = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir});
255
256   foreach (@columns) {
257     my $sortdir              = $form->{sort} eq $_ ? 1 - $form->{sortdir} : $form->{sortdir};
258     $column_defs{$_}->{link} = "${callback}&sort=${_}&sortdir=${sortdir}";
259   }
260
261   my ($ordertype, $quotationtype, $attachment_basename);
262   if ($form->{IS_CUSTOMER}) {
263     $form->{title}       = $locale->text('Customers');
264     $ordertype           = 'sales_order';
265     $quotationtype       = 'sales_quotation';
266     $attachment_basename = $locale->text('customer_list');
267
268   } else {
269     $form->{title}       = $locale->text('Vendors');
270     $ordertype           = 'purchase_order';
271     $quotationtype       = 'request_quotation';
272     $attachment_basename = $locale->text('vendor_list');
273   }
274
275   my $report = SL::ReportGenerator->new(\%myconfig, $form);
276
277   $report->set_options('top_info_text'         => join("\n", @options),
278                        'raw_bottom_info_text'  => $form->parse_html_template('ct/list_names_bottom'),
279                        'output_format'         => 'HTML',
280                        'title'                 => $form->{title},
281                        'attachment_basename'   => $attachment_basename . strftime('_%Y%m%d', localtime time),
282     );
283   $report->set_options_from_form();
284   $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
285
286   $report->set_columns(%column_defs);
287   $report->set_column_order(@columns);
288
289   $report->set_export_options('list_names', @hidden_variables, qw(sort sortdir));
290
291   $report->set_sort_indicator($form->{sort}, $form->{sortdir});
292
293   CVar->add_custom_variables_to_report('module'         => 'CT',
294                                        'trans_id_field' => 'id',
295                                        'configs'        => $cvar_configs,
296                                        'column_defs'    => \%column_defs,
297                                        'data'           => $form->{CT});
298
299   my $previous_id;
300
301   foreach my $ref (@{ $form->{CT} }) {
302     my $row = { map { $_ => { 'data' => '' } } @columns };
303
304     if ($ref->{id} ne $previous_id) {
305       $previous_id = $ref->{id};
306       $ref->{discount} = $form->format_amount(\%myconfig, $ref->{discount} * 100.0, 2);
307       $ref->{creditlimit} = $form->format_amount(\%myconfig, $ref->{creditlimit}, 2);
308       map { $row->{$_}->{data} = $ref->{$_} } @columns;
309
310       $row->{name}->{link}  = build_std_url('script=controller.pl', 'action=CustomerVendor/edit', 'id=' . E($ref->{id}), 'callback', @hidden_nondefault);
311       $row->{email}->{link} = 'mailto:' . E($ref->{email});
312     }
313
314     my $base_url              = build_std_url("script=$ref->{module}.pl", 'action=edit', 'id=' . E($ref->{invid}), 'callback', @hidden_nondefault);
315     if ($::instance_conf->get_feature_experimental_order) {
316       if ('oe' eq $ref->{module}) {
317         $base_url             = build_std_url("script=controller.pl", 'action=Order/edit', 'id=' . E($ref->{invid}), 'callback', @hidden_nondefault);
318       }
319     }
320
321     $row->{invnumber}->{link} = $base_url;
322     $row->{ordnumber}->{link} = $base_url . "&type=${ordertype}";
323     $row->{quonumber}->{link} = $base_url . "&type=${quotationtype}";
324     my $column                = $ref->{formtype} eq 'invoice' ? 'invnumber' : $ref->{formtype} eq 'order' ? 'ordnumber' : 'quonumber';
325     $row->{$column}->{data}   = $ref->{$column};
326
327     if (my $number = SL::CTI->sanitize_number(number => $ref->{phone})) {
328       $row->{phone}->{link}       = SL::CTI->call_link(number => $number);
329       $row->{phone}->{link_class} = 'cti_call_action';
330     }
331
332     $report->add_data($row);
333   }
334
335   setup_ct_list_names_action_bar();
336   $report->generate_with_headers();
337
338   $main::lxdebug->leave_sub();
339 }
340
341 sub list_contacts {
342   $::lxdebug->enter_sub;
343   $::auth->assert('customer_vendor_edit');
344
345   $::form->{sortdir} = 1 unless defined $::form->{sortdir};
346
347   my @contacts     = CT->search_contacts(
348     search_term => $::form->{search_term},
349     filter      => $::form->{filter},
350   );
351
352   my $cvar_configs = CVar->get_configs('module' => 'Contacts');
353
354   my @columns      = qw(
355     cp_id vcname vcnumber cp_name cp_givenname cp_street cp_zipcode cp_city cp_phone1 cp_phone2 cp_privatphone
356     cp_mobile1 cp_mobile2 cp_fax cp_email cp_privatemail cp_abteilung cp_position cp_birthday cp_gender
357   );
358
359   my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
360   my @searchable_custom_variables  = grep { $_->{searchable} }  @{ $cvar_configs };
361   my %column_defs_cvars            = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables;
362
363   push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables;
364
365   my @visible_columns;
366   if ($::form->{l}) {
367     @visible_columns = grep { $::form->{l}{$_} } @columns;
368     push @visible_columns, qw(cp_phone1 cp_phone2)   if $::form->{l}{cp_phone};
369     push @visible_columns, qw(cp_mobile1 cp_mobile2) if $::form->{l}{cp_mobile};
370   } else {
371    @visible_columns = qw(vcname vcnumber cp_name cp_givenname cp_phone1 cp_phone2 cp_mobile1 cp_email);
372   }
373
374   my %column_defs  = (
375     'cp_id'        => { 'text' => $::locale->text('ID'), },
376     'vcname'       => { 'text' => $::locale->text('Customer/Vendor'), },
377     'vcnumber'     => { 'text' => $::locale->text('Customer/Vendor Number'), },
378     'cp_name'      => { 'text' => $::locale->text('Name'), },
379     'cp_givenname' => { 'text' => $::locale->text('Given Name'), },
380     'cp_street'    => { 'text' => $::locale->text('Street'), },
381     'cp_zipcode'   => { 'text' => $::locale->text('Zipcode'), },
382     'cp_city'      => { 'text' => $::locale->text('City'), },
383     'cp_phone1'    => { 'text' => $::locale->text('Phone1'), },
384     'cp_phone2'    => { 'text' => $::locale->text('Phone2'), },
385     'cp_mobile1'   => { 'text' => $::locale->text('Mobile1'), },
386     'cp_mobile2'   => { 'text' => $::locale->text('Mobile2'), },
387     'cp_email'     => { 'text' => $::locale->text('E-mail'), },
388     'cp_abteilung' => { 'text' => $::locale->text('Department'), },
389     'cp_position'  => { 'text' => $::locale->text('Function/position'), },
390     'cp_birthday'  => { 'text' => $::locale->text('Birthday'), },
391     'cp_gender'    => { 'text' => $::locale->text('Gender'), },
392     'cp_fax'       => { 'text' => $::locale->text('Fax'), },
393     'cp_privatphone' => { 'text' => $::locale->text('Private Phone') },
394     'cp_privatemail' => { 'text' => $::locale->text('Private E-mail') },
395     %column_defs_cvars,
396   );
397
398   map { $column_defs{$_}->{visible} = 1 } @visible_columns;
399
400   my @hidden_variables  = (qw(search_term filter l));
401   my $hide_vars         = { map { $_ => $::form->{$_} } @hidden_variables };
402   my @hidden_nondefault = grep({ $::form->{$_} } @hidden_variables);
403   my $callback          = build_std_url('action=list_contacts', join '&', map { E($_->[0]) . '=' . E($_->[1]) } @{ flatten($hide_vars) });
404   $::form->{callback}     = "$callback&sort=" . E($::form->{sort});
405
406   map { $column_defs{$_}->{link} = "${callback}&sort=${_}&sortdir=" . ($::form->{sort} eq $_ ? 1 - $::form->{sortdir} : $::form->{sortdir}) } @columns;
407
408   $::form->{title} = $::locale->text('Contacts');
409
410   my $report     = SL::ReportGenerator->new(\%::myconfig, $::form);
411
412   my @options;
413   push @options, $::locale->text('Search term') . ': ' . $::form->{search_term} if $::form->{search_term};
414   for (qw(cp_name cp_givenname cp_title cp_email cp_abteilung cp_project)) {
415     push @options, $column_defs{$_}{text} . ': ' . $::form->{filter}{$_} if $::form->{filter}{$_};
416   }
417   if ($::form->{filter}{status}) {
418     push @options, $::locale->text('Status') . ': ' . (
419       $::form->{filter}{status} =~ /active/   ? $::locale->text('Active')   :
420       $::form->{filter}{status} =~ /orphaned/ ? $::locale->text('Orphaned') :
421       $::form->{filter}{status} =~ /all/      ? $::locale->text('All')      : ''
422     );
423   }
424
425
426   $report->set_options('top_info_text'       => join("\n", @options),
427                        'output_format'       => 'HTML',
428                        'title'               => $::form->{title},
429                        'attachment_basename' => $::locale->text('contact_list') . strftime('_%Y%m%d', localtime time),
430     );
431   $report->set_options_from_form;
432
433   $report->set_columns(%column_defs);
434   $report->set_column_order(@columns);
435
436   $report->set_export_options('list_contacts', @hidden_variables);
437
438   $report->set_sort_indicator($::form->{sort}, $::form->{sortdir});
439
440   CVar->add_custom_variables_to_report('module'         => 'Contacts',
441                                        'trans_id_field' => 'cp_id',
442                                        'configs'        => $cvar_configs,
443                                        'column_defs'    => \%column_defs,
444                                        'data'           => \@contacts);
445
446
447   foreach my $ref (@contacts) {
448     my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns };
449
450     $row->{vcname}->{link}   = build_std_url('script=controller.pl', 'action=CustomerVendor/edit', 'id=' . E($ref->{vcid}), 'db=' . E($ref->{db}), 'callback', @hidden_nondefault);
451     $row->{vcnumber}->{link} = $row->{vcname}->{link};
452
453     for (qw(cp_email cp_privatemail)) {
454       $row->{$_}->{link} = 'mailto:' . E($ref->{$_}) if $ref->{$_};
455     }
456
457     for (qw(cp_phone1 cp_phone2 cp_mobile1)) {
458       next unless my $number = SL::CTI->sanitize_number(number => $ref->{$_});
459
460       $row->{$_}->{link}       = SL::CTI->call_link(number => $number);
461       $row->{$_}->{link_class} = 'cti_call_action';
462     }
463
464     $report->add_data($row);
465   }
466
467   $report->generate_with_headers();
468
469   $::lxdebug->leave_sub;
470 }
471
472 sub setup_ct_search_action_bar {
473   my %params = @_;
474
475   for my $bar ($::request->layout->get('actionbar')) {
476     $bar->add(
477       action => [
478         t8('Search'),
479         submit    => [ '#form', { action => 'list_names' } ],
480         accesskey => 'enter',
481       ],
482     );
483   }
484 }
485
486 sub setup_ct_list_names_action_bar {
487   my %params = @_;
488
489   for my $bar ($::request->layout->get('actionbar')) {
490     $bar->add(
491       action => [
492         t8('Add'),
493         submit    => [ '#new_form', { action => 'CustomerVendor/add' } ],
494         accesskey => 'enter',
495       ],
496     );
497   }
498 }
499
500 sub setup_ct_search_contact_action_bar {
501   my %params = @_;
502
503   for my $bar ($::request->layout->get('actionbar')) {
504     $bar->add(
505       action => [
506         t8('Search'),
507         submit    => [ '#form', { action => 'list_contacts' } ],
508         accesskey => 'enter',
509       ],
510     );
511   }
512 }
513
514 sub continue { call_sub($main::form->{nextsub}); }