Loading dev/depenses/sifac/commandes.sql +5 −1 Original line number Diff line number Diff line SELECT DISTINCT SAPSR3.FMIOI.STUNR DISTINCT SAPSR3.FMIOI.TRBTR AS MONTANT, FROM SAPSR3.FMIOI, Loading Loading @@ -38,3 +39,6 @@ WHERE sapsr3.fmioi.measure = '011C055C' AND SAPSR3.FMIOI.WRTTP = '51' AND SAPSR3.FMIOI.STUNR = '3000000018715536' ORDER BY SAPSR3.FMIOI.STUNR No newline at end of file module/Oscar/src/Oscar/Command/OscarSpentTestDatasCommand.php +32 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Oscar\Service\OscarConfigurationService; use Oscar\Service\OscarUserContext; use Oscar\Service\SpentService; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; Loading @@ -29,7 +30,9 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $this ->setDescription("Permet d'obtenir les données des dépenses") ->setHelp("") ->addArgument('pfi', InputArgument::OPTIONAL, "PFI"); ->addArgument('query', InputArgument::REQUIRED, "Query") ->addArgument('pfi', InputArgument::OPTIONAL, "PFI") ; } protected function execute(InputInterface $input, OutputInterface $output) Loading @@ -47,6 +50,7 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $oscarConfig = $this->getServicemanager()->get(OscarConfigurationService::class); $pfi = $input->getArgument('pfi'); $query = $input->getArgument('query'); if ($pfi) { $io->writeln("PFI : $pfi"); Loading @@ -56,9 +60,7 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract return Command::FAILURE; } try { $connectorConfig = $oscarConfig->getConfiguration('connectors.spent'); $keysConfig = array_keys($connectorConfig); if (count($keysConfig) == 0) { $io->error("Pas de synchronisation des dépenses configuré"); Loading @@ -68,7 +70,18 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $io->error("Oscar ne prends en charge qu'une source de synchronisation pour les dépenses."); return Command::FAILURE; } if ($query) { $io->writeln("QUERY : $query"); } else { $io->error("QUERY requise (default)"); return Command::FAILURE; } try { $conf = $connectorConfig[$keysConfig[0]]; $class = $conf['class']; $factory = new \ReflectionClass($class); Loading @@ -78,10 +91,23 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract [$this->getServicemanager()->get(SpentService::class), $conf['params']] ); $result = $instance->data($pfi, true); $io->write($result); return Command::SUCCESS; $result = $instance->data($pfi, $query); if( count($result) > 1) { $table = new Table($output); $table->setHeaders(array_keys($result[0])); $rows = []; foreach ($result as $row) { $rows[] = $row; } $table->setRows($rows); $table->render(); } else { $io->info("Aucun résultat pour $pfi avec la requête $query"); } $io->write(count($result). " résultat(s)"); return Command::SUCCESS; } catch (\Exception $e) { $io->error("Impossible de synchroniser les dépenses : " . $e->getMessage()); return Command::FAILURE; Loading module/Oscar/src/Oscar/Connector/ConnectorSpentSifacOCI.php +14 −5 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; class ConnectorSpentSifacOCI { const QUERY_DEFAULT = 'default'; /** @var SpentService */ private SpentService $spentService; Loading Loading @@ -58,14 +60,21 @@ class ConnectorSpentSifacOCI return $queries; } public function data(string $pfi) :array public function data(string $pfi, string $queryTagName) :array { $queries = $this->getQueries(); foreach ($queries as $query) { $result = $this->query($pfi, $query); if( $queryTagName == self::QUERY_DEFAULT ){ $querySend = $this->sifacAccess['spent_query']; } else { if( array_key_exists($queryTagName, $queries) ) { $querySend = $this->getQueries()[$queryTagName]; } else { throw new OscarException("La requête $queryTagName n'existe pas"); } } var_dump($result); die("DATA $pfi"); $datas = $this->query($pfi, $querySend); return $datas; } protected function query(string $pfi, string $query) :array { Loading Loading
dev/depenses/sifac/commandes.sql +5 −1 Original line number Diff line number Diff line SELECT DISTINCT SAPSR3.FMIOI.STUNR DISTINCT SAPSR3.FMIOI.TRBTR AS MONTANT, FROM SAPSR3.FMIOI, Loading Loading @@ -38,3 +39,6 @@ WHERE sapsr3.fmioi.measure = '011C055C' AND SAPSR3.FMIOI.WRTTP = '51' AND SAPSR3.FMIOI.STUNR = '3000000018715536' ORDER BY SAPSR3.FMIOI.STUNR No newline at end of file
module/Oscar/src/Oscar/Command/OscarSpentTestDatasCommand.php +32 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Oscar\Service\OscarConfigurationService; use Oscar\Service\OscarUserContext; use Oscar\Service\SpentService; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; Loading @@ -29,7 +30,9 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $this ->setDescription("Permet d'obtenir les données des dépenses") ->setHelp("") ->addArgument('pfi', InputArgument::OPTIONAL, "PFI"); ->addArgument('query', InputArgument::REQUIRED, "Query") ->addArgument('pfi', InputArgument::OPTIONAL, "PFI") ; } protected function execute(InputInterface $input, OutputInterface $output) Loading @@ -47,6 +50,7 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $oscarConfig = $this->getServicemanager()->get(OscarConfigurationService::class); $pfi = $input->getArgument('pfi'); $query = $input->getArgument('query'); if ($pfi) { $io->writeln("PFI : $pfi"); Loading @@ -56,9 +60,7 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract return Command::FAILURE; } try { $connectorConfig = $oscarConfig->getConfiguration('connectors.spent'); $keysConfig = array_keys($connectorConfig); if (count($keysConfig) == 0) { $io->error("Pas de synchronisation des dépenses configuré"); Loading @@ -68,7 +70,18 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract $io->error("Oscar ne prends en charge qu'une source de synchronisation pour les dépenses."); return Command::FAILURE; } if ($query) { $io->writeln("QUERY : $query"); } else { $io->error("QUERY requise (default)"); return Command::FAILURE; } try { $conf = $connectorConfig[$keysConfig[0]]; $class = $conf['class']; $factory = new \ReflectionClass($class); Loading @@ -78,10 +91,23 @@ class OscarSpentTestDatasCommand extends OscarCommandAbstract [$this->getServicemanager()->get(SpentService::class), $conf['params']] ); $result = $instance->data($pfi, true); $io->write($result); return Command::SUCCESS; $result = $instance->data($pfi, $query); if( count($result) > 1) { $table = new Table($output); $table->setHeaders(array_keys($result[0])); $rows = []; foreach ($result as $row) { $rows[] = $row; } $table->setRows($rows); $table->render(); } else { $io->info("Aucun résultat pour $pfi avec la requête $query"); } $io->write(count($result). " résultat(s)"); return Command::SUCCESS; } catch (\Exception $e) { $io->error("Impossible de synchroniser les dépenses : " . $e->getMessage()); return Command::FAILURE; Loading
module/Oscar/src/Oscar/Connector/ConnectorSpentSifacOCI.php +14 −5 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; class ConnectorSpentSifacOCI { const QUERY_DEFAULT = 'default'; /** @var SpentService */ private SpentService $spentService; Loading Loading @@ -58,14 +60,21 @@ class ConnectorSpentSifacOCI return $queries; } public function data(string $pfi) :array public function data(string $pfi, string $queryTagName) :array { $queries = $this->getQueries(); foreach ($queries as $query) { $result = $this->query($pfi, $query); if( $queryTagName == self::QUERY_DEFAULT ){ $querySend = $this->sifacAccess['spent_query']; } else { if( array_key_exists($queryTagName, $queries) ) { $querySend = $this->getQueries()[$queryTagName]; } else { throw new OscarException("La requête $queryTagName n'existe pas"); } } var_dump($result); die("DATA $pfi"); $datas = $this->query($pfi, $querySend); return $datas; } protected function query(string $pfi, string $query) :array { Loading