Create a Custom Module Dashlet

Iā€™m attempting to create a dashlet for the Projects module. I have created 3 files in /suitecrm/modules/Project/Dashlets/MyProjectsDashlet and I did a quick rebuild/repair and yet mydashlet doesnā€™t show up on the homepage and SugarDashlets doesnā€™t show up in the studio for Project. There is nothing in the error log.

MyProjectsDashlet.data.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/




global $current_user;

$dashletData['MyProjectsDashlet']['searchFields'] = array('date_entered'     => array('default' => ''),
                                                          'aa_file_c'    => array('default' => ''),
														  // 'status' => array('default' => 'Draft,proposal_sent,verbally_accepted,proposal_received,schematic_design,design_development,construction_documents,bid_award,construction_administration,system_commissioning,closeout'),
                                                          'assigned_user_id' => array('type'    => 'assigned_user_name', 
                                                                                      'default' => $current_user->name,
																					  'label' => 'LBL_ASSIGNED_TO'));
$dashletData['MyProjectsDashlet']['columns'] =  array('actual_project_c' => array('width'   => '6', 
                                                                      'label'   => 'LBL_ACTUAL_PROJECT',
                                                                      'link'    => false,
                                                                      'default' => true),
                                                      'aa_file_c' => array('width' => '8',
                                                                         'label' => 'LBL_AA_FILE',
																		 'link' => true,
																		 'default' => true), 
                                                      'name' => array('width'   => '15', 
                                                                              'label'   => 'LBL_NAME',
																			  'link' => true,
                                                                              'default' => true),
                                                      'status' => array('width' => '10',
                                                                          'label' => 'LBL_STATUS',
																		  'default' => true),
                                                      'assigned_user_id' => array('width' => '10',
                                                                                 'label' => 'LBL_ASSIGNED_USER_NAME'),
                                                      'fee_c' => array('width' => '8',
                                                                                      'label' => 'LBL_FEE'),
                                                      'fee_billed_c' => array('width' => '8',
                                                                                       'label' => 'LBL_FEE_BILLED'),
                                                      'fee_balance_c' => array('width' => '8',
                                                                                            'label' => 'LBL_FEE_BALANCE'),
                                                      'fee_per_hour_c' => array('width' => '8',
                                                                                        'label' => 'LBL_FEE_PER_HOUR'),
                                               );
?>

MyProjectsDashlet.meta.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/




global $app_strings;

$dashletMeta['MyProjectsDashlet'] = array('module'		=> 'Projects',
										  'title'       => translate('LBL_HOMEPAGE_TITLE', 'Projects'), 
                                          'description' => 'A customizable view into Projects',
                                          'category'    => 'Module Views');
?>

MyProjectsDashlet.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/





require_once('include/Dashlets/DashletGeneric.php');


class MyProjectsDashlet extends DashletGeneric { 
    function MyProjectsDashlet($id, $def = null) {
		global $current_user, $app_strings;
		require('modules/Project/Dashlets/MyProjectsDashlet/MyAccountsDashlet.data.php');

        parent::DashletGeneric($id, $def);

        if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'Projects');

        $this->searchFields = $dashletData['MyProjectsDashlet']['searchFields'];
        $this->columns = $dashletData['MyProjectsDashlet']['columns'];

        $this->seedBean = new Project();        
    }
    
	/** I DON'T FEEL THIS SECTION IS NECESSARY FOR PROJECTS. - ADS 11/18/2014
    /**
     * Overrides the generic process to include custom logic for email addresses,
     * since they are no longer stored in  a list view friendly manner.
     * (A record may have an undetermined number of email addresses).
     *
     * @param array $lvsParams
     * / (was the end of a comment - ADS 11/18/2014)
     
	function process($lvsParams = array()) {
    	if (isset($this->displayColumns) && array_search('email1', $this->displayColumns) !== false) {
	    	$lvsParams['custom_select'] = ', email_address as email1';
	    	$lvsParams['custom_from'] = ' LEFT JOIN email_addr_bean_rel eabr ON eabr.deleted = 0 AND bean_module = \'Accounts\''
	    							  . ' AND eabr.bean_id = accounts.id AND primary_address = 1'
	    							  . ' LEFT JOIN email_addresses ea ON ea.deleted = 0 AND ea.id = eabr.email_address_id';
    	}
    	
        if (isset($this->displayColumns) && array_search('parent_name', $this->displayColumns) !== false) {
	    	$lvsParams['custom_select'] = empty($lvsParams['custom_select']) ? ', a1.name as parent_name ' : $lvsParams['custom_select'] . ', a1.name as parent_name ';
	    	$lvsParams['custom_from'] = empty($lvsParams['custom_from']) ? ' LEFT JOIN accounts a1 on a1.id = accounts.parent_id' : $lvsParams['custom_from'] . ' LEFT JOIN accounts a1 on a1.id = accounts.parent_id';
    	}    	

    	parent::process($lvsParams);
    }
	*/
}

?>

I applied proper ownership and permissions to the files and directories.

Here is my main source of inspiration: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/02_Application_Framework/Dashlets/01_Creating_Dashlets/

I would like to add that the information appears to be making it into the /cache/dashlets/dashlets.php file correctly:

  'MyProjectsDashlet' => 
  array (
    'file' => 'modules/Project/Dashlets/MyProjectsDashlet/MyProjectsDashlet.php',
    'class' => 'MyProjectsDashlet',
    'meta' => 'modules/Project/Dashlets/MyProjectsDashlet/MyProjectsDashlet.meta.php',
    'module' => 'Projects',
  ),
1 Like

OK, so in the MyProjectsDashlet.meta.php I had ā€˜moduleā€™ as ā€˜Projectsā€™ instead of ā€˜Projectā€™. That made it start showing up. But apparently there isnā€™t a LBL_HOMEPAGE_TITLE for ā€œProjectā€, so it just showed ā€˜LBL_HOMEPAGE_TITLEā€™ in the Dashlet Picker and at the top of the dashlet itself. I changed MyProjectsDashlet.meta.php to just say ā€˜titleā€™ = ā€˜My Projectsā€™, which fixed it in the dashlet picker but not on the homepage. Furthermore, the only columns shown are ā€˜Nameā€™ and ā€˜Date Createdā€™, which is not what I configured in MyProjectsDashlet.data.phpā€¦ and similarly, when click the pencil icon, the available filter fields and available fields are not what I configured.

Furthermore, when I go to Studio, I donā€™t see Projects->Layout->Sugar Dashlets, so I canā€™t complete my configuration from within Studio!!!

Getting frustratedā€¦ Iā€™m nearly 3 hours into this simple addition of a dashlet!

1 Like

OK, so same problem with MyProjectsDashlet.phpā€¦ it had ā€œif(empty($def[ā€˜titleā€™])) $this->title = translate(ā€˜LBL_HOMEPAGE_TITLEā€™, ā€˜Projectsā€™);ā€ instead of ā€œif(empty($def[ā€˜titleā€™])) $this->title = translate(ā€˜LBL_HOMEPAGE_TITLEā€™, ā€˜Projectā€™);ā€

I added that label to the language file inside /modules/Project/languagesā€¦ Iā€™m not sure this is upgrade safe, but Iā€™m frustrated at this point.

The module columns and search functionality still isnā€™t what I programmed.

sieberta

Just to be clearā€¦ all Iā€™m missing at this point isā€¦

  1. My columns and search settings in ā€œMyProjectsDashlet.data.phpā€ are not showing up correctly. I attempted commenting everything out but a simple one of each that were not from a custom table, and it still didnā€™t work.
    and
  2. Sugar Dashlet is not an option in Studio->Manage Layouts->Projects (which might be a solution to (1) if it were showing up).

Againā€¦ nothing in the error logs.

sieberta

So, I found there was a dashletviewdefs.php file in custom/modules/Project/metadata. Once I deleted this file, my ā€œMyProjectsDashlet.data.phpā€ worked correctlyā€¦ however, I still canā€™t edit anything through studio :frowning:

sieberta

Here were my final files in case someone is copying what I did. Realize some of the fields referenced are custom fields only in my ā€œProjectā€ module.

Note: Everything is working except I donā€™t see Sugar Dashlets in Studio for editing. :unsure:

All of these files are in /suitecrm/modules/Project/Dashlets/MyProjectsDashlet and the Sugar Dashlets Cache needs rebuilt after uploading them.

MyProjectsDashlet.data.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/




global $current_user;

$dashletData['MyProjectsDashlet']['searchFields'] = array('date_entered'     => array('default' => ''),
                                                          'aa_file_c'    => array('default' => ''),
														   'status' => array('default' => array('Draft','proposal_sent','verbally_accepted','proposal_received','schematic_design','design_development','construction_documents','bid_award','construction_administration','system_commissioning','closeout'),
																			'type' => 'multiselect'),
                                                          'assigned_user_id' => array('type'    => 'assigned_user_name', 
                                                                                      'default' => $current_user->name,
																					  'label' => 'LBL_ASSIGNED_TO')
														);
$dashletData['MyProjectsDashlet']['columns'] =  array('actual_project_c' => array('width'   => '3', 
                                                                      'label'   => 'LBL_ACTUAL_PROJECT',
                                                                      'link'    => false,
                                                                      'default' => true),
                                                      'aa_file_c' => array('width' => '6',
                                                                         'label' => 'LBL_AA_FILE',
																		 'link' => true,
																		 'default' => true),
                                                      'name' => array('width'   => '15', 
                                                                              'label'   => 'LBL_NAME',
																			  'link' => true,
                                                                              'default' => true),
                                                      'status' => array('width' => '10',
                                                                          'label' => 'LBL_STATUS',
																		  'default' => true),
                                                      'assigned_user_name' => array('width'   => '8', 
                                                                                     'label'   => 'LBL_LIST_ASSIGNED_USER'),
                                                      'fee_c' => array('width' => '8',
                                                                                      'label' => 'LBL_FEE'),
                                                      'fee_billed_c' => array('width' => '8',
                                                                                       'label' => 'LBL_FEE_BILLED'),
                                                      'fee_balance_c' => array('width' => '6',
                                                                                            'label' => 'LBL_FEE_BALANCE',
																							'default' => true),
                                                      'fee_per_hour_c' => array('width' => '6',
                                                                                        'label' => 'LBL_FEE_PER_HOUR',
																						'default' => true)
                                               );
?>

MyProjectsDashlet.meta.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/




global $app_strings;

$dashletMeta['MyProjectsDashlet'] = array('module'		=> 'Project',
										  'title'       => translate('LBL_HOMEPAGE_TITLE', 'Project'), 
                                          'description' => 'A customizable view into Projects',
                                          'category'    => 'Module Views');
?>

MyProjectsDashlet.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.

 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/





require_once('include/Dashlets/DashletGeneric.php');


class MyProjectsDashlet extends DashletGeneric { 
    function MyProjectsDashlet($id, $def = null) {
		global $current_user, $app_strings;
		require('modules/Project/Dashlets/MyProjectsDashlet/MyProjectsDashlet.data.php');

        parent::DashletGeneric($id, $def);

        if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'Project');

        $this->searchFields = $dashletData['MyProjectsDashlet']['searchFields'];
        $this->columns = $dashletData['MyProjectsDashlet']['columns'];

        $this->seedBean = new Project();        
    }
    
    /**
     * Overrides the generic process to include custom logic for email addresses,
     * since they are no longer stored in  a list view friendly manner.
     * (A record may have an undetermined number of email addresses).
     *
     * @param array $lvsParams
     * /
     
	function process($lvsParams = array()) {
    	if (isset($this->displayColumns) && array_search('email1', $this->displayColumns) !== false) {
	    	$lvsParams['custom_select'] = ', email_address as email1';
	    	$lvsParams['custom_from'] = ' LEFT JOIN email_addr_bean_rel eabr ON eabr.deleted = 0 AND bean_module = \'Accounts\''
	    							  . ' AND eabr.bean_id = accounts.id AND primary_address = 1'
	    							  . ' LEFT JOIN email_addresses ea ON ea.deleted = 0 AND ea.id = eabr.email_address_id';
    	}
    	
        if (isset($this->displayColumns) && array_search('parent_name', $this->displayColumns) !== false) {
	    	$lvsParams['custom_select'] = empty($lvsParams['custom_select']) ? ', a1.name as parent_name ' : $lvsParams['custom_select'] . ', a1.name as parent_name ';
	    	$lvsParams['custom_from'] = empty($lvsParams['custom_from']) ? ' LEFT JOIN accounts a1 on a1.id = accounts.parent_id' : $lvsParams['custom_from'] . ' LEFT JOIN accounts a1 on a1.id = accounts.parent_id';
    	}    	

    	parent::process($lvsParams);
    }*/
}

?>
1 Like