YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Wapro/views/Edit.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

/**
 * Settings WAPRO ERP edit/create view file.
 *
 * @package   Settings.View
 *
 * @copyright YetiForce S.A.
 * @license YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 * @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
 */
/**
 * Settings WAPRO ERP edit/create view class.
 */
class Settings_Wapro_Edit_View extends \App\Controller\ModalSettings
{
    /** {@inheritdoc} */
    public $showFooter = false;

    /** {@inheritdoc} */
    public $successBtn = 'LBL_SAVE_AND_VERIFY';

    /** {@inheritdoc} */
    public function checkPermission(App\Request $request)
    {
        parent::checkPermission($request);
        if (!\App\YetiForce\Register::getProduct('YetiForceWaproERP')) {
            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');
        }
    }

    /** {@inheritdoc} */
    public function process(App\Request $request)
    {
        $record = !$request->isEmpty('record') ? $request->getInteger('record') : '';
        if ($record) {
            $recordModel = Settings_Wapro_Record_Model::getInstanceById($record);
        } else {
            $recordModel = Settings_Wapro_Record_Model::getCleanInstance();
        }
        $viewer = $this->getViewer($request);
        $viewer->assign('RECORD_MODEL', $recordModel);
        $viewer->assign('RECORD_ID', $record);
        $viewer->assign('MODULE_NAME', $request->getModule());
        $viewer->assign('BTN_SUCCESS', $this->successBtn);
        $viewer->assign('BTN_SUCCESS_ICON', $this->successBtnIcon);
        $viewer->assign('BTN_DANGER', $this->dangerBtn);
        $viewer->view('Edit/Modal.tpl', $request->getModule(false));
    }
}