Skip to content

Commit

Permalink
Fixing issue with repeat join deletion code where no repeat group on
Browse files Browse the repository at this point in the history
form (max repeat is 0, or all repeats have been deleted).
  • Loading branch information
cheesegrits committed Apr 13, 2015
1 parent da13733 commit 7a2463f
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions components/com_fabrik/models/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -7469,23 +7469,28 @@ protected function deleteDeselectedItems($idsToKeep, $k)
{
$formData = $this->getFormModel()->formDataWithTableName;
$parentId = $formData[$k];
$query->delete($join->table_join)->where('parent_id = ' . $db->quote($parentId));
$db->setQuery($query);
$db->execute();
if (!empty($parentId))
{
$query->delete($join->table_join)->where('parent_id = ' . $db->quote($parentId));
$db->setQuery($query);
$db->execute();
}
}

foreach ($idsToKeep as $parentId => $ids)
else
{
$query->clear();
$query->delete($join->table_join)->where('parent_id = ' . $parentId);

if (!empty($ids))
foreach ($idsToKeep as $parentId => $ids)
{
$query->where('id NOT IN ( ' . implode($ids, ',') . ')');
$query->clear();
$query->delete($join->table_join)->where('parent_id = ' . $parentId);

if (!empty($ids))
{
$query->where('id NOT IN ( ' . implode($ids, ',') . ')');
}

$db->setQuery($query);
$db->execute();
}

$db->setQuery($query);
$db->execute();
}
}

Expand Down

0 comments on commit 7a2463f

Please sign in to comment.