Commit 3ec3ea9ceecf2b3c6dedf82d835d11fba7e96828
1 parent
2ac8da6c
Exists in
master
and in
109 other branches
add spectra
Showing
1 changed file
with
27 additions
and
1 deletions
Show diff stats
php/classes/UserWsTransfer.php
@@ -7,7 +7,7 @@ class UserWsTransfer { | @@ -7,7 +7,7 @@ class UserWsTransfer { | ||
7 | 7 | ||
8 | private $oldWs, $newWs, $Mgr; | 8 | private $oldWs, $newWs, $Mgr; |
9 | private $oldWsDir, $newWsDir; | 9 | private $oldWsDir, $newWsDir; |
10 | - private $ws_deleted, $wsd_deleted, $pairs; | 10 | + private $ws_deleted, $wsd_deleted, $pairs, $specParams; |
11 | 11 | ||
12 | function __construct($user) | 12 | function __construct($user) |
13 | { | 13 | { |
@@ -29,6 +29,7 @@ class UserWsTransfer { | @@ -29,6 +29,7 @@ class UserWsTransfer { | ||
29 | $this->ws_deleted = array(); | 29 | $this->ws_deleted = array(); |
30 | $this->wsd_deleted = array(); | 30 | $this->wsd_deleted = array(); |
31 | $this->getModified(); | 31 | $this->getModified(); |
32 | + $this->getSpectra(); | ||
32 | } | 33 | } |
33 | 34 | ||
34 | private function getObsolete() { | 35 | private function getObsolete() { |
@@ -125,6 +126,20 @@ class UserWsTransfer { | @@ -125,6 +126,20 @@ class UserWsTransfer { | ||
125 | $this->pairs = $pairs; | 126 | $this->pairs = $pairs; |
126 | } | 127 | } |
127 | 128 | ||
129 | + private function getSpectra() | ||
130 | + { | ||
131 | + $convertXML = new DomDocument("1.0"); | ||
132 | + $modifiedFile = CONVERSIONDIR.'SpectraModifs.xml'; | ||
133 | + | ||
134 | + if (!$convertXML->load($modifiedFile)) | ||
135 | + error_log('ERROR loading '.$modifiedFile,1,email); | ||
136 | + $convertedNodes = $convertXML->getElementsByTagName('deleted'); | ||
137 | + | ||
138 | + foreach ($convertedNodes as $item) { | ||
139 | + $this->specParams[] = $item->getAttribute('xml:id'); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
128 | private function updateParams($expression) | 143 | private function updateParams($expression) |
129 | { | 144 | { |
130 | $newExp = strtr($expression, $this->pairs); | 145 | $newExp = strtr($expression, $this->pairs); |
@@ -255,6 +270,12 @@ class UserWsTransfer { | @@ -255,6 +270,12 @@ class UserWsTransfer { | ||
255 | continue; | 270 | continue; |
256 | } | 271 | } |
257 | 272 | ||
273 | + if ($this->deleteParam($expression,$this->spectraParams)) { | ||
274 | + $msg .= '<li><i>'.$name.'</i> : too much difference <br/> '.$expression.'<br/>'; | ||
275 | + $this->ws_deleted[] = $name; | ||
276 | + continue; | ||
277 | + } | ||
278 | + | ||
258 | $expressionUpdated = $this->updateParams($expression); | 279 | $expressionUpdated = $this->updateParams($expression); |
259 | $wsParamNode->appendChild($this->newWs->importNode($param)); | 280 | $wsParamNode->appendChild($this->newWs->importNode($param)); |
260 | 281 | ||
@@ -390,6 +411,11 @@ class UserWsTransfer { | @@ -390,6 +411,11 @@ class UserWsTransfer { | ||
390 | continue; | 411 | continue; |
391 | } | 412 | } |
392 | 413 | ||
414 | + if ($this->deleteParam($expression,$this->specParams)) { | ||
415 | + $msg .= '<li><i>'.$name.'</i> : too much difference <br/> '.$expression.'<br/>'; | ||
416 | + $cond_deleted[] = $name; | ||
417 | + continue; | ||
418 | + } | ||
393 | $expressionUpdated = $this->updateParams($expression); | 419 | $expressionUpdated = $this->updateParams($expression); |
394 | $condObj->expression = $expressionUpdated; | 420 | $condObj->expression = $expressionUpdated; |
395 | file_put_contents(NEWUSERPATH.TRANSFERUSER."/REQ/".$id, json_encode($condObj)); | 421 | file_put_contents(NEWUSERPATH.TRANSFERUSER."/REQ/".$id, json_encode($condObj)); |