From 349e8c78ba5a1906a8455b9cf3001575421ab03d Mon Sep 17 00:00:00 2001 From: wilpig Date: Wed, 29 Jul 2015 00:02:02 -0400 Subject: [PATCH] One more correction for the search results and a slight update the the lineage function to make it more streamlined. --- assets.inc.php | 8 +++----- search.php | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/assets.inc.php b/assets.inc.php index bd77e346f..83087db0e 100644 --- a/assets.inc.php +++ b/assets.inc.php @@ -2622,14 +2622,12 @@ function GetDeviceDCID(){ function GetDeviceLineage() { $devList=array(); $num=1; - $devList[$num]=new Device(); - $devList[$num]->DeviceID=$this->DeviceID; + $devList[$num]=new Device($this->DeviceID); $devList[$num]->GetDevice(); - while ( $devList[$num]->ParentDevice <> 0) { + while($devList[$num]->ParentDevice>0){ $num++; - $devList[$num]=new Device(); - $devList[$num]->DeviceID = $devList[$num-1]->ParentDevice; + $devList[$num]=new Device($devList[$num-1]->ParentDevice); $devList[$num]->GetDevice(); } return $devList; diff --git a/search.php b/search.php index 64c6b8509..f9bf0161e 100644 --- a/search.php +++ b/search.php @@ -96,8 +96,8 @@ $childList=array(); // List of all blade devices $dctemp=array(); // List of datacenters involved with result set $pduList=array(); // List of CDUs - while(list($devID,$device)=each($devList)){ - if($device->DeviceType="CDU"){ + foreach($devList as $devID => $device){ + if($device->DeviceType=="CDU"){ $pduList[$devID]=$device; }else{ $temp[$x]['devid']=$devID; @@ -108,7 +108,7 @@ $temp[$x]['rights']=$device->Rights; $cabtemp[$device->Cabinet]=""; ++$x; - if($device->ParentDevice!=0){ + if($device->ParentDevice>0){ foreach($uncleDaddy=$device->GetDeviceLineage() as $branches){ if($branches->ParentDevice>0){ $childList[$branches->ParentDevice]=""; // Create a list of chassis devices based on children present