Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instruments variable incorrectly defined #6140

Merged
merged 5 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ abstract class NDB_BVL_Instrument extends NDB_Page
*/
public $preview = false;

/**
* Array used by LINST instruments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the comment more descriptive? Used for what?

*/
protected $selectMultipleElements;

/**
* Factory generates a new instrument instance of type
* $instrument, and runs the setup() method on that new
Expand Down Expand Up @@ -541,8 +546,8 @@ abstract class NDB_BVL_Instrument extends NDB_Page
= $defaults['Candidate_Age'] . " (Age out of range)";
}
//Convert select multiple elements into a lorisform array
if (!empty($this->_selectMultipleElements)) {
foreach ($this->_selectMultipleElements AS $elname) {
if (!empty($this->selectMultipleElements)) {
foreach ($this->selectMultipleElements AS $elname) {
if (isset($defaults[$elname])
&& stristr($defaults[$elname], "{@}")
) {
Expand Down Expand Up @@ -763,8 +768,8 @@ abstract class NDB_BVL_Instrument extends NDB_Page
}

//Convert select multiple elements into database storable values
if (!empty($this->_selectMultipleElements)) {
foreach ($this->_selectMultipleElements AS $elname) {
if (!empty($this->selectMultipleElements)) {
foreach ($this->selectMultipleElements AS $elname) {
if (isset($values[$elname]) && is_array($values[$elname])) {
$values[$elname] = implode("{@}", $values[$elname]);
}
Expand Down
4 changes: 1 addition & 3 deletions php/libraries/NDB_BVL_Instrument_LINST.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument

public $LinstLines = array();

private $_selectMultipleElements;

/**
* Sets up the variables required for a LINST instrument to load
*
Expand Down Expand Up @@ -614,7 +612,7 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument

case 'selectmultiple':
$type = 'multiple';
$this->_selectMultipleElements[] = $pieces[1];
$this->selectMultipleElements[] = $pieces[1];
// fall through and also execute select code below
case 'select':
$options = preg_split("/{-}/", trim($pieces[3]));
Expand Down