Skip to content

Commit

Permalink
Fix for copying rows (using list copy plugin) with multi-select joins…
Browse files Browse the repository at this point in the history
… (checkbox), fixing issue where it was saving map table id's rather than FK's (because it's using data from form model getData(), rather than submitted data).
  • Loading branch information
cheesegrits committed Jun 27, 2017
1 parent 9b5d5b6 commit 73883e2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion components/com_fabrik/models/element.php
Expand Up @@ -7479,7 +7479,25 @@ public function onFinalStoreRow(&$data)

$join = $this->getJoin();

// The submitted element's values
/*
* The submitted element's values
*
* NOTE - if we are coming from a list row copy, the _raw data is actually the map table
* id's, not the FK's, because we used form model getData to load it. So we need to stuff the
* actual FK's (in the _id array) back into _raw
*/

if (array_key_exists('fabrik_copy_from_table', $formData))
{
$idName = $name . '_id';
$idValues = FArrayHelper::getValue($formData, $idName, array());

if (!empty($idValues))
{
$formData[$rawName] = $idValues;
}
}

$d = FArrayHelper::getValue($formData, $rawName, FArrayHelper::getValue($formData, $name));
// set $emptyish to false so if no selection, we don't save a bogus empty row
$allJoinValues = FabrikWorker::JSONtoData($d, true, false);
Expand Down

0 comments on commit 73883e2

Please sign in to comment.