Skip to content

Commit

Permalink
[LINST] Add .meta option to skip XIN rules (aces#8714)
Browse files Browse the repository at this point in the history
XIN rules default to requiring everything unless otherwise
specified. This is not useful for all instruments (for instance,
LINST files that are used to import data from other systems where
we don't support their rule format) so this adds an option
to disable the rules for an instrument in the .meta file.
  • Loading branch information
driusan authored and sanjay-thiyagarajan committed Jun 17, 2023
1 parent 6cf118a commit 0889081
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion php/libraries/NDB_BVL_Instrument_LINST.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
// array of the format "field_name" => "group_name"
protected $GroupElements = [];

/**
* Do not require rules by default.
*/
private $skipRules = false;

/**
* Sets up the variables required for a LINST instrument to load
*
Expand Down Expand Up @@ -413,7 +418,9 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
}
$this->formType = 'XIN';

$this->form->addFormRule([&$this, 'XINValidate']);
if (!$this->skipRules) {
$this->form->addFormRule([&$this, 'XINValidate']);
}
$fp = fopen($filename, "r");

// Add elements is only true if we're parsing the current page,
Expand Down Expand Up @@ -927,6 +934,9 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
case 'postmortem':
$this->postMortem = trim($pieces[1]) === 'true';
break;
case 'norules':
$this->skipRules = trim($pieces[1]) === 'true';
break;
default:
break;
}
Expand Down

0 comments on commit 0889081

Please # to comment.