Commit fda0da8f3f1680a2aff893e33df67e89d12a6e96

Authored by Benjamin Renard
1 parent f2ae344a

Fix incompatibility between #11588 & #11538

src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php
... ... @@ -62,7 +62,7 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface
62 62 /*
63 63 * @brief Unmarshall the time definition from the IHM request
64 64 */
65   - protected function unmarshallTimeDefinition($input, $requestIndex, &$ttFileIndex = -1, $ttIntIndex = -1)
  65 + protected function unmarshallTimeDefinition($input, $requestIndex, &$ttFileIndex = NULL, $ttIntIndex = NULL)
66 66 {
67 67 $requestNodes = $this->paramsData->getRequestNodes();
68 68 $timesNode = $requestNodes[$requestIndex]->getTimesNode();
... ... @@ -72,21 +72,25 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface
72 72 switch ($input->timesrc)
73 73 {
74 74 case "TimeTable" :
75   - if($ttIntIndex == -1 && $ttFileIndex == -1)
76   - $ttFileIndex = count($input->timeTables) -1;
77   - if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables)))
78   - $ttFileIndex = 0;
79   - if($ttFileIndex < 0)
80   - $ttFileIndex = count($input->timeTables) -1;
  75 + if (isset($ttFileIndex) && isset($ttIntIndex)) {
  76 + if($ttIntIndex == -1 && $ttFileIndex == -1)
  77 + $ttFileIndex = count($input->timeTables) -1;
  78 + if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables)))
  79 + $ttFileIndex = 0;
  80 + if($ttFileIndex < 0)
  81 + $ttFileIndex = count($input->timeTables) -1;
  82 + }
81 83  
82 84 $crtIndex = 0;
83 85 foreach ($input->timeTables as $tt)
84 86 {
85   - if (($ttFileIndex >= 0 ) && ($ttFileIndex != $crtIndex))
86   - {
87   - // Do not plot this TT
88   - ++$crtIndex;
89   - continue;
  87 + if (isset($ttFileIndex)) {
  88 + if (($ttFileIndex >= 0 ) && ($ttFileIndex != $crtIndex))
  89 + {
  90 + // Do not plot this TT
  91 + ++$crtIndex;
  92 + continue;
  93 + }
90 94 }
91 95  
92 96 if (strpos($tt->id, "sharedtimeTable_") === 0) {
... ...
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -18,7 +18,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
18 18 private $interactiveTimeSelectionState = array();
19 19 private $interactivePlotTitle = array();
20 20 private $interactivePlotIndex = array();
21   - private $interactiveCrtTTFileIndex = -1;
  21 + private $interactiveCrtTTFileIndex = NULL;
22 22 private $interactivePreview = false;
23 23  
24 24 protected $isMultiPlot = FALSE;
... ... @@ -53,8 +53,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
53 53  
54 54 //unmarshall time definition
55 55 $isIntervalRequest = ($input->timesrc == 'Interval');
56   - $ttFileIndex = -1;
57   - $ttIntIndex = -1;
  56 + $ttFileIndex = NULL;
  57 + $ttIntIndex = NULL;
58 58 if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) {
59 59 $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'};
60 60 $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'};
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php
... ... @@ -186,24 +186,26 @@ class RequestTimesNodeClass extends NodeClass
186 186 return $this->getChildrenByName(REQUESTTIMEINTERVAL_NAME);
187 187 }
188 188  
189   - public function addTimeTable($id = "", $name = "", $index = -1)
  189 + public function addTimeTable($id = "", $name = "", $index = NULL)
190 190 {
191 191 $timeTable = new RequestTimesTimeTableNodeClass();
192 192 $timeTable->setId($id);
193 193 if ($name != '')
194 194 $timeTable->setTTName($name);
195   - $timeTable->setIndex($index);
  195 + if (isset($index))
  196 + $timeTable->setIndex($index);
196 197 $this->addChild($timeTable);
197 198 return $timeTable;
198 199 }
199 200  
200   - public function addCatalog($id = "", $name = "", $index = -1)
  201 + public function addCatalog($id = "", $name = "", $index = NULL)
201 202 {
202 203 $catalogNode = new RequestCatalogNodeClass();
203 204 $catalogNode->setId($id);
204 205 if ($name != '')
205 206 $catalogNode->setCatalogName($name);
206   - $catalogNode->setIndex($index);
  207 + if (isset($index))
  208 + $catalogNode->setIndex($index);
207 209 $this->addChild($catalogNode);
208 210 return $catalogNode;
209 211 }
... ...