[Vtigercrm-developers] Bug - export report with not Secondary Modules get white page (error 500)

omri yona omri.yona at gmail.com
Thu Jun 4 09:57:00 GMT 2020


The bug  happened when you try to export table report and the secondary
module is empty' you get white page (error 500).
As I  found  its case by the function checkReportModulePermission file:
modules/Reports/views/ExportReport.php
the array secondaryModules get empty string and then in the getInstance
function we get an error.

I solve this in by add if(!$checkModule){ continue; } in the foreach.

I whold like to knew if I done samting wrong that can case my a different
issue and I will happy if it's a core bug If same one can open a ticket to
fix this issue in the next version.

thank you,
omri




all function now is:
function checkReportModulePermission(Vtiger_Request $request){
        $viewer = $this->getViewer($request);
        $recordId = $request->get('record');
        $reportModel = Reports_Record_Model::getInstanceById($recordId);
        $primaryModule = $reportModel->getPrimaryModule();
        $secondaryModules = $reportModel->getSecondaryModules();
        $modulesList = array($primaryModule);
        if(stripos($secondaryModules, ':') >= 0){
            $secmodules = split(':', $secondaryModules);
            $modulesList = array_merge($modulesList, $secmodules);
        }else{
            array_push($modulesList, $secondaryModules);
        }
        $currentUser = Users_Record_Model::getCurrentUserModel();
        $userPrivilegesModel = Users_Privileges_Model::getInstanceById(
$currentUser->getId());
        foreach ($modulesList as $checkModule) {

//Jira ticket DEVT-3640 - Fix a Bug that export report with not
Secondary Modules get white page (error 500)
            if(!$checkModule){
                continue;
            }
            //End fix Jira ticket DEVT-3640
            $moduleInstance = Vtiger_Module_Model::getInstance($checkModule
);
            $permission = $userPrivilegesModel->hasModulePermission(
$moduleInstance->getId());
            if(!$permission) {
                $viewer->assign('MODULE', $primaryModule);
                $viewer->assign('MESSAGE', vtranslate(
'LBL_PERMISSION_DENIED'));
                $viewer->view('OperationNotPermitted.tpl', $primaryModule);
                exit;
            }
        }
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20200604/2be1c2fb/attachment.html>


More information about the vtigercrm-developers mailing list