From 3f66bd07e6a37f5f217235f72c5525885712af92 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 19 Dec 2025 15:34:49 +0100 Subject: [PATCH] Fix: Remove WHERE clauses and cf_854 field from vTiger queries (API doesn't support empty string comparison) --- app/system/backend/sync_router.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/system/backend/sync_router.py b/app/system/backend/sync_router.py index a152745..c0f0c2d 100644 --- a/app/system/backend/sync_router.py +++ b/app/system/backend/sync_router.py @@ -37,7 +37,7 @@ async def sync_from_vtiger() -> Dict[str, Any]: vtiger = get_vtiger_service() # Query vTiger for all accounts with CVR or name - query = "SELECT id, accountname, email1, siccode, cf_accounts_cvr, cf_854, website1, bill_city, bill_code, bill_country FROM Accounts WHERE accountname != '' LIMIT 1000;" + query = "SELECT id, accountname, email1, siccode, cf_accounts_cvr, website, bill_city, bill_code, bill_country FROM Accounts LIMIT 1000;" accounts = await vtiger.query(query) logger.info(f"📥 Fetched {len(accounts)} accounts from vTiger") @@ -50,7 +50,7 @@ async def sync_from_vtiger() -> Dict[str, Any]: vtiger_id = account.get('id') name = account.get('accountname', '').strip() cvr = account.get('cf_accounts_cvr') or account.get('siccode') - economic_customer_number = account.get('cf_854') # Custom field for e-conomic number + economic_customer_number = None # Will be set by e-conomic sync if not name: skipped_count += 1 @@ -169,7 +169,7 @@ async def sync_vtiger_contacts() -> Dict[str, Any]: vtiger = get_vtiger_service() # Query vTiger for contacts - query = "SELECT id, firstname, lastname, email, phone, mobile, title, department, account_id FROM Contacts WHERE firstname != '' OR lastname != '' LIMIT 1000;" + query = "SELECT id, firstname, lastname, email, phone, mobile, title, department, account_id FROM Contacts LIMIT 1000;" contacts = await vtiger.query(query) logger.info(f"📥 Fetched {len(contacts)} contacts from vTiger")