Skip to content

Commit

Permalink
Making subform filter enforcement compatible with the new handle-base…
Browse files Browse the repository at this point in the history
…d data storage format
  • Loading branch information
jegelstaff committed Nov 11, 2024
1 parent 5ad3cb6 commit 7ef670e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/formulize/include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7017,12 +7017,14 @@ function getFilterValuesForEntry($subformConditions, $curlyBracketEntryid=null)
foreach($subformConditions[1] as $i=>$thisOp) {
if($thisOp == "=" AND $subformConditions[3][$i] != "oom") {
if($conditionElementObject = $element_handler->get($subformConditions[0][$i])) {
$subformConditionElementHandle = convertElementIdsToElementHandles(array($subformConditions[0][$i]));
$subformConditionElementHandle = $subformConditionElementHandle[0];
// check first for URL matches
$conditionElementFid = $conditionElementObject->getVar('id_form');
if(substr($subformConditions[2][$i],0,1) == "{" AND substr($subformConditions[2][$i],-1)=="}") {
$curlyBracketTerm = substr($subformConditions[2][$i],1,-1);
if(isset($_GET[$curlyBracketTerm]) AND ($_GET[$curlyBracketTerm] OR $_GET[$curlyBracketTerm] === 0)) {
$filterValues[$conditionElementFid][$subformConditions[0][$i]] = strip_tags(htmlspecialchars($_GET[$curlyBracketTerm], ENT_QUOTES));
$filterValues[$conditionElementFid][$subformConditionElementHandle] = strip_tags(htmlspecialchars($_GET[$curlyBracketTerm], ENT_QUOTES));
continue;
}
}
Expand All @@ -7036,13 +7038,13 @@ function getFilterValuesForEntry($subformConditions, $curlyBracketEntryid=null)
$sourceFid = $linkProperties[0];
if($dynamicElement = $element_handler->get($curlyBracketTerm)) {
if($dynamicElement->getVar('id_form') == $sourceFid) {
$filterValues[$conditionElementFid][$subformConditions[0][$i]] = $curlyBracketEntryid;
$filterValues[$conditionElementFid][$subformConditionElementHandle] = $curlyBracketEntryid;
continue;
}
}
}
if(!isset($filterValues[$conditionElementFid][$subformConditions[0][$i]])) {
$filterValues[$conditionElementFid][$subformConditions[0][$i]] = prepareLiteralTextForDB($conditionElementObject, $subformConditions[2][$i], $curlyBracketEntryid);
$filterValues[$conditionElementFid][$subformConditionElementHandle] = prepareLiteralTextForDB($conditionElementObject, $subformConditions[2][$i], $curlyBracketEntryid);
}
}
}
Expand Down

0 comments on commit 7ef670e

Please sign in to comment.