// Kill-switch for the two promotion models whose queries currently fail with a // SERVER-side SQL bug in the iDempiere dictionary ("SELECT FROM null") — every // call errors regardless of what the client sends. Until the dictionary is // fixed, requests to these models are short-circuited here (default OFF). // Re-enable with PROMOTION_MODELS_ENABLED=true in the environment. const PROMOTION_MODELS = new Set(['m_promotiondistribution', 'm_promotiongroupline']) export const PROMOTION_MODELS_DISABLED_MESSAGE = 'Promotion distributions/group lines are temporarily disabled (iDempiere dictionary bug) — set PROMOTION_MODELS_ENABLED=true once the backend is fixed' export function promotionModelsEnabled(): boolean { return String(process.env.PROMOTION_MODELS_ENABLED ?? '').toLowerCase() === 'true' } // True when `model` is one of the broken promotion models AND the flag is off. export function isDisabledPromotionModel(model?: string | null): boolean { return !promotionModelsEnabled() && PROMOTION_MODELS.has(String(model ?? '').toLowerCase()) }