|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / Geissweb / Euvat / Model / System / |
Filename | /home/dev2.destoffenstraat.com/app/code/Geissweb/Euvat/Model/System/TechReport.php |
Size | 9.04 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 09-Jul-2024 08:41 |
Last accessed | 22-Aug-2025 19:50 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* ||GEISSWEB| EU VAT Enhanced
*
* NOTICE OF LICENSE
*
* This source file is subject to the GEISSWEB End User License Agreement
* that is available through the world-wide-web at this URL: https://www.geissweb.de/legal-information/eula
*
* DISCLAIMER
*
* Do not edit this file if you wish to update the extension in the future. If you wish to customize the extension
* for your needs please refer to our support for more information.
*
* @copyright Copyright (c) 2015 GEISS Weblösungen (https://www.geissweb.de)
* @license https://www.geissweb.de/legal-information/eula GEISSWEB End User License Agreement
*/
declare(strict_types=1);
namespace Geissweb\Euvat\Model\System;
use Magento\Customer\Model\ResourceModel\Group\Collection as CustomerGroupCollection;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Tax\Model\ResourceModel\TaxClass\Collection as TaxClassCollection;
use Magento\Tax\Model\ResourceModel\Calculation\Rule\Collection as TaxRuleCollection;
use Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection as TaxRateCollection;
use Geissweb\Euvat\Helper\Configuration;
use Magento\Store\Api\WebsiteRepositoryInterface;
use Magento\Store\Api\StoreRepositoryInterface;
/**
* Generates relevant support information
*/
class TechReport
{
private CustomerGroupCollection $groupCollection;
private TaxClassCollection $taxClassCollection;
private TaxRuleCollection $taxRuleCollection;
private TaxRateCollection $taxRateCollection;
private Configuration $config;
private WebsiteRepositoryInterface $websiteRepository;
private StoreRepositoryInterface $storeRepository;
private ScopeConfigInterface $scopeConfig;
private ?array $websiteList = null;
private ?array $storesList = null;
/**
* @param \Magento\Customer\Model\ResourceModel\Group\Collection $groupCollection
* @param \Magento\Tax\Model\ResourceModel\TaxClass\Collection $taxClassCollection
* @param \Magento\Tax\Model\ResourceModel\Calculation\Rule\Collection $taxRuleCollection
* @param \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection $taxRateCollection
* @param \Geissweb\Euvat\Helper\Configuration $config
* @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository
* @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
CustomerGroupCollection $groupCollection,
TaxClassCollection $taxClassCollection,
TaxRuleCollection $taxRuleCollection,
TaxRateCollection $taxRateCollection,
Configuration $config,
WebsiteRepositoryInterface $websiteRepository,
StoreRepositoryInterface $storeRepository,
ScopeConfigInterface $scopeConfig
) {
$this->groupCollection = $groupCollection;
$this->taxClassCollection = $taxClassCollection;
$this->taxRuleCollection = $taxRuleCollection;
$this->taxRateCollection = $taxRateCollection;
$this->config = $config;
$this->websiteRepository = $websiteRepository;
$this->storeRepository = $storeRepository;
$this->scopeConfig = $scopeConfig;
}
/**
* Gets all customer groups
*
* @return array|mixed
*/
public function getCustomerGroups()
{
$collection = $this->groupCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets all tax classes
*
* @return array|mixed
*/
public function getTaxClasses()
{
$collection = $this->taxClassCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets all tax rules
*
* @return array|mixed
*/
public function getTaxRules()
{
$collection = $this->taxRuleCollection->toArray();
if (isset($collection['items'])) {
foreach ($collection['items'] as $idx => $item) {
if (isset($collection['items'][$idx]['tax_rates'])) {
unset($collection['items'][$idx]['tax_rates']);
}
}
}
return $collection['items'] ?? [];
}
/**
* Gets all tax rates
*
* @return array|mixed
*/
public function getTaxRates()
{
$collection = $this->taxRateCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets system info
*
* @return array
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function getSystemInfo()
{
return $this->config->getSystemInformation();
}
/**
* Get stores info
*
* @return array
*/
public function getStoresInformation()
{
if ($this->websiteList === null) {
$this->websiteList = $this->websiteRepository->getList();
}
if ($this->storesList === null) {
$this->storesList = $this->storeRepository->getList();
}
$info = [];
foreach ($this->websiteList as $website) {
$info['websites'][$website->getId()] = [
'id' => $website->getId(),
'code' => $website->getCode(),
'name' => $website->getName(),
'default_group_id' => $website->getDefaultGroupId()
];
}
foreach ($this->storesList as $store) {
$info['stores'][$store->getId()] = [
'id' => $store->getId(),
'code' => $store->getCode(),
'name' => $store->getName(),
'website_id' => $store->getWebsiteId(),
'store_group_id' => $store->getStoreGroupId()
];
}
ksort($info['websites']);
ksort($info['stores']);
return $info;
}
/**
* Get configuration
*
* @return array
*/
public function getConfiguration()
{
$websiteList = $this->websiteList === null ? $this->websiteRepository->getList() : $this->websiteList;
$storeList = $this->storesList === null ? $this->storeRepository->getList() : $this->storesList;
$allConfig = [];
$mainConfigs = ['tax', 'euvat'];
foreach ($mainConfigs as $configSection) {
$sectionConfig = $this->scopeConfig->getValue($configSection);
foreach ($sectionConfig as $section => $pathValues) {
foreach ($pathValues as $path => $value) {
foreach ($websiteList as $website) {
$scopedConfigValue = $this->scopeConfig->getValue(
$configSection.'/'.$section.'/'.$path,
'websites',
$website
);
if ($value !== $scopedConfigValue) {
$sectionConfig[$section][$path.'_scoped']
['website_'.$website->getCode()] = $scopedConfigValue;
}
}
foreach ($storeList as $store) {
$scopedConfigValue = $this->scopeConfig->getValue(
$configSection.'/'.$section.'/'.$path,
'stores',
$store
);
if ($value !== $scopedConfigValue) {
$sectionConfig[$section][$path.'_scoped']['store_'.$store->getCode()] = $scopedConfigValue;
}
}
}
}
$allConfig[$configSection] = $sectionConfig;
}
$specificConfigs = [
'general/country/eu_countries',
'customer/create_account/auto_group_assign',
'customer/create_account/default_group',
'customer/create_account/tax_calculation_address_type',
'customer/create_account/viv_disable_auto_group_assign_default',
'customer/create_account/vat_frontend_visibility',
'customer/address/taxvat_show',
'shipping/origin/country_id'
];
foreach ($specificConfigs as $fullConfigPath) {
$value = $this->scopeConfig->getValue($fullConfigPath);
$prettyConfigPath = str_replace('/', '_', $fullConfigPath);
$allConfig['other'][$prettyConfigPath] = $value;
foreach ($websiteList as $website) {
$scopedConfigValue = $this->scopeConfig->getValue($fullConfigPath, 'websites', $website);
if ($value !== $scopedConfigValue) {
$allConfig['other'][$prettyConfigPath.'_scoped']
['website_'.$website->getCode()] = $scopedConfigValue;
}
}
foreach ($storeList as $store) {
$scopedConfigValue = $this->scopeConfig->getValue($fullConfigPath, 'stores', $store);
if ($value !== $scopedConfigValue) {
$allConfig['other'][$prettyConfigPath.'_scoped']['store_'.$store->getCode()] = $scopedConfigValue;
}
}
}
return $allConfig;
}
}
/**
* ||GEISSWEB| EU VAT Enhanced
*
* NOTICE OF LICENSE
*
* This source file is subject to the GEISSWEB End User License Agreement
* that is available through the world-wide-web at this URL: https://www.geissweb.de/legal-information/eula
*
* DISCLAIMER
*
* Do not edit this file if you wish to update the extension in the future. If you wish to customize the extension
* for your needs please refer to our support for more information.
*
* @copyright Copyright (c) 2015 GEISS Weblösungen (https://www.geissweb.de)
* @license https://www.geissweb.de/legal-information/eula GEISSWEB End User License Agreement
*/
declare(strict_types=1);
namespace Geissweb\Euvat\Model\System;
use Magento\Customer\Model\ResourceModel\Group\Collection as CustomerGroupCollection;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Tax\Model\ResourceModel\TaxClass\Collection as TaxClassCollection;
use Magento\Tax\Model\ResourceModel\Calculation\Rule\Collection as TaxRuleCollection;
use Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection as TaxRateCollection;
use Geissweb\Euvat\Helper\Configuration;
use Magento\Store\Api\WebsiteRepositoryInterface;
use Magento\Store\Api\StoreRepositoryInterface;
/**
* Generates relevant support information
*/
class TechReport
{
private CustomerGroupCollection $groupCollection;
private TaxClassCollection $taxClassCollection;
private TaxRuleCollection $taxRuleCollection;
private TaxRateCollection $taxRateCollection;
private Configuration $config;
private WebsiteRepositoryInterface $websiteRepository;
private StoreRepositoryInterface $storeRepository;
private ScopeConfigInterface $scopeConfig;
private ?array $websiteList = null;
private ?array $storesList = null;
/**
* @param \Magento\Customer\Model\ResourceModel\Group\Collection $groupCollection
* @param \Magento\Tax\Model\ResourceModel\TaxClass\Collection $taxClassCollection
* @param \Magento\Tax\Model\ResourceModel\Calculation\Rule\Collection $taxRuleCollection
* @param \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection $taxRateCollection
* @param \Geissweb\Euvat\Helper\Configuration $config
* @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository
* @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
CustomerGroupCollection $groupCollection,
TaxClassCollection $taxClassCollection,
TaxRuleCollection $taxRuleCollection,
TaxRateCollection $taxRateCollection,
Configuration $config,
WebsiteRepositoryInterface $websiteRepository,
StoreRepositoryInterface $storeRepository,
ScopeConfigInterface $scopeConfig
) {
$this->groupCollection = $groupCollection;
$this->taxClassCollection = $taxClassCollection;
$this->taxRuleCollection = $taxRuleCollection;
$this->taxRateCollection = $taxRateCollection;
$this->config = $config;
$this->websiteRepository = $websiteRepository;
$this->storeRepository = $storeRepository;
$this->scopeConfig = $scopeConfig;
}
/**
* Gets all customer groups
*
* @return array|mixed
*/
public function getCustomerGroups()
{
$collection = $this->groupCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets all tax classes
*
* @return array|mixed
*/
public function getTaxClasses()
{
$collection = $this->taxClassCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets all tax rules
*
* @return array|mixed
*/
public function getTaxRules()
{
$collection = $this->taxRuleCollection->toArray();
if (isset($collection['items'])) {
foreach ($collection['items'] as $idx => $item) {
if (isset($collection['items'][$idx]['tax_rates'])) {
unset($collection['items'][$idx]['tax_rates']);
}
}
}
return $collection['items'] ?? [];
}
/**
* Gets all tax rates
*
* @return array|mixed
*/
public function getTaxRates()
{
$collection = $this->taxRateCollection->toArray();
return $collection['items'] ?? [];
}
/**
* Gets system info
*
* @return array
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function getSystemInfo()
{
return $this->config->getSystemInformation();
}
/**
* Get stores info
*
* @return array
*/
public function getStoresInformation()
{
if ($this->websiteList === null) {
$this->websiteList = $this->websiteRepository->getList();
}
if ($this->storesList === null) {
$this->storesList = $this->storeRepository->getList();
}
$info = [];
foreach ($this->websiteList as $website) {
$info['websites'][$website->getId()] = [
'id' => $website->getId(),
'code' => $website->getCode(),
'name' => $website->getName(),
'default_group_id' => $website->getDefaultGroupId()
];
}
foreach ($this->storesList as $store) {
$info['stores'][$store->getId()] = [
'id' => $store->getId(),
'code' => $store->getCode(),
'name' => $store->getName(),
'website_id' => $store->getWebsiteId(),
'store_group_id' => $store->getStoreGroupId()
];
}
ksort($info['websites']);
ksort($info['stores']);
return $info;
}
/**
* Get configuration
*
* @return array
*/
public function getConfiguration()
{
$websiteList = $this->websiteList === null ? $this->websiteRepository->getList() : $this->websiteList;
$storeList = $this->storesList === null ? $this->storeRepository->getList() : $this->storesList;
$allConfig = [];
$mainConfigs = ['tax', 'euvat'];
foreach ($mainConfigs as $configSection) {
$sectionConfig = $this->scopeConfig->getValue($configSection);
foreach ($sectionConfig as $section => $pathValues) {
foreach ($pathValues as $path => $value) {
foreach ($websiteList as $website) {
$scopedConfigValue = $this->scopeConfig->getValue(
$configSection.'/'.$section.'/'.$path,
'websites',
$website
);
if ($value !== $scopedConfigValue) {
$sectionConfig[$section][$path.'_scoped']
['website_'.$website->getCode()] = $scopedConfigValue;
}
}
foreach ($storeList as $store) {
$scopedConfigValue = $this->scopeConfig->getValue(
$configSection.'/'.$section.'/'.$path,
'stores',
$store
);
if ($value !== $scopedConfigValue) {
$sectionConfig[$section][$path.'_scoped']['store_'.$store->getCode()] = $scopedConfigValue;
}
}
}
}
$allConfig[$configSection] = $sectionConfig;
}
$specificConfigs = [
'general/country/eu_countries',
'customer/create_account/auto_group_assign',
'customer/create_account/default_group',
'customer/create_account/tax_calculation_address_type',
'customer/create_account/viv_disable_auto_group_assign_default',
'customer/create_account/vat_frontend_visibility',
'customer/address/taxvat_show',
'shipping/origin/country_id'
];
foreach ($specificConfigs as $fullConfigPath) {
$value = $this->scopeConfig->getValue($fullConfigPath);
$prettyConfigPath = str_replace('/', '_', $fullConfigPath);
$allConfig['other'][$prettyConfigPath] = $value;
foreach ($websiteList as $website) {
$scopedConfigValue = $this->scopeConfig->getValue($fullConfigPath, 'websites', $website);
if ($value !== $scopedConfigValue) {
$allConfig['other'][$prettyConfigPath.'_scoped']
['website_'.$website->getCode()] = $scopedConfigValue;
}
}
foreach ($storeList as $store) {
$scopedConfigValue = $this->scopeConfig->getValue($fullConfigPath, 'stores', $store);
if ($value !== $scopedConfigValue) {
$allConfig['other'][$prettyConfigPath.'_scoped']['store_'.$store->getCode()] = $scopedConfigValue;
}
}
}
return $allConfig;
}
}