From: Moritz Bunkus Date: Tue, 12 Dec 2006 10:43:05 +0000 (+0000) Subject: save_form() und restore_form() koennen jetzt auch mit Arrays umgehen, die in $form... X-Git-Tag: release-2.4.0^2~73 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7d639e01d4b63644343db6b550ec84211e73f167;p=kivitendo-erp.git save_form() und restore_form() koennen jetzt auch mit Arrays umgehen, die in $form gespeichert sind. --- diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 4ca0b8a0c..67b9e076f 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -16,9 +16,14 @@ use SL::Common; sub save_form { $lxdebug->enter_sub(); - my $old_form = ""; - map({ $old_form .= "$_=" . $form->escape($form->{$_}) . '&'; } keys(%{$form})); - chop($old_form); + 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(); $lxdebug->leave_sub(); @@ -28,14 +33,10 @@ sub save_form { sub restore_form { $lxdebug->enter_sub(); - my ($old_form) = @_; - - map({ delete($form->{$_}); } keys(%{$form})); + my ($old_form, $no_delete) = @_; - foreach my $pair (split('&', $old_form)) { - my ($key, $value) = split('=', $form->unescape($pair), 2); - $form->{$key} = $value; - } + map({ delete($form->{$_}); } keys(%{$form})) unless ($no_delete); + eval($old_form); $lxdebug->leave_sub(); }