YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vendors/models/ListView.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%
<?php
/* +***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 * Contributor(s): YetiForce S.A.
 * *********************************************************************************** */

class Vendors_ListView_Model extends Vtiger_ListView_Model
{
    /** {@inheritdoc} */
    public function getListViewMassActions($linkParams)
    {
        $links = parent::getListViewMassActions($linkParams);
        $moduleModel = $this->getModule();
        $massActionLinks = [];
        if ($moduleModel->isPermitted('MassComposeEmail') && App\Config::main('isActiveSendingMails') && App\Mail::getDefaultSmtp()) {
            $massActionLinks[] = [
                'linktype' => 'LISTVIEWMASSACTION',
                'linklabel' => 'LBL_MASS_SEND_EMAIL',
                'linkurl' => 'javascript:Vtiger_List_Js.triggerSendEmail()',
                'linkicon' => 'fas fa-envelope',
            ];
        }
        foreach ($massActionLinks as $massActionLink) {
            $links['LISTVIEWMASSACTION'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
        }
        return $links;
    }
}