diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm index 1d14b118fb..dea260b238 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm @@ -42,34 +42,23 @@ sub doInventory { sub _scanOffice { my ($currentKey) = @_; - my %license; - if ($currentKey->{ProductID}) { - $license{PRODUCTID} = $currentKey->{ProductID}; - } if ($currentKey->{DigitalProductID}) { + my %license = { + PRODUCTID => $currentKey->{ProductID}, + UPDATE => $currentKey->{SPLevel}, + OEM => $currentKey->{OEM}, + FULLNAME => encodeFromRegistry($currentKey->{ProductName}) || + encodeFromRegistry($currentKey->{ConvertToEdition}), + NAME => encodeFromRegistry($currentKey->{ProductNameNonQualified}) || + encodeFromRegistry($currentKey->{ProductNameVersion}) + }; + + if ($currentKey->{DigitalProductID}) { $license{KEY} = parseProductKey($currentKey->{DigitalProductID}); } - if ($currentKey->{ConvertToEdition}) { - $license{FULLNAME} = encodeFromRegistry($currentKey->{ConvertToEdition}); - } - if ($currentKey->{ProductNameNonQualified}) { - $license{NAME} = encodeFromRegistry($currentKey->{ProductNameNonQualified}); - } elsif ($currentKey->{ProductNameVersion}) { - $license{NAME} = encodeFromRegistry($currentKey->{ProductNameVersion}); - } - - if ($currentKey->{ProductName}) { - $license{FULLNAME} = encodeFromRegistry($currentKey->{ProductName}); - } if ($currentKey->{TrialType} && $currentKey->{TrialType} =~ /(\d+)$/) { $license{TRIAL} = int($1); } - if ($currentKey->{SPLevel}) { - $license{UPDATE} = $currentKey->{SPLevel}; - } - if ($currentKey->{OEM}) { - $license{OEM} = $currentKey->{OEM}; - } my @products; foreach(keys %$currentKey) {