first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

448
class/class.Modules.php Normal file
View File

@@ -0,0 +1,448 @@
<?php
class Modules
{
public const ORDERS = 'orders';
public const SUB_COUNTRY_SELECTION = 'country_selection'; // kvuli shopum, ktery maji upraveny getSupported v CountryContextu kvuli vyberu statu v kosiku
public const SUB_ORDERS_FROM_PURCHASE_STATE = 'orders_from_purchase_state';
public const SUB_CREATE_ORDER_FROM_PURCHASE_STATE = 'create_orders_from_purchase_state';
public const SUB_NOTIFY_NOT_PAID = 'notifyNotPaid';
public const SUB_INVOICE_PDF = 'invoice_pdf';
public const SUB_NOTIFY_WAITING_PACKAGE = 'notifyWaitingPackage';
public const SUB_NOTIFY_LATE_PACKAGE = 'notifyLatePackage';
public const SUB_DIC_VALIDATE = 'dic_validate';
public const SUB_FREE_DELIVERY_ROW = 'addFreeDeliveryRow';
public const SUB_PAYMENT_REDIRECT = 'payment_redirect'; // Po odeslání objednávky ihned (po odeslání analytiky) přesměruje na platební bránu
public const SUB_KEEP_HISTORY = 'keep_history';
public const SUB_INVOICES_FORBIDDEN = 'invoices_forbidden'; // Generování faktur v administraci e-shopu je zakázáno.
public const SUB_STORE_IN_DISABLE = 'store_in_disable'; // Naskladnění řídí primárně ERP, proto zakážeme e-shopu naskladňovat...
public const ORDER_PAYMENT = 'order_payment';
public const ORDER_EDIT = 'order_edit';
public const ORDERS_MASS_PROCESS = 'orders_mass_process';
public const ORDER_RESTRICTIONS = 'order_restrictions'; // Omezení možnosti udělat objednávku - podle IP, emailu, ...
public const ORDER_DISCOUNT = 'order_discount'; // Nové Slevy, je nasazeno všude kromě pouze obsahových webů
public const DELIVERY_TYPES = 'eshop_delivery';
public const SUB_APPLY_DISCOUNT_ON_DELIVERY = 'apply_discount_on_delivery'; // Aplikuje slevu (kupon) i na dopravu
public const SUB_FREE_DELIVERY_NO_DISCOUNT = 'free_delivery_no_discount'; // Počítá cenu pro dopravu zdarma před odečtením slev
public const SUB_FREE_DELIVERY_NO_CHARGES = 'free_delivery_no_charges'; // Pocita cenu pro dopravu zdarma pred prictenim priplatku
/** @deprecated Always present, remove test */
public const DELIVERIES = 'deliveries';
public const PAYMENTS = 'payments';
public const SUB_PAYPAL_CHECKOUT = 'PayPalCheckout';
public const SUB_THEPAY = 'ThePay';
public const SUB_GOPAY = 'GoPay';
public const SUB_WSPAY = 'WsPay';
public const SUB_ADYEN = 'Adyen';
public const SUB_PAYPAL = 'PayPal';
public const SUB_PAYPALPLUS = 'PayPalPlus';
public const SUB_ESSOX_SPLATKY = 'Essox2Splatky';
public const SUB_ESSOX_ROZDELENI = 'Essox2Rozdeleni';
public const SUB_TWISTO_PAY = 'TwistoPay';
public const SUB_TWISTO_PAYIN3 = 'TwistoPayIn3';
public const SUB_CSOB = 'CSOB';
public const PRODUCTS = 'products';
public const SUB_WEIGHT = 'weight';
public const SUB_PRICE_BUY = 'price_buy';
public const SUB_SHOW_MAX = 'showMax';
public const SUB_NOTE = 'note';
public const SUB_SETS = 'sets'; // Multisety
public const SUB_UNITS = 'units';
public const SUB_UNITS_FLOAT = 'units_float';
public const SUB_DESCR_PLUS = 'descr_plus';
public const SUB_PRICE_COMMON = 'price_common';
public const SUB_GENERATE_EAN = 'generate_ean';
public const SUB_DONT_GENERATE_CODE = 'dont_generate_code';
public const SUB_RECYCLING_FEE = 'recycling_fee';
public const SUB_STEP = 'step';
public const SUB_MODERN_PRICES = 'modern_prices';
public const PRODUCTS_CHARGES = 'products_charges';
/** Produktove rezervace */
public const PRODUCT_RESERVATIONS = 'product_reservations';
public const STOCK_IN = 'stock_in';
public const SUB_WEIGHTED_PURCHASE_PRICE = 'weighted_purchase_price'; // Vážené nákupní ceny
public const PRODUCTS_PARAMETERS = 'products_parameters';
public const SUB_CONFIGURATIONS = 'configurations';
public const PRODUCTS_SECTIONS = 'products_sections';
public const SUB_ANNOTATION = 'annotation';
public const SUB_VIRTUAL_TO_DB = 'virtual_to_db';
public const SUB_TOP_PRODUCT = 'top_product';
public const SUB_ELASTICSEARCH = 'elasticsearch';
public const SUB_CUSTOM_URL = 'custom_url';
public const PRODUCTS_VARIATIONS = 'products_variations';
public const SUB_CODE = 'variationCode';
public const CONVERTORS = 'convertors'; // Převodníky
public const PHOTOS = 'photos';
public const ATTACHMENTS = 'attachments';
public const SUB_ATTACHMENTS_TYPES = 'attachments_types';
public const SUB_MANUALS = 'manuals';
public const PRODUCTS_COLLECTIONS = 'products_collections';
public const SUB_DENIED_MULTIPLE = 'denied_multiple';
public const PRODUCTS_VARIATIONS_PHOTOS = 'products_variations_photos';
public const ORDERS_OF_SUPPLIERS = 'orders_of_suppliers';
public const PRODUCTS_SERIAL_NUMBERS = 'products_serial_numbers';
public const PRODUCTS_BATCHES = 'products_batches';
/** Skladem u dodavatele - stav produktu, počítá in_store i z dodavatelů */
public const PRODUCTS_SUPPLIERS = 'products_suppliers';
public const SUB_ALLOW_NEGATIVE_IN_STORE = 'allow_negative_in_store'; // pokud je products.in_store negativni, tak jej v runtime scita s products_of_suppliers.in_store
public const SUB_DELIVERY_TIME = 'delivery_time';
/** Dodavatelé produktů - jen uložení který dodavatel má který produkt */
public const SUPPLIERS = 'suppliers';
public const SUB_SUPPLIERS_ALLOW_DUPLICATE_CODE = 'allow_duplicate_code';
public const PRODUCTS_RELATED = 'products_related';
public const SUB_TYPES = 'types';
public const DYNAMIC_RELATED_PRODUCTS = 'dynamic_related_products';
public const MISSING_PRODUCTS = 'missing_products';
public const PRODUCTS_FAVORITES = 'products_favorites';
public const SUB_PRODUCTS_FAVORITES_NOT_LOGGED = 'not_logged';
public const SHOPPING_LIST = 'products_shopping_list';
public const PRODUCT_SETS = 'products_sets';
public const SUB_PRODUCT_SETS_CALCULATE_PRICE = 'calculate_price';
public const PRODUCT_GIFTS = 'products_gifts';
/** @deprecated use setting */
public const SUB_SPLIT_PRICE_VAT = 'split_price_vat';
public const SUB_SHOW_OUT_OF_STOCK = 'showOutOfStock';
public const SUB_CALCULATE_STOCK = 'calculate_stock';
public const WAREHOUSE = 'warehouse';
public const PRODUCERS = 'producers';
public const DYNAMIC_FILTER = 'dynamic_filter';
public const ARTICLES = 'articles';
public const ARTICLES_RELATED_TYPES = 'articles_related_types';
public const ARTICLES_AUTHORS = 'articles_authors';
public const ARTICLES_SECTIONS = 'articles_sections';
public const RESTRICTIONS = 'restrictions'; // Omezení viditelnosti produktů pro určitý uživatele, skupiny, země, ...
public const XML_FEEDS = 'feeds';
public const SUB_SECURE = 'secure';
public const SUB_DISABLE_ZERO_PRICE_FILTER = 'disable_zero_price_filter';
public const B2B = 'b2b';
public const SUB_OLD = 'old'; // Pro staré b2b, aby se v rámci b2b nezapnul SUB_MODERN_PRICES, protoze bysme mohli rozbit stary shopy
public const XML_FEEDS_B2B = 'xml_feeds_b2b';
public const SUB_FEED_IDS = 'feed_ids'; // value can be an array containing feed IDs enabled for all B2B users or TRUE (no hardcoded globally enabled feeds)
public const FEED_GENERATOR = 'feed_generator';
public const EET = 'eet';
// SK eet
public const SKEET = 'skeet';
/** @deprecated Always present, remove test */
public const SYMFONY = 'symfony';
/** @deprecated Never present, remove test */
public const COMPOSER = 'composer';
public const TRANSLATIONS = 'translations';
/** @var string Templates-only translations */
public const TEMPLATE_TRANSLATIONS = 'template_translations';
public const POS = 'pos';
public const NEW_POS = 'new_pos';
public const SUB_TERMINAL = 'payment_terminal';
public const PRICE_LEVELS = 'price_levels';
public const CURRENCIES = 'currencies';
public const REVIEWS = 'reviews';
public const API = 'api';
public const SELLERS = 'sellers';
public const SUB_MY_SELLER = 'my_seller';
public const SUB_SMARTY_SELLERS = 'smarty_sellers';
/** @deprecated use engine SELLERS */
public const SELLERS_OLD = 'sellers_old';
/** @deprecated Always present, remove test */
public const FULLTEXT_SEARCH = 'fulltext_search';
public const MARGINS = 'margins';
public const TELFA = 'telfa';
public const BALIKONOS = 'balikonos';
public const PAGES = 'html_pages';
public const SUB_LABELS = 'labels';
public const LABELS = 'labels';
public const SUB_PRODUCT_LABELS = 'product_labels';
public const PRICELISTS = 'pricelists';
public const SUB_ACTIVATION_TOKEN = 'activation_token';
public const DELIVERY_PRICELIST = 'delivery_pricelist';
public const TEMPLATES = 'templates';
public const SLIDERS = 'sliders';
public const SUB_SLIDERS_ADDITIONAL_SECTION_SLIDER = 'additional_section_slider';
public const INDEXED_FILTER = 'indexed_filter';
public const QUANTITY_DISCOUNT = 'quantity_discount';
public const BONUS_PROGRAM = 'bonus_program';
public const SUB_POINTS_EXCHANGE = 'points_exchange';
public const WATCHDOG = 'watchdog';
public const SUB_WATCHDOG_SUPPLIERS = 'suppliers';
public const USERS = 'eshop_users';
public const SUB_USERS_PHONE_LOGIN = 'phone_login'; // přihlášení pomocí tel. čísel, pozor, čísla v uživatelských účtech musí být unikátní
public const SEARCH = 'eshop_search';
public const SUB_FILTER = 'filter';
public const MENU = 'menulinks';
public const LINKS = 'links'; // Odkazy u produktu
public const USER_OAUTH = 'user_oauth';
public const SUB_APPLE_LOGIN = 'apple_login';
public const SUB_SEZNAM_LOGIN = 'seznam_login';
public const SUB_AMAZON_LOGIN = 'amazon_login';
public const DB_REWRITE = 'db_rewrite';
public const CESKA_POSTA = 'ceskaposta';
public const MAILERLITE = 'mailerlite';
public const STORES = 'stores';
public const SUB_ON_THE_FLY_STORE = 'on_the_fly_store'; // Mezisklad pro převodky - odeslání přesune na mezisklad a ne na cílový sklad
public const SUB_DISABLE_MOVEMENTS = 'disable_movements';
/** @deprecated Kvůli statrým feedům, v konfigurovatelných podle modulu */
public const FEED_GIFTS = 'feed_gifts';
public const REPLACEMENT = 'replacement';
public const RETURNS = 'returns';
public const SUB_CP_AUTH_CODES = 'cp_auth_codes'; // return delivery CP (Česká pošta) (Služba Odvoz zboží)
public const RETURNS_ELNINO = 'returns_elnino';
public const RECLAMATIONS = 'reclamations';
public const RECLAMATIONS_ELNINO = 'reclamations_elnino';
public const WEBPACK = 'webpack';
public const HEUREKA_CART = 'heureka_cart';
public const LOCALE_PREFIX = 'locale_prefix';
public const GLOBAL_DISCOUNTS = 'global_discounts';
public const BANK_AUTO_PAYMENTS = 'bank_auto_payments';
public const SUB_FIO_BANK = 'fio_bank';
public const SUB_EVERIFIN = 'everifin';
public const METRICS = 'metrics';
public const SUB_REQUESTS_HISTOGRAM = 'requests_histogram';
public const FILTER_CACHE = 'filter_cache'; // Cache v sekcích na filtrační parametry a jejich hodnoty
public const RESPONSE_CACHE = 'response_cache';
public const PROXY_CACHE = 'proxy_cache'; // BunnyCache, nebo taky FullPageCache - cache HTML stránek na CDN
public const POHODA = 'pohoda';
public const SUB_USERS = 'users';
public const SUB_USERS_SEND_REG_EMAIL = 'users_send_reg_email';
public const SUB_STORES = 'stores';
public const SUB_PHOTOS = 'photos';
public const SUB_ORDERS_IMPORT = 'orders_import';
public const SUB_INVOICE = 'invoices';
public const SUB_ISSUES = 'issues';
public const SUB_CORRECTIVE_INVOICE = 'corrective_invoices';
public const SUB_POS_INVOICE = 'pos_invoices';
public const SUB_LOCK_SYNC = 'lock_sync';
public const SUB_GENERATE_INVOICES = 'generate_invoices';
public const SUB_DELETE_STORNO_ORDER = 'delete_storno_order';
public const SUB_HANDLE_STORNO_CORRECTIVE_TAX_DOCUMENT = 'handle_storno_order_corrective_tax_document';
public const SUB_ORDER_REUPLOAD = 'order_reupload';
public const SUB_SYNC_CATEGORY = 'sync_category';
public const SUB_INSTANT_ORDER_UPLOAD = 'instant_order_upload';
public const SUB_INSTANT_USER_UPLOAD = 'instant_user_upload';
public const SUB_CREATE_CORRECTIVE_INVOICE_FROM_RETURNS = 'create_corrective_invoice_from_returns';
public const SUB_REUPLOAD_RETURN_ORDER = 'reupload_return_order';
public const SUB_PRODUCTS_EXPORTER = 'create_pohoda_product';
public const SUB_MULTIPLE_SERVERS = 'multiple_servers';
public const SUB_SYNC_COUPONS = 'sync_coupons';
public const SUB_GENERATE_INVOICES_FOR_COUPONS_ORDERS = 'generate_invoices_for_coupons_orders';
public const SUB_PRICE_HISTORY_ERP = 'erp_generates_price_history';
public const PRICE_HISTORY = 'price_history';
public const SUB_DONT_CALCULATE_PRICE_FOR_DISCOUNT = 'dont_calculate_price_for_discount'; // Např. to řídí primárně ERP, CPS se importuje apod.
public const PARAMETER_GROUPS = 'parameter_groups';
/** Kontrola cen produktů */
public const PRODUCT_PRICES = 'products_prices';
/** Inventura */
public const INVENTORY = 'inventory';
/** Porovnani produktu */
public const PRODUCTS_COMPARE = 'products_compare';
public const COMMENTS = 'comments';
public const SUB_COMMENTS_ANONYMOUS = 'anonymous_comments';
public const INCOMAKER = 'incomaker';
public const ECOMAIL = 'ecomail';
/** @deprecated Starý autopilot -> automation_configurator */
public const AUTOPILOT = 'autopilot';
public const USER_MANAGER = 'user_manager';
public const USERS_GROUPS_TYPES = 'users_groups_types';
public const DROPSHIP = 'dropship';
public const DAKTELA = 'daktela';
public const SAVE_FORMS = 'save_forms';
/** @var GraphQL API */
public const GRAPHQL = 'graphql';
public const SUB_GRAPHQL_ADMIN = 'admin_api';
public const OSS_VATS = 'oss_vats';
public const VIDEOS = 'videos';
public const CDN = 'cdn';
public const SYSTEM_INSPECTION = 'system_inspection';
public const INVOICES = 'invoices'; // Generování čísel faktur, fakturační řady
public const CHECK_APP = 'check_app'; // check-app - vstupní a výstupní kontrola
public const SUB_ZEBRA_TEMPLATE_TYPE = 'zebra_template_type';
public const AUTOMATION_CONFIGURATOR = 'automation_configurator';
public const INVENTORO = 'inventoro';
public const SYNCHRONIZATION = 'synchronization';
public const RESERVATIONS = 'reservations';
public const RECLAMATIONS_SUPPLIERS = 'reclamations_suppliers';
public const JS_SHOP = 'js_shop';
public const SUB_JS_SHOP_PRODUCTS_COMPARE = 'products_compare';
public const JS_MENU = 'js_menu';
public const JS_MULTISETS = 'js_multisets';
public const RECAPTCHA = 'recaptcha';
public const SUB_CLOUDFLARE = 'cloudflare';
public const SUB_GCLOUD = 'gcloud';
public const AUTOMATIC_IMPORT = 'automatic_import';
public const B2B_PREORDERS = 'b2b_preorders';
public const AGE_VERIFY = 'age_verify';
public const LUIGIS_BOX = 'luigis_box';
public const TWO_FACTOR = 'two_factor';
public const SALES = 'sales';
public const COMPONENTS = 'components';
public const SUB_STORYBOOK = 'storybook';
public const RECOMMENDERS = 'recommenders';
public const COWORKERS = 'coworkers';
public const KAFKA = 'kafka';
public const LLM = 'llm';
public const GTM = 'gtm';
public const SUB_CONTAINER_CONFIG = 'container_config';
public const USER_ADDRESSES = 'user_addresses';
public const TRUSTPILOT = 'trustpilot';
public const SALESMAN = 'salesman';
public static function getStructure()
{
static $modulesHierarchy;
if (isset($modulesHierarchy)) {
return $modulesHierarchy;
}
$reflectionClass = new ReflectionClass(static::class);
$tmp = [];
$lastModule = null;
foreach ($reflectionClass->getConstants() as $constantName => $constantValue) {
if (!empty($lastModule) && mb_substr($constantName, 0, 4) === 'SUB_') {
$tmp[$lastModule]['submodules'][mb_substr($constantName, 4)] = ['value' => $constantValue];
} else {
$tmp[$constantName] = ['value' => $constantValue];
$lastModule = $constantName;
}
}
$modulesHierarchy = $tmp;
return $tmp;
}
public static function check(string $moduleConst, ?string $submoduleName): bool
{
$modules = static::getStructure();
$module = $modules[$moduleConst]['value'] ?? null;
$submodule = $modules[$moduleConst]['submodules'][$submoduleName]['value'] ?? null;
if (!isset($module)) {
throw new InvalidArgumentException("Module constant '{$moduleConst}' is not defined in \Modules!");
}
if (!isset($submodule) && isset($submoduleName)) {
throw new InvalidArgumentException("Submodule '{$submoduleName}' is not defined in \Modules or it is not defined properly after module '{$moduleConst}'!");
}
return (bool) findModule($module, $submodule);
}
}