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