X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FForm.pm;h=35a87340aa8bcb714829e2e6588886488b363fd0;hb=8cd05ad64866ce200f888a35723ae4b7e24a2012;hp=f0ad1a17b0292c6e5e4e105447df014fb19376bf;hpb=bcadf16a799e73371e23489de2ea099ee59340e8;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index f0ad1a17b..35a87340a 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -43,21 +43,28 @@ use CGI; use CGI::Ajax; use Cwd; use Encode; +use File::Copy; use IO::File; use SL::Auth; use SL::Auth::DB; use SL::Auth::LDAP; use SL::AM; use SL::Common; +use SL::CVar; +use SL::DB; use SL::DBUtils; +use SL::DO; +use SL::IC; +use SL::IS; use SL::Mailer; use SL::Menu; +use SL::OE; use SL::Template; use SL::User; use Template; use URI; use List::Util qw(first max min sum); -use List::MoreUtils qw(any apply); +use List::MoreUtils qw(all any apply); use strict; @@ -441,13 +448,23 @@ sub hide_form { $main::lxdebug->leave_sub(); } +sub throw_on_error { + my ($self, $code) = @_; + local $self->{__ERROR_HANDLER} = sub { die({ error => $_[0] }) }; + $code->(); +} + sub error { $main::lxdebug->enter_sub(); $main::lxdebug->show_backtrace(); my ($self, $msg) = @_; - if ($ENV{HTTP_USER_AGENT}) { + + if ($self->{__ERROR_HANDLER}) { + $self->{__ERROR_HANDLER}->($msg); + + } elsif ($ENV{HTTP_USER_AGENT}) { $msg =~ s/\n/
/g; $self->show_generic_error($msg); @@ -679,7 +696,6 @@ EOT print < -