salesagility / SuiteCRM-Core

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
182 stars 134 forks source link

The Editing view and Details View 's field is same (V8) #538

Closed ChongCR closed 2 months ago

ChongCR commented 3 months ago

Issue

I am having problem where in my details view in "Leads" having 5 field, and when i click on edit, there actually some field i wanted to hide it and not letting user to modify / update it , I have configured it on studio but it still having the same field as details view after clicking edit

Did anyone having this issues also ? help please

Possible Fix

No response

Steps to Reproduce the Issue

1.
2.
3.
...

Context

No response

Version

8.6

What browser are you currently using?

Chrome

Browser Version

No response

Environment Information

PHP 8.1

Operating System and Version

Window 11

johnM2401 commented 2 months ago

Hey! Thank you for getting in touch!


To clarify the reason you are seeing the same fields on both views:

In SuiteCRM8, the "Detailview" found in Admin->Studio will control both the Edit and Record viewing modes on that Module. So any amendments made to "Detailview" will affect both Editing and Viewing modes of a Record.

The "Editview" found in Admin->Studio will control the Legacy (SuiteCRM7) Edit View. This normally is not seen on most modules, but can be regained by enabling Compatability mode for that module.



So, some suggestions for you, if you wish to have Read-only fields for a module:


1: -- Enable Compatability Mode for your required Modules This can be done by amending the module_routing.yaml file A brief guide on this can be found here: https://community.suitecrm.com/t/compatibility-mode-in-suitecrm-8/83355/4

This will lose Suite8-only functionality, but you will be able to see the changes made on the "Editview" layout in Studio



2: -- Alternatively, if you wish to keep the Suite8 view (and Suite8-only features) You can make any field Read-Only by amending the DetailViewdDefs or Field Vardefs.

For example, in the Accounts Detailviewdefs file at: public/legacy/custom/modules/Accounts/metadata/detailviewdefs.php

I have the Phone_fax field: image

If I add 'readonly'=>true, this becomes Read Only after running a Quick Repair and Rebuild in the CRM image image


Alternatively, via the field vardefs: I've added the file: public/legacy/custom/Extension/modules/Accounts/Ext/Vardefs/phonefield.php With the content:

<?php

$dictionary['Account']['fields']['phone_office']['readonly'] = true;

This will achieve the same results as the above change to the DetailViewDefs file.



3: -- Finally, you can Show/Hide any field from Edit OR Detail Views using custom logic, with more information found here: https://docs.suitecrm.com/8.x/developer/extensions/frontend/logic/field-logic/fe-extensions-display-logic/



I'll close this ticket off for now, as this is expected behaviour, but please let us know if you have any further issues or questions around the CRM.

Thanks again!

ChongCR commented 2 months ago

Hi thank you for the clear explaination, sorry that I still having question, if I have set readonly for the details view, but edit view I want it to be writeable, how can i do that? Thanks in advance !

johnM2401 commented 2 months ago

Hey!

hmmmm, I suppose it depends whether you want to use the SuiteCRM8 views or the Compatibility mode.


In SuiteCRM8, the "Detailview" layout in studio controls both Edit and Record Viewing modes.

As the SuiteCRM8 views do not currently have inline editing behaviour, all fields are already "Read Only" on Record View mode and writeable on Edit Mode.

(As users can only edit fields by entering the Edit Mode)



As far as i'm aware, The only way to have Read Only Detailview & Writeable on Editview (as separate items), is to use the Compatability mode.

If you're using compatability mode for a module, you can enable/disable "Inline editing" for specific fields via Admin->Studio->[Module]->Fields->[Field Name]

If Inline Editing is Enabled, users can update the field on Detailview If Inline Editing is disabled, users can not update the field on Detailview


Hopefully this is what you were looking for? Thanks!