X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=38297576ddb9e3265434cd5c2d0863d628447975;hb=a200453a04fc89fdf02dbe39e1d951cb1b55191c;hp=ff5cc7537e740f9ccd25adad6586469311579c85;hpb=a7b15deeb326dc689e3a1593e4395163d78b3d6e;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index ff5cc7537..38297576d 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -97,7 +97,7 @@ sub select_employee_internal { restore_form($form->{"old_form"}); - &{ $callback_sub }($new_id, $new_name); + call_sub($callback_sub, $new_id, $new_name); $lxdebug->leave_sub(); } @@ -167,7 +167,7 @@ sub select_part_internal { restore_form($form->{"old_form"}); - &{ $callback_sub }($new_item); + call_sub($callback_sub, $new_item); $lxdebug->leave_sub(); } @@ -543,4 +543,24 @@ sub show_history { $lxdebug->leave_sub(); } +sub call_sub { + $lxdebug->enter_sub(); + + my $name = shift; + + if (!$name) { + $form->error($locale->text("Trying to call a sub without a name")); + } + + $name =~ s/[^a-zA-Z0-9_]//g; + + if (!defined(&{ $name })) { + $form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name)); + } + + &{ $name }(@_); + + $lxdebug->leave_sub(); +} + 1;