diff --git a/QuickBooks/IPP/Parser.php b/QuickBooks/IPP/Parser.php index fd4d6b0c..2b4cb5a6 100755 --- a/QuickBooks/IPP/Parser.php +++ b/QuickBooks/IPP/Parser.php @@ -350,32 +350,37 @@ protected function _parseIDS_v3($xml, $optype, $flavor, $version, &$xml_errnum, $list = array(); - $List = $Root->getChildAt('IntuitResponse QueryResponse'); - - $attrs = $List->attributes(); - - if (!array_key_exists('startPosition', $attrs) and - array_key_exists('totalCount', $attrs)) - { - return $attrs['totalCount']; - } - else + if ($List = $Root->getChildAt('IntuitResponse QueryResponse')) { + $attrs = $List->attributes(); - foreach ($List->children() as $Child) + if (!array_key_exists('startPosition', $attrs) and + array_key_exists('totalCount', $attrs)) + { + return $attrs['totalCount']; + } + else { - $class = 'QuickBooks_IPP_Object_' . $Child->name(); - $Object = new $class(); - foreach ($Child->children() as $Data) + foreach ($List->children() as $Child) { - $this->_push($Data, $Object); + $class = 'QuickBooks_IPP_Object_' . $Child->name(); + $Object = new $class(); + + foreach ($Child->children() as $Data) + { + $this->_push($Data, $Object); + } + + $list[] = $Object; } - $list[] = $Object; + return $list; } - - return $list; + } + else + { + return false; } } }