Commit cd3326be95f6f33b1eb1126ed836c3e6958bdf87
1 parent
a7011f4d
Exists in
master
and in
66 other branches
Fix function used to retrieve linked parameters used by a parameter
Showing
1 changed file
with
17 additions
and
15 deletions
Show diff stats
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -129,19 +129,19 @@ class IHMParamManagerClass |
129 | 129 | $doc->preserveWhiteSpace = false; |
130 | 130 | $doc->formatOutput = true; |
131 | 131 | |
132 | - $real_param_id = $real_param_id; | |
132 | + $real_param_id = $paramId; | |
133 | 133 | if ($this->templateParamsManager->isTemplatedParam($paramId)) { |
134 | - $paramPath = $this->templateParamsManager->generateTemplatedParamFile($paramId, $templateArgs); | |
134 | + $paramPath = $this->templateParamsManager->getTemplatePath($paramId); | |
135 | 135 | $real_param_id = $this->templateParamsManager->getTemplatedParamId($paramId, $templateArgs); |
136 | + if (empty($paramPath) || !$doc->load($paramPath)) | |
137 | + throw new Exception('Cannot find parameter template file '.$paramPath); | |
136 | 138 | } |
137 | 139 | else { |
138 | 140 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; |
141 | + if (empty($paramPath) || !$doc->load($paramPath)) | |
142 | + throw new Exception('Cannot find parameter local file '.$paramPath); | |
139 | 143 | } |
140 | 144 | |
141 | - | |
142 | - if (empty($paramPath) || !$doc->load($paramPath)) | |
143 | - throw new Exception('Cannot find parameter local file '.$paramId); | |
144 | - | |
145 | 145 | //<get> |
146 | 146 | $getNodes = $doc->getElementsByTagName('get'); |
147 | 147 | |
... | ... | @@ -156,17 +156,19 @@ class IHMParamManagerClass |
156 | 156 | foreach($amdaParamNodes as $amdaParamNode) |
157 | 157 | { |
158 | 158 | $linkedParamId = $amdaParamNode->getAttribute('name'); |
159 | - if ($linkedParamId == '') | |
159 | + if (empty($linkedParamId)) | |
160 | 160 | continue; |
161 | - $real_linked_param_id = $linkedParamId; | |
162 | - if ($this->templateParamsManager->isTemplatedParam($linkedParamId)) { | |
163 | - $linkedParamPath = $this->templateParamsManager->generateTemplatedParamFile($linkedParamId, $templateArgs); | |
164 | - $real_linked_param_id = $this->templateParamsManager->getTemplatedParamId($linkedParamId, $templateArgs); | |
161 | + $parsed_param = $this->templateParamsManager->parseTemplatedParam($linkedParamId); | |
162 | + if ($parsed_param === FALSE) { | |
163 | + $real_linked_param_id = $linkedParamId; | |
164 | + $linkedParamPath = IHMConfigClass::getLocalParamDBPath().$real_linked_param_id.".xml"; | |
165 | + } | |
166 | + else { | |
167 | + $real_linked_param_id = $parsed_param['paramid']; | |
168 | + $linkedParamPath = $this->templateParamsManager->generateTemplatedParamFile($real_linked_param_id, $templateArgs); | |
165 | 169 | } |
166 | - else | |
167 | - $linkedParamPath = IHMConfigClass::getLocalParamDBPath().$linkedParamId.".xml"; | |
168 | - $paramsData->addParamToCopy($real_linked_param_id,$linkedParamPath); | |
169 | - $this->addLinkedLocalParams($linkedParamId, $paramsData); | |
170 | + $paramsData->addParamToCopy($linkedParamId,$linkedParamPath); | |
171 | + $this->addLinkedLocalParams($real_linked_param_id, $paramsData); | |
170 | 172 | } |
171 | 173 | } |
172 | 174 | |
... | ... |