Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

Inline Edit of Checkbox on Detail View doesn't save changes SuiteCRM 7.11.10

I have a fresh install of SuiteCRM 7.11.10 and have only added some custom fields to a few out of the box modules. Inline editing is turned on in system settings and does work for all other fields except checkboxes. I am able to double click a checkbox field in detail view and the checkbox becomes editable. I click the box and a check appears but clicking on the checkmark to save does not save the change. I’m using the SuiteP theme.

I have already looked at these articles and tried the solutions with no change. I also tried disabling in system settings, running quick repair and re-enabling.


VERSIONS
SuiteCRM 7.11.10
PHP 7.3
SQL Server 2017
Windows 10 Enterprise for Virtual Desktop v1809
Chrome 80.0.3987.132

Hi @michellegoldmandev,

I’ve not been able to replicate this on the latest version. Can you check that for a start permission are set correctly and a repair and rebuild has been run. If the field your attempting to edit one of the custom ones added?

Hi. I did check the permissions. This is for a custom field. All of my other custom field types allow inline editing, just not checkboxes. I checked the out of the box checkboxes too, like in Documents (“Templates”), and that does not allow inline editing either. All other field types are working fine.

ISSUE RESOLVED

I found this post:
https://github.com/anhnhatuit/SuiteCRM/commit/eccefeed7400cdfd1cbc7381f133e4583c904042.

I tried implementing as is but still didn’t work. I reversed the return statements and now it’s working.

case "bool":
                if ($("#" + field).is(":checked")) {
                    return 1;
                    return "on";
                    
                } else {
                    return 0;
                    return "off";
                    
                }
                break;

I think you got that code from the commit, and your copy-paste grabbed both sides of the commit.

The second return statements are not doing anything, so the code below should be equivalent, and simpler.

case "bool":
                if ($("#" + field).is(":checked")) {
                    return 1;
                    
                } else {
                    return 0;
                    
                }
                break;

I added the following in include/InlineEditing/InlineEditing.php saveField method - the elseif for the bool

 } elseif ($bean->field_defs[$field]['type'] == "currency") {
            if (stripos($field, 'usdollar')) {
                $newfield = str_replace("_usdollar", "", $field);
                $bean->$newfield = $value;
            } else {
                $bean->$field = $value;
            }
        } elseif ($bean->field_defs[$field]['type'] == "bool") {                        
            if ($_REQUEST['value'] == "on") {
                $bean->$field = true;
            } else {
                $bean->$field = false;
            }
        } elseif ($module === 'Leads' && $field === 'account_name') {
            require_once('modules/Leads/LeadFormBase.php');
            $bean->$field = $value;
            $bean->account_id = LeadFormBase::handleLeadAccountName($bean);
        } else {

Nice :clap:

The same thing can be written a bit simpler:

...
        } elseif ($bean->field_defs[$field]['type'] == 'bool') {
            $bean->$field = ($_REQUEST['value'] == 'on');
        } elseif ...