Commit c73bd535e16ef7b1ea048cb7ee1bf0ce4c54c51c

Authored by Benjamin Renard
1 parent 6a8aef7f

Fix working for getTimeTable & getCatalog API

src/InputOutput/WSImpl/TimeTables/WSInputOutputTTClass.php
... ... @@ -28,21 +28,21 @@ class WSInputOutputTTClass extends IHMInputOutputTTClass
28 28 $processData = new TTRequestDataClass();
29 29 $processData->setInputFileName($input['inputFile']);
30 30 $processData->setInputFileFormat(TTRequestFileFormatEnum::INTERNAL);
31   - $processData->setOutputDir(WSConfigClass::getWsResultDir());
  31 + $processData->setOutputDir(IHMConfigClass::getDownloadTmpPath());
32 32 $processData->setOutputFileName($input['outputFileName']);
33 33 $outputFormat = empty($input['outputFormat']) ? 'VOTABLE' : $input['outputFormat'];
34   - switch ($outputFormat) {
35   - case 'ASCII':
  34 + switch (strtolower($outputFormat)) {
  35 + case 'ascii':
36 36 $processData->setOutputFileFormat(TTRequestFileFormatEnum::ASCII);
37 37 break;
38   - case 'VOTABLE':
  38 + case 'votable':
39 39 $processData->setOutputFileFormat(TTRequestFileFormatEnum::VOTABLE);
40 40 break;
41   - case 'INTERNAL':
  41 + case 'internal':
42 42 $processData->setOutputFileFormat(TTRequestFileFormatEnum::INTERNAL);
43 43 break;
44   - case 'HPEVENT':
45   - $processData->setOutputFileFormat(TTRequestFileFormatEnum::SPASE);
  44 + case 'hpevent':
  45 + $processData->setOutputFileFormat(TTRequestFileFormatEnum::SPACE);
46 46 break;
47 47 default:
48 48 throw new Exception('Unknown output format');
... ... @@ -52,6 +52,10 @@ class WSInputOutputTTClass extends IHMInputOutputTTClass
52 52  
53 53 $this->processData = $processData;
54 54  
  55 + $this->postProcessTT = new PostProcessTTClass();
  56 + $this->postProcessTT->setOutputDirAlias(IHMConfigClass::getDownloadTmpPath());
  57 + $this->postProcessTT->setPostCmd("mv \"".IHMConfigClass::getDownloadTmpPath().$input['outputFileName']."\" \"".WSConfigClass::getWsResultDir().$input['outputFileName']."\"");
  58 +
55 59 return $this->processData;
56 60 }
57 61  
... ... @@ -62,7 +66,9 @@ class WSInputOutputTTClass extends IHMInputOutputTTClass
62 66 {
63 67 $result = array('success' => $data->getSuccess());
64 68 if ($result['success']) {
65   - $result['file'] = $data->getOutputDir()."/".$data->getOutputFileName();
  69 + $cmd = $this->postProcessTT->getPostCmd();
  70 + system($cmd);
  71 + $result['file'] = WSConfigClass::getWsResultDir()."/".$data->getOutputFileName();
66 72 }
67 73 return $result;
68 74 }
... ...