Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10243 - studio not saving field properties correctly #10538

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from
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
18 changes: 10 additions & 8 deletions modules/ModuleBuilder/parsers/StandardField.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
* Copyright (C) 2011 - 2024 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
Expand Down Expand Up @@ -119,17 +119,19 @@ public function addFieldObject(&$field)
$this->baseField = get_widget($field->type) ;
foreach ($field->vardef_map as $property => $fmd_col) {
if ($property == "action" || $property == "label_value" || $property == "label"
|| ((substr((string) $property, 0, 3) == 'ext' && strlen((string) $property) == 4))
|| ((str_starts_with((string)$property, 'ext') && strlen((string) $property) == 4))
// possible bug here... $property is often the same as $fmd_col, but not always. Maybe we should also add:
// || ((str_starts_with((string)$fmd_col, 'ext') && strlen((string) $fmd_col) == 4))
// ... but a thorough analysis of the consequences of this would be required.
) {
continue;
}

// Bug 37043 - Avoid writing out vardef defintions that are the default value.

// Avoid writing out vardef definitions that are the default value, when possible.
// Since isDefaultvalue() is quite limited, and doesn't handle all cases well,
// sometimes we won't detect defaults and will store them anyway.
if (isset($newDef[$property]) &&
(
(!isset($currdef[$property]) && !$this->isDefaultValue($property, $newDef[$property], $this->baseField))
|| (isset($currdef[$property]) && $currdef[$property] != $newDef[$property])
)
!$this->isDefaultValue($property, $newDef[$property], $this->baseField)
) {
$this->custom_def[$property] =
is_string($newDef[$property]) ? htmlspecialchars_decode($newDef[$property], ENT_QUOTES) : $newDef[$property];
Expand Down