dblayeroo: manage correctely the GROUP BY when there is join objects

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3828 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-07-25 09:49:55 +00:00
parent 391eb9e83b
commit cfd9f99518

View File

@@ -1557,8 +1557,6 @@ class dblayeroo
if (count ($aliasNames) && count ($aliasNames) !== count ($columnNames))
$this->DBException (
"The number of aliasNames are not the same as the number of columns");
if ($this->displayColumn === null)
$this->displayColumn = array ();
foreach ($columnNames as $nb => $display)
{
$display = $name = trim ($display);
@@ -1576,7 +1574,10 @@ class dblayeroo
// expression, if not already done
if ($this->groupByExpression === null)
{
$this->groupByExpression = $this->displayColumn;
if ($this->displayColumn === null)
$this->groupByExpression = array_keys ($this->fields);
else
$this->groupByExpression = $this->displayColumn;
}
if ($func === "GROUP_CONCAT" && ($pos = strpos ($name, ",'")))
{
@@ -2101,15 +2102,16 @@ class dblayeroo
$groupBy = array ();
if ($this->joinObject)
$full = true;
if ($this->groupByExpression === null)
return null;
foreach ($this->groupByExpression as $pos=>$o)
if (is_array ($this->groupByExpression))
{
if ($full !== false)
$groupBy[$pos] = $this->sep.$this->tableprefix.$this->table.$this->sep.
".".$o;
else
$groupBy[$pos] = $o;
foreach ($this->groupByExpression as $pos=>$o)
{
if ($full !== false)
$groupBy[$pos] = $this->sep.$this->tableprefix.$this->table.$this->sep
.".".$o;
else
$groupBy[$pos] = $o;
}
}
if ($this->joinObject)
{