Suitecrm: Module Builder - dashlet file - no substitution in class name

Created on 5 Jul 2017  路  2Comments  路  Source: salesagility/SuiteCRM

After the creation and deployment of a new module through Module Builder the dashlet file generated for the module produces php parse error.

Issue

In fact, for a module I created, deployed and working correctly, as modules/mkt_Checkin - my college tried to add the dashlet to a Home tab. Result: no dashlets load - the call to: index.php?action=index&module=Home produces an error 500 and on the server side, in the logs I get:
PHP Parse error: syntax error, unexpected '<', expecting identifier (T_STRING) in modules/mkt_Checkin/Dashlets/mkt_CheckinDashlet/mkt_CheckinDashlet.php

in fact the code reads:

<?php
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}

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

class <module_name > Dashlet extends DashletGeneric {
    function __construct($id, $def = null)
    {
        global $current_user, $app_strings;
        require('modules/mkt_Checkin/metadata/dashletviewdefs.php');

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

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

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

        $this->seedBean = new mkt_Checkin();        
    }
}

where you can clearly see that the class name was not correctly substituted from what guess is a template file for dashlets.

Steps to Reproduce

  1. create package/module with module builder
  2. deploy
  3. (add dashlet for new module to HOME)
    4.inspect code

Your Environment

SuiteCRM: Version 7.8.3 - Sugar Version 6.5.24 (Versione 509)

Important Fix Proposed Bug

Most helpful comment

Fix proposal is not yet ok, correct is in #3870
line 48 shoud be
class Dashlet extends DashletGeneric {
no spece between Dashlet

Hope this is correct way and place to comment... my first time.

All 2 comments

Fix proposal is not yet ok, correct is in #3870
line 48 shoud be
class Dashlet extends DashletGeneric {
no spece between Dashlet

Hope this is correct way and place to comment... my first time.

@jannepesonen,
commit @Dillon-Brown resolved space problem: https://github.com/Dillon-Brown/SuiteCRM/commit/050e06c73b0dbc9e71e00f0827f74bf2cdf9c008 :)

Was this page helpful?
0 / 5 - 0 ratings