YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/SlaPolicy/actions/DeleteAjax.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php
/**
 * Settings SlaPolicy DeleteAjax class.
 *
 * @package   Action
 *
 * @copyright YetiForce S.A.
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 * @author    Rafal Pospiech <r.pospiech@yetiforce.com>
 */
class Settings_SlaPolicy_DeleteAjax_Action extends Settings_Vtiger_Delete_Action
{
    /** {@inheritdoc} */
    public function process(App\Request $request)
    {
        $recordModel = Settings_SlaPolicy_Record_Model::getInstanceById($request->getInteger('record'));
        $result =  ['success' => true];
        if ($recordModel) {
            $result =  ['success' => (bool) $recordModel->delete()];
        }
        $response = new Vtiger_Response();
        $response->setResult($result);
        $response->emit();
    }
}