diff --git a/extension/qfq/qfq/report/Report.php b/extension/qfq/qfq/report/Report.php index 34b802584c8a3b62c5eccd8cdc25a7630b758e6f..c1251fd9a7708520882368d9f71ebd4de849df02 100644 --- a/extension/qfq/qfq/report/Report.php +++ b/extension/qfq/qfq/report/Report.php @@ -387,40 +387,42 @@ class Report { // Prepare row alteration $arrRbgd = explode("|", $this->frArray[$full_level . "." . "rbgd"]); - //--------------------------------- - // Process each row of resultset - $columnValueSeperator = ""; - $rowIndex = 0; - foreach ($result as $row) { - // record number counter - $this->variables->resultArray[$full_level . ".line."]["count"] = ++$rowIndex; - - // replace {{<level>.line.count}} and {{<level>.line.total}} in __result__, if the variables specify their own full_level. This can't be replaced before firing the query. - for ($ii = 0; $ii < count($row); $ii++) { - $row[$ii] = str_replace("{{" . $full_level . ".line.count}}", $rowIndex, $row[$ii]); - $row[$ii] = str_replace("{{" . $full_level . ".line.total}}", $rowTotal, $row[$ii]); - } + if (is_array($result)) { + //--------------------------------- + // Process each row of resultset + $columnValueSeperator = ""; + $rowIndex = 0; + foreach ($result as $row) { + // record number counter + $this->variables->resultArray[$full_level . ".line."]["count"] = ++$rowIndex; + + // replace {{<level>.line.count}} and {{<level>.line.total}} in __result__, if the variables specify their own full_level. This can't be replaced before firing the query. + for ($ii = 0; $ii < count($row); $ii++) { + $row[$ii] = str_replace("{{" . $full_level . ".line.count}}", $rowIndex, $row[$ii]); + $row[$ii] = str_replace("{{" . $full_level . ".line.total}}", $rowTotal, $row[$ii]); + } - // SEP set seperator (empty on first run) - $content .= $columnValueSeperator; - $columnValueSeperator = $this->variables->doVariables($this->frArray[$full_level . "." . "rsep"]); + // SEP set seperator (empty on first run) + $content .= $columnValueSeperator; + $columnValueSeperator = $this->variables->doVariables($this->frArray[$full_level . "." . "rsep"]); - // RBGD: even/odd rows - $content .= str_replace("rbgd", $arrRbgd[$rowIndex % 2], $this->frArray[$full_level . "." . "rbeg"]); + // RBGD: even/odd rows + $content .= str_replace("rbgd", $arrRbgd[$rowIndex % 2], $this->frArray[$full_level . "." . "rbeg"]); - //----------------------------- - // COLUMNS: Collect all columns - $content .= $this->collectRow($row, $keys, $full_level, $rowIndex); + //----------------------------- + // COLUMNS: Collect all columns + $content .= $this->collectRow($row, $keys, $full_level, $rowIndex); - // REND - $content .= $this->variables->doVariables($this->frArray[$full_level . "." . "rend"]); + // REND + $content .= $this->variables->doVariables($this->frArray[$full_level . "." . "rend"]); - // Trigger subqueries of this level - $content .= $this->triggerReport($cur_level + 1, $this->indexArray[$counter], $counter + 1); + // Trigger subqueries of this level + $content .= $this->triggerReport($cur_level + 1, $this->indexArray[$counter], $counter + 1); - // RENR - $content .= $this->variables->doVariables($this->frArray[$full_level . "." . "renr"]); + // RENR + $content .= $this->variables->doVariables($this->frArray[$full_level . "." . "renr"]); + } } //Print althead or tail