Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sumfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ function sumfields_create_temporary_table($trigger_table) {

// These are the actual field names as created in this instance
$custom_fields = _sumfields_get_custom_field_parameters();
$active_fields = sumfields_get_setting('active_fields', array());

// Load the field and group definitions because we need to know
// which fields are triggered on which tables
Expand All @@ -433,6 +434,9 @@ function sumfields_create_temporary_table($trigger_table) {
$create_fields[] = "`contact_id` INT";
// Iterate over the actual instantiated summary fields
foreach ($custom_fields as $field_name => $values) {
if (!in_array($field_name, $active_fields)) {
continue;
}
// Avoid error - make sure we have a definition for this field.
if(array_key_exists($field_name, $definitions)) {
$field_definition = $definitions[$field_name];
Expand Down Expand Up @@ -1259,6 +1263,11 @@ function sumfields_alter_table() {
);
}
}
foreach ($custom_field_parameters as $field => $data) {
if(!in_array($field, $new_fields)) {
unset($custom_field_parameters[$field]);
}
}
sumfields_save_setting('custom_field_parameters', $custom_field_parameters);
if($ret == TRUE) {
// This was successfully, make the new fields that active fields
Expand Down