public function prepareData()
 {
     parent::prepareData();
     $this->initRecord();
     $this->checkUserPrivileges();
     $this->initDiskPath();
 }
 public function prepareData()
 {
     parent::prepareData();
     $this->messageManager = new CoreFormValidationMessageContainer();
     if (!$this->isUserPermitted()) {
         $this->messageManager->addMessage('fileDeleteErrorNoPermission');
         return;
     }
     $this->fileDAO = new FileDAO();
     CoreServices2::getDB()->transactionStart();
     $this->initFileRecord();
     if (!empty($this->fileRecord['id'])) {
         $this->initBaseRecordDAO();
         $this->initBaseRecord();
         if (!$this->hasUserPermissionsForRecord()) {
             $this->messageManager->addMessage('fileDeleteErrorNoPermission');
             return;
         }
         $this->checkDataConsistency();
         if (!$this->messageManager->isAnyErrorMessage()) {
             $this->deleteFileRecord();
         }
     } else {
         $this->messageManager->addMessage('fileDeleteErrorNoSuchFile');
     }
     CoreServices2::getDB()->transactionCommit();
 }
 public function prepareData()
 {
     parent::prepareData();
     if (!$this->isUserPermitted()) {
         $this->messageManager = new CoreFormValidationMessageContainer();
         $this->messageManager->addMessage('fileUploadErrorNoPermission');
         return;
     }
     $this->initForm();
     $this->createFormFields();
     $this->setFieldValuesFromRequest();
     $this->fileDAO = new FileDAO();
     CoreServices2::getDB()->transactionStart();
     $this->validateFields();
     if (!$this->messageManager->isAnyErrorMessage()) {
         $this->saveFileRecord();
     }
     CoreServices2::getDB()->transactionCommit();
     if (!empty($this->fileRecord['id'])) {
         $this->initFileLinkHTML();
     }
 }