From 851a784b36674e00867279a17e19093dcaf9e3e4 Mon Sep 17 00:00:00 2001 From: Cassowary Rusnov Date: Wed, 6 Apr 2022 08:43:30 -0700 Subject: [PATCH] Add custom field group association proper processing --- confdump.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/confdump.py b/confdump.py index 3bddcb8..db62370 100644 --- a/confdump.py +++ b/confdump.py @@ -66,6 +66,11 @@ LOAD_TRIVIAL = ["FinancialType", "Domain", "Contact"] +WEIRD_LIST = [ + ("civicrm_contact", "contact_sub_type"), + ("civicrm_custom_group", "extends_entity_column_value") +] + # This is a payment processor we can assign contribution pages to in order for them to work. # FIXME this seems to produce a non-working setup. STANDIN_PAYMENT_PROCESSOR_ID = "7" @@ -109,6 +114,9 @@ def object_to_table(instr: str) -> str: def array_to_weird_array(val: List) -> str: + if (val is None): + return "NULL" + return '"\x01' + ('\x01'.join([str(x) for x in val])) + '\x01"' @@ -139,7 +147,7 @@ def dict_to_insert(table: str, objdict: Dict) -> str: values = list() for col in columns: # any weird array we have to process here if there are others - if table == "civicrm_contact" and col == "contact_sub_type": + if (table, col) in WEIRD_LIST: values.append(array_to_weird_array(objdict[col])) else: values.append(python_value_to_sql(objdict[col]))