How can i remove “Edit” link option from "Quotes List view & Detail View " for status = Closed Accepted in Quotes module ?
based on role i am able to remove edit option from List view and Details view like only Accounts’ people and admin can edit quotes . but based on status can we remove the same
can some one please guide me how we can achieve this
For the detail view you will have to create a custom view.detail.php which will evaluate the value for the status.
If the current record can not be edited, according to staus value, you can remove the button “Edit” from layout on the fly:
custom/modules/Qutoes/views/view.detail.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/MVC/View/views/view.detail.php');
class ModuleNameViewDetail extends ViewDetail {
function display() {
if($this->bean->field_name == 'some_value') {
unset($this->dv->defs['templateMeta']['form']['buttons'][0]);
}
$this->dv->process();
echo $this->dv->display();
}
}
?>
Replace the strings “ModuleName”, “field_name”, “some_value” with the appropriate values.
As for the listview that may be a bit more difficult.
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/MVC/View/views/view.detail.php');
class AOS_QuotesViewList extends ViewList{
function Display()
{
if($this->bean->stage == 'Closed Accepted'){
unset($this->dv->defs['templateMeta']['form']['buttons'][0]);
}
$this->dv->process();
echo $this->dv->display();
}
}
but i am geting error like
Fatal error: Call to a member function process() on a non-object in /
can you help me on this ??
just as a note: even if you remove the button, people will still be able to edit the record (e.g. changing the Url from action=DetailView to action=EditView) -> it’s just “eye candy”, not a security measure.