Files
2025-08-02 16:30:27 +02:00

38 lines
1.1 KiB
PHP

<?php
namespace KupShop\OSSVatsBundle\Resources\script;
use KupShop\AdminBundle\Util\Script\Script;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
use KupShop\OSSVatsBundle\Util\VatsCategoriesDownloader;
use KupShop\OSSVatsBundle\Util\VatsUtil;
class OSSVatsScript extends Script
{
protected static $name = 'OSS Vats';
protected static $defaultParameters = [
'loadVatRates' => false,
'refreshVatsCnsRelations' => false,
'refreshVatsCnsRelationsArgument' => null,
'loadVatCategories' => false,
];
protected function run(array $arguments)
{
$vatsUtil = ServiceContainer::getService(VatsUtil::class);
if ($arguments['loadVatRates']) {
$vatsUtil->updateVatRates();
}
if ($arguments['refreshVatsCnsRelations']) {
$vatsUtil->refreshVatsCnsRelations($arguments['refreshVatsCnsRelationsArgument']);
}
if ($arguments['loadVatCategories']) {
$service = ServiceContainer::getService(VatsCategoriesDownloader::class);
$service->getAllOssVatCategories();
}
}
}
return OSSVatsScript::class;