Hello guys! I am new on SuiteCRM.
I need to disable create/save buttons from edit view in some cases. I did this on the frontend with Javascript, but users are still able to bypass my rule by reloading the page or disabling Javascript in the browser. Now, I have to handle this buttons on backend, but I am having a hard time finding them in PHP source. Someone can help me?
Hi, welcome to the Community!
It’s not a generic answer… if you can provide more details, which module, which view, which buttons, I can try helping you out.
Hi pgr, thanks for your support and sorry for my delay, I didn’t expect you guys answer in such a fast way!
So, let me explain: here at the company we use the system as an Ombudsman manager. When someone wants to complain about something, they can create a topic that goes through a process until it get closed.
Once the topic gets closed it can no longer be edited which is why we need to block this action.
We tried to do those things on the frontend with Javascript, but users are still able to bypass our rule by reloading the page or disabling Javascript in the browser.
Hope being clear this time.
Thanks again for the help, I really appreciate that!
Search the code for actionsContainer
, you will find .tpl
files where you can change this (server-side) using Smarty templates syntax.
Note that the tpls can be generic, or they can have overrides in specific modules or views. Start by trying a few simple changes to see which ones reflect on your screen.
Also note that refreshing these after changes can be tricky. Keep an eye on your cache dir and delete the compiled templates, so that they get regenerated. I’m not sure exactly which ones, but maybe…:
cache/smarty/templates_c/*
cache/themes/SuiteP/modules/ etc
The easiest might be to redirect the edit view to the detail view in a custom controller when your record is closed.
Something like:
public function action_editview()
{
$this->view = 'edit';
$condition = $this->bean->status == 'Closed';
// UPDATE $condition depending of field name and value
if ($condition){
$this->view = 'detail';
}
}
I’m trying to follow each of your suggestions. Any updates I post here.
I had never heard of Smarty Engine… I am not a native PHP programmer
It seems great.