use strict;
-my $print_post;
-my %TMPL_VAR;
+our %TMPL_VAR;
1;
check_oe_access();
# Container for template variables. Unfortunately this has to be
- # visible in form_footer too, so my at package level and not here.
+ # visible in form_footer too, so package local level and not my here.
%TMPL_VAR = ();
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
if ($rows > 1) {
&select_item;
- exit;
+ ::end_of_request();
} else {
'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
);
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
# add sort and escape callback, this one we use for the add sub
$form->{callback} = $href .= "&sort=$form->{sort}";
$form->{payment_id} = $payment_id;
}
&update;
- exit;
+ ::end_of_request();
}
$form->{id} = 0 if $form->{saveasnew};
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
$form->{payment_id} = $payment_id;
}
&update;
- exit;
+ ::end_of_request();
}
$form->{id} = 0 if $form->{saveasnew};
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
if(!$form->{print_and_save}) {
delete @{$form}{ary_diff([keys %{ $form }], [qw(login stylesheet id script type cursor_fokus)])};
edit();
- exit;
+ ::end_of_request();
}
$main::lxdebug->leave_sub();
}
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "DELETED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->save_history;
}
# /saving the history
$form->info($msg);
- exit();
+ ::end_of_request();
}
$form->error($err);
if (&check_name($form->{vc})) {
$form->{payment_id} = $payment_id if $form->{payment_id} eq "";
&update;
- exit;
+ ::end_of_request();
}
$form->{cp_id} *= 1;
if (!$exchangerate) {
&backorder_exchangerate($orddate, $buysell);
- exit;
+ ::end_of_request();
}
}
$main::lxdebug->leave_sub();
- exit 0;
+ ::end_of_request();
}
sub purchase_order {
$form->{print_and_save} = 1;
- $print_post = 1;
-
my $saved_form = save_form();
save();
}
$form->{"taxaccounts"} = "";
- for my $i (1 .. $form->{"rowcount"}) {
- IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1) if $form->{"id_$i"};
- }
+ IC->retrieve_accounts(\%myconfig, $form, map { $_ => $form->{"id_$_"} } 1 .. $form->{rowcount});
$form->{rowcount}++;
$form->{"project_id_$form->{rowcount}"} = $form->{globalproject_id};
return $content;
}
+sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ 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.'));
+}