From ea67a6390766bbe8c8b777dd116e85d6487346c9 Mon Sep 17 00:00:00 2001 From: Dave MacFarlane Date: Mon, 29 May 2023 11:16:09 -0400 Subject: [PATCH] [LINST] Add .meta option to skip XIN rules 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. --- php/libraries/NDB_BVL_Instrument_LINST.class.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/php/libraries/NDB_BVL_Instrument_LINST.class.inc b/php/libraries/NDB_BVL_Instrument_LINST.class.inc index 294b2040995..26aa2dae6ab 100644 --- a/php/libraries/NDB_BVL_Instrument_LINST.class.inc +++ b/php/libraries/NDB_BVL_Instrument_LINST.class.inc @@ -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 * @@ -480,7 +485,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, @@ -926,6 +933,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; }