+ call_sub($main::form->{no_nextsub});
+}
+
+######################################################################################################
+# IO ENTKOPPLUNG
+# ###############################################################################################
+sub display_form {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ check_oe_access();
+
+ retrieve_partunits() if ($form->{type} =~ /_delivery_order$/);
+
+ $form->{"taxaccounts"} =~ s/\s*$//;
+ $form->{"taxaccounts"} =~ s/^\s*//;
+ foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) {
+ map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber));
+ }
+ $form->{"taxaccounts"} = "";
+
+ IC->retrieve_accounts(\%myconfig, $form, map { $_ => $form->{"id_$_"} } 1 .. $form->{rowcount});
+
+ $form->{rowcount}++;
+ $form->{"project_id_$form->{rowcount}"} = $form->{globalproject_id};
+
+ $form->language_payment(\%myconfig);
+
+ Common::webdav_folder($form);
+
+ &form_header;
+
+ # create rows
+ display_row($form->{rowcount}) if $form->{rowcount};
+
+ &form_footer;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub report_for_todo_list {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
+ my $quotations = OE->transactions_for_todo_list();
+ my $content;
+
+ if (@{ $quotations }) {
+ my $edit_url = build_std_url('script=oe.pl', 'action=edit');
+
+ $content = $form->parse_html_template('oe/report_for_todo_list', { 'QUOTATIONS' => $quotations,
+ 'edit_url' => $edit_url });
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return $content;
+}
+
+sub edit_periodic_invoices_config {
+ $::lxdebug->enter_sub();
+
+ $::form->{type} = 'sales_order';
+
+ check_oe_access();
+
+ my $config;
+ $config = YAML::Load($::form->{periodic_invoices_config}) if $::form->{periodic_invoices_config};
+
+ if ('HASH' ne ref $config) {
+ $config = { periodicity => 'y',
+ start_date_as_date => $::form->{transdate},
+ extend_automatically_by => 12,
+ active => 1,
+ };
+ }
+
+ $config->{periodicity} = 'm' if none { $_ eq $config->{periodicity} } qw(m q y);
+
+ $::form->get_lists(printers => "ALL_PRINTERS",
+ charts => { key => 'ALL_CHARTS',
+ transdate => 'current_date' });
+
+ $::form->{AR} = [ grep { $_->{link} =~ m/(?:^|:)AR(?::|$)/ } @{ $::form->{ALL_CHARTS} } ];
+ $::form->{title} = $::locale->text('Edit the configuration for periodic invoices');
+
+ $::form->header();
+ print $::form->parse_html_template('oe/edit_periodic_invoices_config', $config);
+
+ $::lxdebug->leave_sub();
+}
+
+sub save_periodic_invoices_config {
+ $::lxdebug->enter_sub();
+
+ $::form->{type} = 'sales_order';
+
+ check_oe_access();
+
+ $::form->isblank('start_date_as_date', $::locale->text('The start date is missing.'));
+
+ my $config = { active => $::form->{active} ? 1 : 0,
+ terminated => $::form->{terminated} ? 1 : 0,
+ periodicity => (any { $_ eq $::form->{periodicity} } qw(m q y)) ? $::form->{periodicity} : 'm',
+ start_date_as_date => $::form->{start_date_as_date},
+ end_date_as_date => $::form->{end_date_as_date},
+ print => $::form->{print} ? 1 : 0,
+ printer_id => $::form->{print} ? $::form->{printer_id} * 1 : undef,
+ copies => $::form->{copies} * 1 ? $::form->{copies} : 1,
+ extend_automatically_by => $::form->{extend_automatically_by} * 1 || undef,
+ ar_chart_id => $::form->{ar_chart_id} * 1,
+ };
+
+ $::form->{periodic_invoices_config} = YAML::Dump($config);
+
+ $::form->{title} = $::locale->text('Edit the configuration for periodic invoices');
+ $::form->header;
+ print $::form->parse_html_template('oe/save_periodic_invoices_config', $config);
+
+ $::lxdebug->leave_sub();
+}
+
+sub dispatcher {
+ foreach my $action (qw(delete delivery_order e_mail invoice print purchase_order purchase_order quotation
+ request_for_quotation sales_order sales_order save save_and_close save_as_new ship_to update)) {
+ if ($::form->{"action_${action}"}) {
+ call_sub($action);
+ return;
+ }
+ }
+
+ $::form->error($::locale->text('No action defined.'));