'use strict'; // ########### // ENVIRONMENT // ########### const environmentList = ["ENV_DEVELOPMENT", "ENV_RECETTE_LOCAL", "ENV_RECETTE", "ENV_PRODUCTION"]; const environment = "ENV_PRODUCTION"; // DEPRECATED, use `environment` constant and these PHP/JS functions: `isCurrentEnv`, `isCurrentEnvOrBefore`, `isCurrentEnvOrAfter` let prodMode = `1` == 1 ? true : false; // DEPRECATED, use `environment` constant and these PHP/JS functions: `isCurrentEnv`, `isCurrentEnvOrBefore`, `isCurrentEnvOrAfter` let recetMode = `` == 1 ? true : false; // ############### // INSTANCE CONFIG // ############### var globalLanguage = "en"; var globalDefaultAdditionalTaxRate = "0"; var userInstance = ""; var userZone = "Array"; var userCompany = ""; var userSite = ""; var userCompanies = `[]`; var entityCode = "CFAO"; var g_userWorkshopList = JSON.parse(`[]`); // ############ // OTHER CONFIG // ############ // For 'global_dev.js' var isUserSyartec = "" ? true : false; var isGoogle = "" == 1 ? true : false; var isOutlook = "" == 1 ? true : false; var googleMapAPIKey = "AIzaSyACDICnN6zzez0McNVZKrBDUb4sZJ81eIs"; let saveContactMandatoryComm = "0"; let settinglimitVersionBooklet = '16'; let maxModerationStatus = '1'; let settingDocumentGlobalDiscount = ''; let settingManageGlobalComplementList = ''; let settingCheckTradeInByItem = '1'; let settingHideBookingColumnForPR = ''; let defaultPdfButtonForSeeCgt = `[{"document_type":"PR","product_category":"VN","show":true, "disable_check" : false, "default": "1"},{"document_type":"PR","product_category":"VO","show":true, "disable_check" : false, "default": "1"},{"document_type":"BC","product_category":"VN","show":true, "disable_check" : true, "default": "1"},{"document_type":"BC","product_category":"VO","show":true, "disable_check":true, "default": "1"}]`; let displayPdfHeaderFooterOnPDF = `[{"document_type":"PR","product_category":"VN", "show_input": "0", "disabled_input": "0", "default": "1"},{"document_type":"BC","product_category":"VN", "show_input": "0", "disabled_input": "0", "default": "1"},{"document_type":"PP","product_category":"", "show_input": "0", "disabled_input": "0", "default": "1"},{"document_type":"PR","product_category":"VO", "show_input": "0", "disabled_input": "0", "default": "1"},{"document_type":"BC","product_category":"VO", "show_input": "0", "disabled_input": "0", "default": "1"},{"document_type":"PP","product_category":"", "show_input": "0", "disabled_input": "0", "default": "1"}]`; let lockedPdfPrintNumberConfig = `[{"document_type":"PR","product_category":"VO","printNumber":1},{"document_type":"BC","product_category":"VN","printNumber":2},{"document_type":"BC","product_category":"VO","printNumber":1}]`; let thousandsSeparator = ` `; let decimalSeparator = `,`; let dmsAnnataConnexion = `0` == 1 ? true : false; //Defaut fallback parameters for PDF generation let defaultPdfNumberPage = `[{"document_type":"PR","product_category":"VN", "number_page" : 1},{"document_type":"PR","product_category":"VO","number_page":1},{"document_type":"BC","product_category":"VN","number_page":2},{"document_type":"BC","product_category":"VO","number_page":2}]`; let defaultPdfTaxes = `[{"document_type":"PR","product_category":"VN", "show" : true},{"document_type":"PR","product_category":"VO","show" : true},{"document_type":"BC","product_category":"VN","show" : true},{"document_type":"BC","product_category":"VO","show" : true}]`; let defaultPdfCgt = `[{"document_type":"PR","product_category":"VN", "show" : false},{"document_type":"PR","product_category":"VO","show" : false},{"document_type":"BC","product_category":"VN","show" : true},{"document_type":"BC","product_category":"VO","show" : true}]`; let defaultPdfHeaderFooter = `[{"document_type":"PR","product_category":"VN", "show" : true},{"document_type":"PR","product_category":"VO","show" : true},{"document_type":"BC","product_category":"VN","show" : true},{"document_type":"BC","product_category":"VO","show" : true}]`; let defaultPdfSignature = `[{"document_type":"PR","product_category":"VN", "show" : true},{"document_type":"PR","product_category":"VO","show" : true},{"document_type":"BC","product_category":"VN","show" : true},{"document_type":"BC","product_category":"VO","show" : true}]`; let defaultPdfVin = `[{"document_type":"PR","product_category":"VN", "show" : false},{"document_type":"PR","product_category":"VO","show" : true},{"document_type":"BC","product_category":"VN","show" : true},{"document_type":"BC","product_category":"VO","show" : true}]`; let defaultPdfDiscount = `[{"document_type":"PR","product_category":"VN","show":true},{"document_type":"PR","product_category":"VO","show":true},{"document_type":"BC","product_category":"VN","show":true},{"document_type":"BC","product_category":"VO","show":true}]`; let displayDiscount = `[{"document_type":"PR","product_category":"VN", "show_input": "1", "disabled_input": "0", "default": "1"},{"document_type":"BC","product_category":"VN", "show_input": "1", "disabled_input": "0", "default": "1"},{"document_type":"PP","product_category":"", "show_input": "0", "disabled_input": "1", "default": "1"}]`; let showTaxesDiscountVO = ``; let isObsoleteAllowedForSales = `1`; let showTransformModal = ``; let convertBCInBaseCurrency = ``; let convertPriceForPricing = ``; let allowNegativePrice = `1`; let backgroundExecInvoice = `0`; let defaultCurrency = `EUR`; let pricingCurrency = `EUR`; let allowMultipleVat = ``; let complementCarLicenseCode = `N/A`; let complementBonusMalusCode = `N/A`; let settingMaxFileUploadSize = `102400`; let distanceUnit = `km`; let settingDocumentAddRegularisationForDMS = ``; let GDPRIsEnabled = ``; let contactFieldValueAuthorisationIsUnique = `1`; let settingFreePriceAllowedForSale = ``; let isFinancialPlanAllowedWithBooking = ``; let isMarketingCentralized = ``; let preparationUserAvailableIsMandatory = ``; let autoCheckAllRequiredAttachmentTypes = ``; let settingopenDeliveryOrderOnNotFacVin = `1`; let instancePathExternal = `https://cfao.iziflo.com/`; let isSimpleSummarySheetActivated = ``; // trade in config values let tradeInValueBankRate = 6; let tradeInValueMinFirstRent = 0; let tradeInValueMaxFirstRent = 30; let tradeInValueFirstRentCursorStep = 100; let tradeInValueMinMileage = 10000; let tradeInValueMaxMileage = 150000; let tradeInValueMileageCursorStep = 5000; let tradeInValueContractLength = [12, 18, 24, 36, 48, 60]; let eSignActivated = ``; let tabletSignatureActivated = ``; let tabletSignatureSteps = JSON.parse(`{ "termsOfSaleConfirmation": false, "signature": false, "paraph": false }`); let useDeliveryServices = `1`; let useDeliverySignature = ``; let displayVinCommentsOnSale = ``; let sendMailOnRecovery = ``; let wspSynchronizeWithDms = ``; let izifloNoDms = ``; let wspCustomerCreditLimitMode = ``; let wspWorkOrderCreationDefaultMode = `CREATE`; let countryPhoneCode = ``; //Wacom url driver let WacomSigCaptX = ``; const MAX_SELECTION_ADVANCED_TABLE = 200; const TABLET_SIGNATURE_DRIVER_VERSION = `1.25.4.59`; // ############ // WORKSHOP CONFIG // ############ const autoSplitInterventionConstraint = `intervention__workshop_is_closed,intervention__resource_is_missing`; //Global var let g_idUser = ``; const g_subordinateIds = [0]; /** numberRoundedForCurrency * * Function converting a number for display : * Round it with correct precision * Add thousand separator if necessary * Add currency code at the end of the string if requested * */ const FORMAT_FOR_DISPLAY = 0; const FORMAT_FOR_INPUT = 1; const FORMAT_WITH_CURRENCY = 2; var g_currencyData = []; function numberRoundedForCurrency(number, currency, formatMode = 0, forcedDecimals = null) { // Fetch currency info from stTables (optimized) let currencyData; let decimals; // if currency not null, get datas of this currency if (currency != null) { if ( g_currencyData[currency] == undefined ) { let stSelectColumns = ["decimal_number", "label", "symbol"]; let stTableName = "currency"; let stConditions = { column : "code", operator : "LIKE", value : currency }; currencyData = stContentProvider(stSelectColumns,stTableName, stConditions); g_currencyData[currency] = currencyData; } else { currencyData = g_currencyData[currency]; } } // if forced decimal is null and currency data are init, use the decimal number of the currency if ( forcedDecimals == null && !!currencyData && currencyData.length > 0) { decimals = currencyData[0]["decimal_number"]; } else { decimals = forcedDecimals; } let returnValue; // format for input if ( formatMode == FORMAT_FOR_INPUT ) { returnValue = number_format(number, decimals, ".", ""); } // format for display else { returnValue = number_format(number, decimals, ",", " "); } // Add currency code if necessary if ( formatMode == FORMAT_WITH_CURRENCY && !!currencyData && currencyData.length > 0 ) { returnValue = returnValue + ((!empty(currencyData[0]['symbol'])) ? " " + currencyData[0]['symbol'] : " " + currency); } return returnValue; } /** * Get the correct URL for the detail of a contact * @param id */ const contactDetailUrl = (id,hash) => { const transaction = '' === 'T' ? '&transaction=1' : ''; return !!hash && `index.php?p=contacts&v=contact_detail&id=${id}${transaction}#${hash}` || `index.php?p=contacts&v=contact_detail&id=${id}${transaction}`; }; /** * @description format a number with the config * @param {any} number * @returns {int} formated number */ const numberFormatForConfig = (number) => { return number_format(number, 2, ",", " "); } let defaultOptionDelay = '7'; let isBookingAllowedForPR = ''; let noAutoBookingForBC = ''; let isBookingMandatoryForFinalization = ''; let isStockPRcreationPossibilyForced = '1'; let isStockPRcreationPossibilyForcedOV = '1'; let displayVinNumber = `[{"document_type":"PR","product_category":"VN", "show_input": "1", "disabled_input": "0", "force_VS_VD" : "1", "default": "0"},{"document_type":"BC","product_category":"VN", "show_input": "0", "disabled_input": "1", "force_VS_VD" : "1", "default": "1"},{"document_type":"PP","product_category":"", "show_input": "0", "disabled_input": "1", "force_VS_VD" : "1", "default": "1"}]`; // Form Validation /** * * Override console to display message when dev mode only * * clg("test"); * console.info("test"); * console.warn("test"); * console.error("test"); * */ var isDebugMode = 0; /*var newConsole=(function(oldCons){ return { log: function(text){ if(isDebugMode){ oldCons.log(text); } }, info: function (text) { if(isDebugMode){ oldCons.info(text); } }, warn: function (text) { if(isDebugMode){ oldCons.warn(text); } }, error: function (text) { //if(isDebugMode){ oldCons.error(text); // } } }; }(window.console));*/ //window.console = newConsole; // Datas from server var globIsGoogleActivated = 0; //Define start and end time for all time pickers with company static table values var globalStartTimePicker = "00:00 am" ; var globalEndTimePicker = "11:59 pm" ; // Privilege managment let userPrivileges = `null`; userPrivileges = JSON.parse(userPrivileges); // Moderation managment let userModerations = `null`; userModerations = JSON.parse(userModerations); $(document).ready(function(){ });