From fda0da8f3f1680a2aff893e33df67e89d12a6e96 Mon Sep 17 00:00:00 2001 From: Benjamin Renard <benjamin.renard@akka.eu> Date: Mon, 18 Mar 2024 08:46:18 +0000 Subject: [PATCH] Fix incompatibility between #11588 & #11538 --- src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php | 28 ++++++++++++++++------------ src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php | 6 +++--- src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php | 10 ++++++---- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php b/src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php index 0b35194..fb5541e 100644 --- a/src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php +++ b/src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php @@ -62,7 +62,7 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface /* * @brief Unmarshall the time definition from the IHM request */ - protected function unmarshallTimeDefinition($input, $requestIndex, &$ttFileIndex = -1, $ttIntIndex = -1) + protected function unmarshallTimeDefinition($input, $requestIndex, &$ttFileIndex = NULL, $ttIntIndex = NULL) { $requestNodes = $this->paramsData->getRequestNodes(); $timesNode = $requestNodes[$requestIndex]->getTimesNode(); @@ -72,21 +72,25 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface switch ($input->timesrc) { case "TimeTable" : - if($ttIntIndex == -1 && $ttFileIndex == -1) - $ttFileIndex = count($input->timeTables) -1; - if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables))) - $ttFileIndex = 0; - if($ttFileIndex < 0) - $ttFileIndex = count($input->timeTables) -1; + if (isset($ttFileIndex) && isset($ttIntIndex)) { + if($ttIntIndex == -1 && $ttFileIndex == -1) + $ttFileIndex = count($input->timeTables) -1; + if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables))) + $ttFileIndex = 0; + if($ttFileIndex < 0) + $ttFileIndex = count($input->timeTables) -1; + } $crtIndex = 0; foreach ($input->timeTables as $tt) { - if (($ttFileIndex >= 0 ) && ($ttFileIndex != $crtIndex)) - { - // Do not plot this TT - ++$crtIndex; - continue; + if (isset($ttFileIndex)) { + if (($ttFileIndex >= 0 ) && ($ttFileIndex != $crtIndex)) + { + // Do not plot this TT + ++$crtIndex; + continue; + } } if (strpos($tt->id, "sharedtimeTable_") === 0) { diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index fd78073..cd318ae 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -18,7 +18,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass private $interactiveTimeSelectionState = array(); private $interactivePlotTitle = array(); private $interactivePlotIndex = array(); - private $interactiveCrtTTFileIndex = -1; + private $interactiveCrtTTFileIndex = NULL; private $interactivePreview = false; protected $isMultiPlot = FALSE; @@ -53,8 +53,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //unmarshall time definition $isIntervalRequest = ($input->timesrc == 'Interval'); - $ttFileIndex = -1; - $ttIntIndex = -1; + $ttFileIndex = NULL; + $ttIntIndex = NULL; if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) { $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php index ccc4e4c..3be70f5 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestTimesNodeClass.php @@ -186,24 +186,26 @@ class RequestTimesNodeClass extends NodeClass return $this->getChildrenByName(REQUESTTIMEINTERVAL_NAME); } - public function addTimeTable($id = "", $name = "", $index = -1) + public function addTimeTable($id = "", $name = "", $index = NULL) { $timeTable = new RequestTimesTimeTableNodeClass(); $timeTable->setId($id); if ($name != '') $timeTable->setTTName($name); - $timeTable->setIndex($index); + if (isset($index)) + $timeTable->setIndex($index); $this->addChild($timeTable); return $timeTable; } - public function addCatalog($id = "", $name = "", $index = -1) + public function addCatalog($id = "", $name = "", $index = NULL) { $catalogNode = new RequestCatalogNodeClass(); $catalogNode->setId($id); if ($name != '') $catalogNode->setCatalogName($name); - $catalogNode->setIndex($index); + if (isset($index)) + $catalogNode->setIndex($index); $this->addChild($catalogNode); return $catalogNode; } -- libgit2 0.21.2