<?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['idOffice']['id'] = $ordEnt->idOffice; $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']; $orderEnt->idDepartment = $R['idDepartment']['id']; if (\App\UserAccess\CurrentUserAccessFast::getInstance()->getAccessOptionValue('reservationChangeResponsibleUser')) { $orderEnt->idUser = $R['idUser']['id']; $orderEnt->idOffice = $R['idOffice']['id']; } $orderEnt->save(); \DB::commitTransaction(); $msgs->addSuccess($this->lang['index']['saveOk']); } catch (\App\Entity\Exception $e) { \DB::rollbackTransaction(); $msgs->appendMessages($e->getMessagesCollector()); return false; } return true; } }