Sugarcrm : modify actions on Dashlet quickEdit button

1.4k Views Asked by At

I have a very specific question on Sugarcrm.

I'm using version Enterprise 6.5.16, and i'm coming to a dead-end.

What i currently have :

When the user is on his homepage, he has a Dashlet called "My open Cases", which displays every open Cases assigned to/or created by him.

For each row of this dashlet, we have a quickEdit icon displayed. (you know, the little pen). When the user clicks on that little icon, it opens the quickcreate (or quickedit?) popup.

What i want to achieve is :

I want, when the user clicks on the icon, that Sugar does not open a popup, but opens a new browser tab on EditView.

So basically, when on Home, when the user wants to edit "Case01--Issue" from the dashlet, instead of poping the quickcreate (or quickedit) form, i want to open a new browser tab with the complete edit view of "Case01 -- Issue".

What do i have to do? I did not see the definition of the icon in custom/modules/Cases/metadata/dashletviewdefs.php nor elsewhere.

Thanks by advance for your help and time!

Gaëlle

3

There are 3 best solutions below

0
On

You should create your own dashlet (with copying existing one in "custom" folder), replace all standart entries to your own. Add copy of DashletGenericDisplay.tpl too and name it like CustomMyCasesDashlet.tpl. It's not necessary to extend MyCasesDashlet class. You can leave "extends DashletGeneric". In constructor function CustomMyCasesDashlet() just add the line:

$this->displayTpl = 'custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.tpl';

Pay attention to $this->. Its necessary to override DashletGeneric field.

0
On

Copy the file from modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet.php and paste it to custom/modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet

If you don't have Cases folder inside the custom directory, create one.

After copying the file, add a property to load your custom TPL file.

Default DashletGenericDisplay.tpl file located at include/Dashlets/

class MyCasesDashlet extends DashletGeneric {

    var $displayTpl = "custom/modules/Cases/Dashlets/DashletGenericDisplay.tpl";
5
On

The "My Cases" dashlet, and most dashlets, extend the DashletGeneric class, found in /include/Dashlets/DashletGeneric.php. This uses the template file DashletGenericDisplay.tpl in the same directory, and this is the template that displays the quick edit button.

To remove or alter the quick edit button, you would extend My Cases and insist that it use a custom smarty template of your own creation. In /custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.php you might have the following:

<?php
require_once('modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet.php');
class CustomMyCasesDashlet extends MyCasesDashlet{
  $displayTpl = 'custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.tpl';
}

You would then copy the original template to the new file and location referenced by CustomMyCasesDashlet::displayTpl and adjust as desired.

For your Dashlet to register correctly with the system, you'll also need your CustomMyCasesDashlet.meta.php file. Copy the original to your custom directory and adjust labels as necessary -- the key is to replace references to MyCasesDashlet with CustomMyCasesDashlet.