- Fixed a template variable rewriting problem with Template Toolkit.

This commit is contained in:
JT Smith 2007-01-24 20:10:58 +00:00
parent 034496f260
commit 7bb998c6ee
2 changed files with 19 additions and 15 deletions

View file

@ -1,4 +1,5 @@
7.3.7
- Fixed a template variable rewriting problem with Template Toolkit.
7.3.6
- fix: Checkbox is no longer available when creating custom profile fields
@ -6,7 +7,9 @@
- fix: CS email message shows up as an attachment
- fix: Calendar: start/end date time off in edit interface (perlDreamer Consulting, LLC)
- Added a database optimization that will improve asset lookup performance by
as much as 600% on some sites.
as much as 600% on some sites and another small one that will improve a different
kind of lookup by more than 10%.
- fix: Extra cruft in the Zip Archive template.
- fix: fixed corner case in WebGUI::Operation::Workflow.pm which could cause the edit page to not load and display an error if an activity is undefined or cannot be defined.
- fix: testEnvironment.pl do not tests all modules (perlDreamer Consulting, LLC)

View file

@ -20,21 +20,22 @@ use Template;
#-------------------------------------------------------------------
sub _rewriteVars { # replace dots with underscrores in keys (except in keys that aren't usable as variables (URLs etc.))
my $vars = shift;
foreach my $key (keys %$vars){
my $newKey = $key;
$newKey =~ s/\./_/g if $newKey !~ /\//;
if(ref $vars->{$key} eq 'HASH'){
$vars->{$newKey} = _rewriteVars($vars->{$key});
delete $vars->{$key} if($key ne $newKey);
}else{
if($key ne $newKey){
$vars->{$newKey} = $vars->{$key};
delete $vars->{$key};
my $vars = shift;
my $newVars = {};
foreach my $key (keys %$vars){
my $newKey = $key;
$newKey =~ s/\./_/g if $newKey !~ /\//;
if ( ref $vars->{$key} eq 'ARRAY') {
foreach my $entry (@{$vars->{$key}}) {
push(@{$newVars->{$newKey}}, _rewriteVars($entry));
}
}
}
return $vars;
} elsif(ref $vars->{$key} eq 'HASH') {
$newVars->{$newKey} = _rewriteVars($vars->{$key});
} else {
$newVars->{$newKey} = $vars->{$key};
}
}
return $newVars;
}
#-------------------------------------------------------------------