2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

UConv.pm: fix HASH ref

git-svn-id: https://svn.fhem.de/fhem/trunk@12496 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-11-03 21:28:21 +00:00
parent 3fa652bd95
commit f4b237ebf1

View File

@ -152,7 +152,7 @@ my %units = (
"nl" => "wind force", "nl" => "wind force",
"pl" => "wind force", "pl" => "wind force",
}, },
"txt_format_long" => "%unit_long% %value%", "txt_format_long" => '%unit_long% %value%',
}, },
"fts" => { "fts" => {
"unit" => "ft/s", "unit" => "ft/s",
@ -414,9 +414,9 @@ my %units = (
"nl" => "inches", "nl" => "inches",
"pl" => "inches", "pl" => "inches",
}, },
"txt_format" => "%value%%unit_symbol%", "txt_format" => '%value%%unit_symbol%',
"txt_format_long" => "%value% %unit_long%", "txt_format_long" => '%value% %unit_long%',
"txt_format_long_pl" => "%value% %unit_long_pl%", "txt_format_long_pl" => '%value% %unit_long_pl%',
}, },
"ft" => { "ft" => {
@ -436,9 +436,9 @@ my %units = (
"nl" => "feet", "nl" => "feet",
"pl" => "feet", "pl" => "feet",
}, },
"txt_format" => "%value%%unit_symbol%", "txt_format" => '%value%%unit_symbol%',
"txt_format_long" => "%value% %unit_long%", "txt_format_long" => '%value% %unit_long%',
"txt_format_long_pl" => "%value% %unit_long_pl%", "txt_format_long_pl" => '%value% %unit_long_pl%',
}, },
"yd" => { "yd" => {
"unit" => "yd", "unit" => "yd",
@ -1073,32 +1073,38 @@ sub UnitDetails ($;$) {
if ( $details{"txt_format"} ) { if ( $details{"txt_format"} ) {
delete $details{"txt_format"}; delete $details{"txt_format"};
if ( $units{$u}{"txt_format"}{$l} ) { if ( ref( $units{$u}{"txt_format"} ) eq "HASH"
&& $units{$u}{"txt_format"}{$l} )
{
$details{"txt_format"} = $units{$u}{"txt_format"}{$l}; $details{"txt_format"} = $units{$u}{"txt_format"}{$l};
} }
elsif ( refs( $units{$u}{"txt_format"} ) ne "HASH" ) { elsif ( ref( $units{$u}{"txt_format"} ) ne "HASH" ) {
$details{"txt_format"} = $units{$u}{"txt_format"}; $details{"txt_format"} = $units{$u}{"txt_format"};
} }
} }
if ( $details{"txt_format_long"} ) { if ( $details{"txt_format_long"} ) {
delete $details{"txt_format_long"}; delete $details{"txt_format_long"};
if ( $units{$u}{"txt_format_long"}{$l} ) { if ( ref( $units{$u}{"txt_format_long"} ) eq "HASH"
&& $units{$u}{"txt_format_long"}{$l} )
{
$details{"txt_format_long"} = $details{"txt_format_long"} =
$units{$u}{"txt_format_long"}{$l}; $units{$u}{"txt_format_long"}{$l};
} }
elsif ( refs( $units{$u}{"txt_format_long"} ) ne "HASH" ) { elsif ( ref( $units{$u}{"txt_format_long"} ) ne "HASH" ) {
$details{"txt_format_long"} = $units{$u}{"txt_format_long"}; $details{"txt_format_long"} = $units{$u}{"txt_format_long"};
} }
} }
if ( $details{"txt_format_long_pl"} ) { if ( $details{"txt_format_long_pl"} ) {
delete $details{"txt_format_long_pl"}; delete $details{"txt_format_long_pl"};
if ( $units{$u}{"txt_format_long_pl"}{$l} ) { if ( ref( $units{$u}{"txt_format_long_pl"} ) eq "HASH"
&& $units{$u}{"txt_format_long_pl"}{$l} )
{
$details{"txt_format_long_pl"} = $details{"txt_format_long_pl"} =
$units{$u}{"txt_format_long_pl"}{$l}; $units{$u}{"txt_format_long_pl"}{$l};
} }
elsif ( refs( $units{$u}{"txt_format_long_pl"} ) ne "HASH" ) { elsif ( ref( $units{$u}{"txt_format_long_pl"} ) ne "HASH" ) {
$details{"txt_format_long_pl"} = $details{"txt_format_long_pl"} =
$units{$u}{"txt_format_long_pl"}; $units{$u}{"txt_format_long_pl"};
} }
@ -1106,20 +1112,24 @@ sub UnitDetails ($;$) {
if ( $details{"unit_long"} ) { if ( $details{"unit_long"} ) {
delete $details{"unit_long"}; delete $details{"unit_long"};
if ( $units{$u}{"unit_long"}{$l} ) { if ( ref( $units{$u}{"unit_long"} ) eq "HASH"
&& $units{$u}{"unit_long"}{$l} )
{
$details{"unit_long"} = $units{$u}{"unit_long"}{$l}; $details{"unit_long"} = $units{$u}{"unit_long"}{$l};
} }
elsif ( refs( $units{$u}{"unit_long"} ) ne "HASH" ) { elsif ( ref( $units{$u}{"unit_long"} ) ne "HASH" ) {
$details{"unit_long"} = $units{$u}{"unit_long"}; $details{"unit_long"} = $units{$u}{"unit_long"};
} }
} }
if ( $details{"unit_long_pl"} ) { if ( $details{"unit_long_pl"} ) {
delete $details{"unit_long_pl"}; delete $details{"unit_long_pl"};
if ( $units{$u}{"unit_long_pl"}{$l} ) { if ( ref( $units{$u}{"unit_long_pl"} ) eq "HASH"
&& $units{$u}{"unit_long_pl"}{$l} )
{
$details{"unit_long_pl"} = $units{$u}{"unit_long_pl"}{$l}; $details{"unit_long_pl"} = $units{$u}{"unit_long_pl"}{$l};
} }
elsif ( refs( $units{$u}{"unit_long_pl"} ) ne "HASH" ) { elsif ( ref( $units{$u}{"unit_long_pl"} ) ne "HASH" ) {
$details{"unit_long_pl"} = $units{$u}{"unit_long_pl"}; $details{"unit_long_pl"} = $units{$u}{"unit_long_pl"};
} }
} }