FIX: ventas_ids vacios

This commit is contained in:
Juan Pablo Vial
2025-06-03 16:02:04 -04:00
parent e796d91d95
commit d4b1a66a9e

View File

@ -9,7 +9,7 @@ class Reset extends Command
{
protected function configure(): void
{
$this->addOption('venta_ids', 'vid', Console\Input\InputOption::VALUE_OPTIONAL, 'Venta IDs separated by |', '');
$this->addOption('venta_ids', 'vid', Console\Input\InputOption::VALUE_REQUIRED, 'Venta IDs separated by |', '');
}
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output): int
@ -17,7 +17,11 @@ class Reset extends Command
$this->logger->debug("Running {$this->getName()}");
$uri = '/api/external/toku/reset';
$output->writeln("DELETE {$uri}");
$body = ['venta_ids' => explode('|', $input->getArgument('venta_ids'))];
$venta_ids = $input->getOption('venta_ids');
$body = [];
if (!empty($venta_ids)) {
$body = ['venta_ids' => explode('|', $input->getOption('venta_ids'))];
}
$options = count($body) > 0 ? ['json' => $body] : [];
$response = $this->client->delete($uri, $options);
$output->writeln("Response Code: {$response->getStatusCode()}");