X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=ff5cc7537e740f9ccd25adad6586469311579c85;hb=289ea7d7a88a8eb99d7552f4f1e02fa93d2d2227;hp=ea34189db03b2fecef7de32206fb4b2a23c6e3f6;hpb=828bd68326ee5bd732d3d01e9f166dacb7424657;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index ea34189db..ff5cc7537 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -9,21 +9,18 @@ # ###################################################################### -use Data::Dumper; +use SL::Form; +use YAML; use SL::Common; sub save_form { $lxdebug->enter_sub(); - my (@names, @values); - foreach my $key (keys(%{$form})) { - push(@names, "\$form->{\"$key\"}"); - push(@values, $form->{$key}); - } - my $dumper = Data::Dumper->new(\@values, \@names); - $dumper->Indent(0); - my $old_form = $dumper->Dump(); + my $old_form = YAML::Dump($form); + $old_form =~ s|!|!!|g; + $old_form =~ s|\n|!n|g; + $old_form =~ s|\r|!r|g; $lxdebug->leave_sub(); @@ -36,7 +33,11 @@ sub restore_form { my ($old_form, $no_delete) = @_; map({ delete($form->{$_}); } keys(%{$form})) unless ($no_delete); - eval($old_form); + $old_form =~ s|!r|\r|g; + $old_form =~ s|!n|\n|g; + $old_form =~ s|!!|!|g; + my $new_form = YAML::Load($old_form); + map({ $form->{$_} = $new_form->{$_}; } keys(%{$new_form})); $lxdebug->leave_sub(); } @@ -450,6 +451,13 @@ sub E { return $form->escape($_[0]); } +sub NTI { + my ($element) = @_; + + $element =~ s/tabindex\s*=\s*"\d+"//; + return $element; +} + sub format_dates { $lxdebug->enter_sub(); @@ -520,4 +528,19 @@ sub reformat_numbers { $lxdebug->leave_sub(); } +sub show_history { + $lxdebug->enter_sub(); + my $dbh = $form->dbconnect(\%myconfig); + + $form->{title} = $locale->text("History"); + $form->header(); + print $form->parse_html_template( "common/show_history", { + "DATEN" => $form->get_history($dbh,$form->{input_name}), + "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0") + } ); + + $dbh->disconnect(); + $lxdebug->leave_sub(); +} + 1;