From 09d156765143912cfec56128345861682ae1ec17 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 10 Jun 2013 16:06:23 -0700 Subject: [PATCH] Fix mistake in GenCode --- xml/GenCode.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xml/GenCode.php b/xml/GenCode.php index 549c50533e..43b34ab8be 100644 --- a/xml/GenCode.php +++ b/xml/GenCode.php @@ -706,7 +706,7 @@ Alternatively you can get a version of CiviCRM that matches your PHP version $field['dataPattern'] = $this->value('dataPattern', $fieldXML); $field['uniqueName'] = $this->value('uniqueName', $fieldXML); $field['pseudoconstant'] = $this->value('pseudoconstant', $fieldXML); - if(is_object($field['pseudoconstant'])){ + if(!empty($field['pseudoconstant'])){ //ok this is a bit long-winded but it gets there & is consistent with above approach $field['pseudoconstant'] = array(); $validOptions = array( @@ -719,11 +719,17 @@ Alternatively you can get a version of CiviCRM that matches your PHP version 'labelColumn', 'condition', ); - foreach ($validOptions as $pseudoOption){ + foreach ($validOptions as $pseudoOption) { if(!empty($fieldXML->pseudoconstant->$pseudoOption)){ $field['pseudoconstant'][$pseudoOption] = $this->value($pseudoOption, $fieldXML->pseudoconstant); } } + // For now, fields that have option lists that are not in the db can simply + // declare an empty pseudoconstant tag and we'll add this placeholder. + // That field's BAO::buildOptions fn will need to be responsible for generating the option list + if (empty($field['pseudoconstant'])) { + $field['pseudoconstant'] = 'not in database'; + } } $fields[$name] = &$field; } -- 2.25.1