<?php
namespace Modules\Orders\Details\GeneralDetails; class Controller extends \App\Mvc\Controller\Form\PopupAbstract { protected function initialize() { parent::initialize(); $this->actionsCfg['index'] = ['checkSection' => false, 'checkOption' => false,]; } protected function getDefaultFormData($R) { $formData = []; $ordEnt = \Entity\Order::select($R['idOrder']); $formData['reservationCode'] = $ordEnt->reservationCode; $formData['resType'] = $ordEnt->resType; $formData['servicesType'] = $ordEnt->servicesType; $formData['flag'] = $ordEnt->flag; $formData['idMiceProject']['id'] = $ordEnt->idMiceProject; $formData['description'] = $ordEnt->description; $formData['comments'] = $ordEnt->comments; $formData['idContactPerson']['id'] = $ordEnt->idContactPerson; $formData['idUser']['id'] = $ordEnt->idUser; $formData['idDepartment']['id'] = $ordEnt->idDepartment; return $formData; } protected function processFormData(Array $R, \App\MessagesCollector $msgs) { try { \DB::startTransaction(); $orderEnt = \Entity\Order::update($R['idOrder']); $orderEnt->reservationCode = $R['reservationCode']; $orderEnt->resType = $R['resType']; $orderEnt->servicesType = $R['servicesType']; if (\App\UserAccess\CurrentUserAccessFast::getInstance()->getAccessOptionValue('Modules/Orders/Details/OrderFlag')) { $orderEnt->flag = $R['flag']; } $orderEnt->idMiceProject = $R['idMiceProject']['id']; $orderEnt->description = $R['description']; $orderEnt->comments = $R['comments']; $orderEnt->idContactPerson = $R['idContactPerson']['id']; if (\App\UserAccess\CurrentUserAccessFast::getInstance()->getAccessOptionValue('reservationChangeResponsibleUser')) { $orderEnt->idDepartment = $R['idDepartment']['id']; $orderEnt->idUser = $R['idUser']['id']; $orderEnt->idOffice = \Entity\User::select($R['idUser']['id'])->idOffice; } $orderEnt->save(); \DB::commitTransaction(); $msgs->addSuccess($this->lang['index']['saveOk']); } catch (\App\Entity\Exception $e) { \DB::rollbackTransaction(); $msgs->addError(sprintf($this->lang['index']['saveError'], $e->getMessage())); return false; } return true; } }