Skip to content

Commit

Permalink
Merge pull request #8103 from ridz1208/PUSH_v23.0.11_INTO_24.0-release
Browse files Browse the repository at this point in the history
Push v23.0.11 into 24.0 release
  • Loading branch information
driusan committed Jun 6, 2022
2 parents 82a5283 + ccb0ab1 commit 03f4440
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions php/libraries/NDB_BVL_Instrument_LINST.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
protected $fullName;
protected $dictionary = [];

// array of the format "field_name" => "group_name"
protected $GroupElements = [];

/**
* Sets up the variables required for a LINST instrument to load
*
Expand Down Expand Up @@ -338,7 +341,11 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
} else if (substr($elname, -7) != "_status"
&& !in_array($elname, ["page", "subtest"])
) {
$errors[$elname] = "Required.";
// Check if element part of a group.
// If so, the error should be on the group to show up
$errorEl = $this->GroupElements[$elname] ?? $elname;
$errors[$errorEl] = "$elname is required.";

if ($this->XINDebug) {
echo "Required by default";
}
Expand Down Expand Up @@ -554,7 +561,7 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
break;
case 'begingroup':
if ($addElements) {
$Group['Name'] = $pieces[1] . '_group';
$Group['Name'] = trim($pieces[1]) . '_group';
$Group['Delimiter'] = isset($pieces[2])
? trim($pieces[2]) : $this->_GUIDelimiter;
}
Expand All @@ -569,6 +576,14 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
$Group['Delimiter'],
);

// Track elements and their groups for XIN errors proper
// higlighting in the browser
foreach ($Group['Elements'] as $el) {
if (isset($el['name'])) {
$this->GroupElements[$el['name']] = $Group['Name'];
}
}

$Group['Name'] = null;
$Group['Elements'] = [];
}
Expand Down

0 comments on commit 03f4440

Please # to comment.