Skip to content

Commit

Permalink
Fix salesagility#10243 - Studio - Fields reverting back to default
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiisamko091184 committed Nov 30, 2023
1 parent 1212a9b commit 91a43d8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions modules/ModuleBuilder/parsers/StandardField.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ class StandardField extends DynamicField
public $custom_def = array();
public $base_def = array();
public $baseField;

protected function loadCustomDef($field)
{
global $beanList;
if (!empty($beanList[$this->module]) && is_file("custom/Extension/modules/{$this->module}/Ext/Vardefs/sugarfield_$field.php")) {
if (!empty($beanList[$this->module]) && is_file("custom/Extension/modules/{$this->module}/Ext/Vardefs/_override_sugarfield_$field.php")) {
$bean_name = get_valid_bean_name($this->module);
$dictionary = array($bean_name => array("fields" => array($field => array())));
include("$this->base_path/sugarfield_$field.php");
include("$this->base_path/_override_sugarfield_$field.php");
if (!empty($dictionary[$bean_name]) && isset($dictionary[$bean_name]["fields"][$field])) {
$this->custom_def = $dictionary[$bean_name]["fields"][$field];
}
Expand All @@ -74,7 +74,7 @@ protected function loadBaseDef($field)
}
}
}

/**
* Adds a custom field using a field object
*
Expand All @@ -84,8 +84,8 @@ protected function loadBaseDef($field)
public function addFieldObject(&$field)
{
global $dictionary, $beanList;


if (empty($beanList[$this->module])) {
return false;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public function addFieldObject(&$field)
$this->loadCustomDef($field->name);
$this->loadBaseDef($field->name);
$newDef = $field->get_field_def();

require_once('modules/DynamicFields/FieldCases.php') ;
$this->baseField = get_widget($field->type) ;
foreach ($field->vardef_map as $property => $fmd_col) {
Expand All @@ -122,7 +122,7 @@ public function addFieldObject(&$field)
) {
continue;
}

// Bug 37043 - Avoid writing out vardef defintions that are the default value.
if (isset($newDef[$property]) &&
(
Expand All @@ -133,7 +133,7 @@ public function addFieldObject(&$field)
$this->custom_def[$property] =
is_string($newDef[$property]) ? htmlspecialchars_decode($newDef[$property], ENT_QUOTES) : $newDef[$property];
}

//Remove any orphaned entries
if (isset($this->custom_def[$property]) && !isset($newDef[$property])) {
unset($this->custom_def[$property]);
Expand All @@ -157,11 +157,11 @@ public function addFieldObject(&$field)
}
}
}

if (isset($this->custom_def["duplicate_merge_dom_value"]) && !isset($this->custom_def["duplicate_merge"])) {
unset($this->custom_def["duplicate_merge_dom_value"]);
}

$this->writeVardefExtension($bean_name, $field, $this->custom_def);
}
}

0 comments on commit 91a43d8

Please sign in to comment.