repair database on 7.14 does not match for default with decimals #5140

Open
opened 2026-02-20 16:30:17 -05:00 by deekerman · 2 comments
Owner

Originally created by @ghost on GitHub (Dec 28, 2023).

When you execute a repair database on 7.14.2 does not match default value between vardefs and database for decimal fields configured with a default.

Issue

Database is MariaDB 10.5.21
In vardefs.php fields are defined this way:
'rate' => array(
'required' => true,
'name' => 'rate',
'vname' => 'LBL_RATE',
'type' => 'decimal',
'massupdate' => 0,
'default' => 1.000000,
'no_default' => false,
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => true,
'inline_edit' => true,
'reportable' => true,
'unified_search' => false,
'merge_filter' => 'disabled',
'len' => 26,
'size' => '26',
'enable_range_search' => true,
'precision' => 6
),
In database
image
In fields_def rate will have default = 1 (without decimals) so in include/database/DBManager.php when compares in compareVarDefs function does not match because cast to string (so 1 is different to 1.000000).

Expected Behavior

It should be match anyway.

Actual Behavior

Studio accepts only default with decimals so any time we execute repair this fields has included to repair.

Possible Fix

We should change fields_defs definition so when compares it matches or add a compare for default value when decimal

Your Environment

  • SuiteCRM Version used: 7.14.2
  • Browser name and version Chrome Version 120.0.6099.130 (64-bit)):
  • Environment name and version
    PHP 8.2
    MariaDB 10.5.21
  • Operating System and version Debian 11
Originally created by @ghost on GitHub (Dec 28, 2023). When you execute a repair database on 7.14.2 does not match default value between vardefs and database for decimal fields configured with a default. #### Issue Database is MariaDB 10.5.21 In vardefs.php fields are defined this way: 'rate' => array( 'required' => true, 'name' => 'rate', 'vname' => 'LBL_RATE', 'type' => 'decimal', 'massupdate' => 0, 'default' => 1.000000, 'no_default' => false, 'comments' => '', 'help' => '', 'importable' => 'true', 'duplicate_merge' => 'disabled', 'duplicate_merge_dom_value' => '0', 'audited' => true, 'inline_edit' => true, 'reportable' => true, 'unified_search' => false, 'merge_filter' => 'disabled', 'len' => 26, 'size' => '26', 'enable_range_search' => true, 'precision' => 6 ), In database ![image](https://github.com/salesagility/SuiteCRM/assets/100579729/027645cf-8591-4794-b4e6-dfef9f6e86f1) In fields_def rate will have default = 1 (without decimals) so in include/database/DBManager.php when compares in compareVarDefs function does not match because cast to string (so 1 is different to 1.000000). #### Expected Behavior It should be match anyway. #### Actual Behavior Studio accepts only default with decimals so any time we execute repair this fields has included to repair. #### Possible Fix We should change fields_defs definition so when compares it matches or add a compare for default value when decimal #### Your Environment * SuiteCRM Version used: 7.14.2 * Browser name and version Chrome Version 120.0.6099.130 (64-bit)): * Environment name and version PHP 8.2 MariaDB 10.5.21 * Operating System and version Debian 11
Author
Owner

@johnM2401 commented on GitHub (Apr 9, 2024):

Hey!

Thank you for getting in touch!

Are you still experiencing these issues?


I've given this a few tries, but i'm afraid i've been unable to replicate as of yet.

I've created the following custom field in Accounts, via Studio, which has a default of "1.000000"
image
image

However, running Repair->Quick Repair and Rebuild does not appear to give me the prompt to Execute changes
(ie: No difference is found between CRM/Database)

Have I perhaps misunderstood or missed a replication step?
Please let me know if you have any further information.

Thanks again!

@johnM2401 commented on GitHub (Apr 9, 2024): Hey! Thank you for getting in touch! Are you still experiencing these issues? <br> I've given this a few tries, but i'm afraid i've been unable to replicate as of yet. I've created the following custom field in Accounts, via Studio, which has a default of "1.000000" ![image](https://github.com/salesagility/SuiteCRM/assets/13675281/ac297035-7e84-4596-9369-8b3e7843e91a) ![image](https://github.com/salesagility/SuiteCRM/assets/13675281/e16fafc4-f852-495b-ab5c-51c9687f8ba7) However, running Repair->Quick Repair and Rebuild does not appear to give me the prompt to Execute changes (ie: No difference is found between CRM/Database) Have I perhaps misunderstood or missed a replication step? Please let me know if you have any further information. Thanks again!
Author
Owner

@serhiisamko091184 commented on GitHub (Oct 7, 2024):

Hello @pqe-develop,

This issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs.
Thanks for your contributions.

Regards,
Serhii

@serhiisamko091184 commented on GitHub (Oct 7, 2024): Hello @pqe-develop, This issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs. Thanks for your contributions. Regards, Serhii
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5140
No description provided.