Пример #1
0
 /**
  * @param array $data
  * @param int $id
  * @return int
  */
 public function saveParkingLot($data, $id)
 {
     /* @var $parkingGeneralDao \DDD\Dao\Parking\General */
     $parkingGeneralDao = $this->getServiceLocator()->get('dao_parking_general');
     $oldData = $parkingGeneralDao->getParkingById($id);
     $saveData = ['name' => $data['name'], 'is_virtual' => (int) $data['is_virtual'], 'lock_id' => (int) $data['lock_id']];
     if (isset($data['country_id'])) {
         $saveData['country_id'] = (int) $data['country_id'];
     }
     if (isset($data['province_id'])) {
         $saveData['province_id'] = (int) $data['province_id'];
     }
     if (isset($data['city_id'])) {
         $saveData['city_id'] = (int) $data['city_id'];
     }
     if (isset($data['address'])) {
         $saveData['address'] = $data['address'];
     }
     if (isset($data['direction_textline_id'])) {
         $saveData['direction_textline_id'] = (int) $data['direction_textline_id'];
     }
     if (!empty($data['parking_permit'])) {
         $saveData['parking_permit'] = $data['parking_permit'];
     }
     $where = $id ? ['id' => $id] : false;
     $response = $parkingGeneralDao->save($saveData, $where);
     if (!$id) {
         $id = $response;
     }
     if (!empty($data['parking_permit'])) {
         $uploadFolder = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_IMAGES_ROOT . DirectoryStructure::FS_IMAGES_PARKING_ATTACHMENTS . $id . '/';
         $destination = $uploadFolder . $data['parking_permit'];
         Files::moveFile(DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_IMAGES_ROOT . DirectoryStructure::FS_IMAGES_TEMP_PATH . $data['parking_permit'], $destination);
         if ($oldData && $oldData->getParkingPermit()) {
             @unlink($uploadFolder . $oldData->getParkingPermit());
         }
     }
     return $id;
 }
Пример #2
0
 public function taskSave($data, $actionsSet, $isSystemUser = false)
 {
     /**
      * @var \Library\Authentication\BackofficeAuthenticationService $auth
      * @var Logger $logger
      * @var \DDD\Domain\Task\Task $oldDataGeneral
      * @var \DDD\Dao\Task\Staff $taskStaffDao
      * @var \DDD\Dao\Task\Subtask $taskSubtaskDao
      * @var \DDD\Dao\Task\Task $taskDao
      * @var \DDD\Dao\Task\Attachments $attachmentsDao
      * @var \DDD\Domain\Task\Task $oldDataGeneral
      * @var \DDD\Domain\Task\Staff[] $oldDataStaff
      * @var \DDD\Dao\Task\Tag $taskTagDao;
      * @var \DDD\Dao\Tag\Tag $tagDao;
      * @var \DDD\Dao\Team\Team $teamsDao;
      */
     $taskDao = $this->getTaskDao();
     $taskStaffDao = $this->getTaskStaffDao();
     $taskSubtaskDao = $this->getTaskSubtasksDao();
     $attachmentsDao = $this->getServiceLocator()->get('dao_task_attachments');
     $taskTagDao = $this->getServiceLocator()->get('dao_task_tag');
     $tagDao = $this->getServiceLocator()->get('dao_tag_tag');
     $teamsDao = $this->getServiceLocator()->get('dao_team_team');
     $logger = $this->getServiceLocator()->get('ActionLogger');
     if (!$isSystemUser) {
         $auth = $this->getServiceLocator()->get('library_backoffice_auth');
         $authId = $auth->getIdentity()->id;
     } else {
         $authId = UserMain::SYSTEM_USER_ID;
     }
     if (isset($data['edit_id']) && $data['edit_id'] > 0) {
         $oldDataGeneral = $taskDao->getTaskById($data['edit_id']);
         $oldDataStaff = $taskStaffDao->getTaskStaff($data['edit_id']);
     }
     $saveData = [];
     if (isset($data['follower_ids']) && !$data['follower_ids']) {
         $data['follower_ids'] = [];
     }
     if (isset($data['helper_ids']) && !$data['helper_ids']) {
         $data['helper_ids'] = [];
     }
     if (isset($data['tags']) && !$data['tags']) {
         $data['tags'] = [];
     } else {
         if (isset($data['tags'])) {
             $data['tags'] = explode(',', $data['tags']);
         }
     }
     if (!empty($actionsSet[self::ACTION_CHANGE_STATUS]) && isset($data['task_status'])) {
         $saveData['task_status'] = (int) ($data['task_status'] ? $data['task_status'] : self::STATUS_NEW);
         if ((int) $data['task_status'] == self::STATUS_DONE) {
             $saveData['done_date'] = date('Y-m-d');
             if (isset($data['verifier_id']) && ($data['verifier_id'] == User::AUTO_VERIFY_USER_ID || isset($data['responsible_id']) && $authId == $data['verifier_id'] && $authId == $data['responsible_id'])) {
                 $saveData['task_status'] = self::STATUS_VERIFIED;
             }
         } elseif (isset($oldDataGeneral) && in_array($oldDataGeneral->getTask_status(), [self::STATUS_DONE, self::STATUS_VERIFIED]) && !in_array($data['task_status'], [self::STATUS_DONE, self::STATUS_VERIFIED])) {
             $saveData['done_date'] = null;
         }
         if ((int) $data['task_status'] == self::STATUS_DONE || (int) $data['task_status'] == self::STATUS_VERIFIED) {
             if (isset($data['responsible_id']) && $data['responsible_id'] == User::ANY_TEAM_MEMBER_USER_ID || !isset($data['responsible_id']) && $oldDataGeneral->getResponsibleId() == User::ANY_TEAM_MEMBER_USER_ID) {
                 $data['responsible_id'] = $authId;
             }
         }
     }
     if (!empty($data['last_update_time'])) {
         $saveData['last_update_time'] = $data['last_update_time'];
     } else {
         $data['last_update_time'] = $saveData['last_update_time'] = date('Y:m:d H:i:s');
     }
     if (!empty($actionsSet[self::ACTION_CHANGE_DETAILS])) {
         if (isset($data['title'])) {
             $saveData['title'] = $data['title'];
         }
         if (isset($data['task_type'])) {
             $saveData['task_type'] = (int) $data['task_type'];
         }
         if (isset($data['task_priority'])) {
             $saveData['priority'] = (int) $data['task_priority'];
         }
         if (isset($data['description'])) {
             $saveData['description'] = $data['description'];
         }
         if (isset($data['start_date'])) {
             $saveData['start_date'] = $data['start_date'] ? date('Y-m-d H:i:00', strtotime($data['start_date'])) : null;
         }
         if (isset($data['end_date'])) {
             $saveData['end_date'] = $data['end_date'] ? date('Y-m-d H:i:00', strtotime($data['end_date'])) : null;
         }
         if (isset($data['property_id'])) {
             $saveData['property_id'] = (int) $data['property_id'];
         }
         if (isset($data['building_id'])) {
             $saveData['building_id'] = (int) $data['building_id'];
         }
         if (isset($data['related_task'])) {
             $saveData['related_task'] = $data['related_task'] ? (int) $data['related_task'] : null;
         }
         if (isset($data['res_id'])) {
             $saveData['res_id'] = $data['res_id'] ? (int) $data['res_id'] : null;
         }
         if (isset($data['team_id'])) {
             $saveData['team_id'] = (int) $data['team_id'];
         }
         if (isset($data['following_team_id'])) {
             $saveData['following_team_id'] = (int) $data['following_team_id'];
         }
     }
     if (isset($data['team_id']) && ($data['team_id'] == TeamService::TEAM_CONTACT_CENTER || $data['task_type'] == self::TYPE_KEYFOB) && (!isset($data['responsible_id']) || $data['responsible_id'] == '')) {
         $data['responsible_id'] = User::ANY_TEAM_MEMBER_USER_ID;
     }
     if (isset($data['edit_id']) && $data['edit_id'] > 0) {
         $id = $data['edit_id'];
         if (isset($data['task_status']) && $data['task_status'] == self::STATUS_DONE && empty($actionsSet[self::ACTION_MANAGE_STAFF]) && $oldDataGeneral->getVerifierId() == User::AUTO_VERIFY_USER_ID) {
             $saveData['task_status'] = self::STATUS_VERIFIED;
         }
         $this->setComment($logger, $oldDataGeneral, $oldDataStaff, $data, $actionsSet);
         if (count($saveData)) {
             $taskDao->save($saveData, ['id' => (int) $id]);
         }
     } else {
         $data['creation_date'] = $saveData['creation_date'] = date('Y-m-d H:i:s');
         if (isset($data['responsible_id']) && $data['responsible_id'] == $authId) {
             $saveData['task_status'] = self::STATUS_VIEWED;
         }
         if (isset($data['creator_id']) && $data['creator_id'] == UserMain::SYSTEM_USER_ID) {
             $creatorId = $data['creator_id'];
         } else {
             $creatorId = $authId;
         }
         if (isset($data['is_hk'])) {
             $saveData['is_hk'] = $data['is_hk'];
         }
         if (isset($data['extra_inspection'])) {
             $saveData['extra_inspection'] = $data['extra_inspection'];
         }
         $id = $taskDao->save($saveData);
         $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_CREATOR, 'user_id' => $creatorId]);
     }
     if (!empty($actionsSet[self::ACTION_MANAGE_SUBTASKS]) && isset($data['subtask_description'])) {
         $existingSubtasks = $taskSubtaskDao->fetchAll(['task_id' => $id]);
         if (count($existingSubtasks)) {
             /** @var \DDD\Domain\Task\Subtask[] $existingSubtask */
             foreach ($existingSubtasks as $existingSubtask) {
                 // Remove subtask
                 if (empty($data['subtask_description']) || !isset($data['subtask_description'][$existingSubtask->getId()])) {
                     $taskSubtaskDao->delete(['id' => $existingSubtask->getId()]);
                     $logger->save(Logger::MODULE_TASK, $id, Logger::ACTION_TASK_SUBTASK, 'Removed subtask <b>' . $existingSubtask->getDescription() . '</b>');
                     // Update Subtask
                 } else {
                     if ($data['subtask_description'][$existingSubtask->getId()] != $existingSubtask->getDescription() || (bool) $data['subtask_status'][$existingSubtask->getId()] != (bool) $existingSubtask->getStatus()) {
                         $taskSubtaskDao->save(['description' => $data['subtask_description'][$existingSubtask->getId()], 'status' => $data['subtask_status'][$existingSubtask->getId()]], ['id' => $existingSubtask->getId()]);
                         if ($data['subtask_description'][$existingSubtask->getId()] != $existingSubtask->getDescription()) {
                             $logger->save(Logger::MODULE_TASK, $id, Logger::ACTION_TASK_SUBTASK, 'Changed subtask description from <b>' . $existingSubtask->getDescription() . '</b> to <b>' . $data['subtask_description'][$existingSubtask->getId()] . '</b>');
                         }
                         if ((bool) $data['subtask_status'][$existingSubtask->getId()] != (bool) $existingSubtask->getStatus()) {
                             $logger->save(Logger::MODULE_TASK, $id, Logger::ACTION_TASK_SUBTASK, 'Marked subtask <b>' . $data['subtask_description'][$existingSubtask->getId()] . '</b> ' . ($data['subtask_status'][$existingSubtask->getId()] ? 'Done' : 'Undone'));
                         }
                     }
                     unset($data['subtask_description'][$existingSubtask->getId()]);
                     unset($data['subtask_status'][$existingSubtask->getId()]);
                 }
             }
         }
         if (!empty($data['subtask_description']) && count($data['subtask_description'])) {
             foreach ($data['subtask_description'] as $index => $subtaskDescription) {
                 if ($subtaskDescription) {
                     $taskSubtaskDao->save(['task_id' => $id, 'description' => $subtaskDescription, 'status' => !empty($data['subtask_status'][$index]) ? 1 : 0]);
                     if ($id) {
                         $logger->save(Logger::MODULE_TASK, $id, Logger::ACTION_TASK_SUBTASK, 'Added subtask <b>' . $subtaskDescription . '</b>');
                     }
                 }
             }
         }
     }
     if (!empty($actionsSet[self::ACTION_COMMENT]) && !empty($data['comments'])) {
         $logger->save(Logger::MODULE_TASK, $id, Logger::ACTION_COMMENT, $data['comments']);
     }
     if (!empty($actionsSet[self::ACTION_MANAGE_STAFF])) {
         if (isset($data['responsible_id'])) {
             $taskStaffDao->delete(['task_id' => $id, 'type' => self::STAFF_RESPONSIBLE]);
             if ($data['responsible_id']) {
                 $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_RESPONSIBLE, 'user_id' => $data['responsible_id']]);
             }
         }
         if (isset($data['verifier_id'])) {
             $taskStaffDao->delete(['task_id' => $id, 'type' => self::STAFF_VERIFIER]);
             if ((!$data['verifier_id'] || $data['verifier_id'] == UserMain::SYSTEM_USER_ID) && (empty($oldDataGeneral) || isset($data['responsible_id']) && $oldDataGeneral->getResponsibleId() != $data['responsible_id'])) {
                 $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_VERIFIER, 'user_id' => $authId]);
             } else {
                 if ($data['verifier_id']) {
                     $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_VERIFIER, 'user_id' => $data['verifier_id']]);
                 }
             }
         }
         if (isset($data['follower_ids'])) {
             $taskStaffDao->delete(['task_id' => $id, 'type' => self::STAFF_FOLLOWER]);
             if (count($data['follower_ids'])) {
                 foreach ($data['follower_ids'] as $followerId) {
                     $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_FOLLOWER, 'user_id' => $followerId]);
                 }
             }
         }
         if (isset($data['helper_ids'])) {
             $taskStaffDao->delete(['task_id' => $id, 'type' => self::STAFF_HELPER]);
             if (count($data['helper_ids'])) {
                 foreach ($data['helper_ids'] as $helperId) {
                     $taskStaffDao->save(['task_id' => $id, 'type' => self::STAFF_HELPER, 'user_id' => $helperId]);
                 }
             }
         }
     }
     if (isset($data['tags']) && !empty($actionsSet[self::ACTION_TAG])) {
         $taskTagDao->delete(['task_id' => $id]);
         if (count($data['tags'])) {
             foreach ($data['tags'] as $tag) {
                 if (!is_numeric($tag)) {
                     $tagId = $tagDao->save(['name' => $tag, 'style' => 'label-grey']);
                 } else {
                     $tagId = $tag;
                 }
                 $taskTagDao->save(['task_id' => $id, 'tag_id' => $tagId]);
             }
         }
     }
     if (!empty($actionsSet[self::ACTION_MANAGE_ATTACHMENTS])) {
         if (!empty($data['attachment_names'])) {
             $uploadFolder = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_UPLOADS_ROOT . DirectoryStructure::FS_UPLOADS_TASK_ATTACHMENTS . date('Y/m/d', strtotime($data['creation_date'])) . '/' . $id . '/';
             $attachmentNames = explode('###', $data['attachment_names']);
             foreach ($attachmentNames as $attachmentName) {
                 if ($attachmentName) {
                     $destination = $uploadFolder . $attachmentName;
                     $response = Files::moveFile(DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_UPLOADS_ROOT . DirectoryStructure::FS_UPLOADS_TMP . $attachmentName, $destination);
                     if ($response) {
                         $attachmentsDao->save(['task_id' => $id, 'file' => pathinfo($destination, PATHINFO_BASENAME)]);
                     }
                 }
             }
         }
     }
     return $id;
 }
Пример #3
0
 /**
  * @param Request $request
  * @param int $buildingId
  * @return bool
  */
 public function uploadFile($request, $buildingId)
 {
     try {
         /** @var \DDD\Dao\ApartmentGroup\BuildingDetails $buildingDetailsDao */
         $buildingDetailsDao = $this->getServiceLocator()->get('dao_apartment_group_building_details');
         $files = $request->getFiles();
         $file = $files['map_attachment'];
         $attachmentExtension = pathinfo($file['name'], PATHINFO_EXTENSION);
         // file attached
         if ($file['error'] !== 4) {
             if ($file['error'] !== 0) {
                 throw new \Exception('File upload failed.');
             }
             if ($file['size'] > self::ATTACHMENT_SIZE * 1024 * 1024) {
                 throw new \Exception('File size is too big.');
             }
             if (in_array($attachmentExtension, ['php', 'phtml', 'html', 'js'])) {
                 throw new \Exception('Invalid file format.');
             }
             $folderPath = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_IMAGES_ROOT . DirectoryStructure::FS_IMAGES_BUILDING . $buildingId . '/map';
             if (!is_dir($folderPath)) {
                 if (!mkdir($folderPath, 0775, true)) {
                     throw new \Exception('Upload failed. Can\'t create directory.');
                 }
             }
             $oldData = $buildingDetailsDao->fetchOne(['apartment_group_id' => $buildingId], ['map_attachment']);
             $filename = 'ki_map_' . $buildingId . '_' . time();
             $filename = $filename . '.' . $attachmentExtension;
             $fullPath = $folderPath . '/' . $filename;
             // remove old uploaded file
             if ($oldData['map_attachment']) {
                 $oldFile = $folderPath . '/' . $oldData['map_attachment'];
                 @unlink($oldFile);
             }
             Files::moveFile($file['tmp_name'], $fullPath);
             $buildingDetailsDao->save(['map_attachment' => $filename], ['apartment_group_id' => $buildingId]);
             return true;
         }
     } catch (\Exception $ex) {
         return false;
     }
     return false;
 }
Пример #4
0
 public function officeSave($data, $files, $id, $global)
 {
     /**
      * @var UserManager $userManager
      */
     $officeManagerDao = $this->getOfficeManagerDao();
     $officeSectionManagerDao = $this->getOfficeSectionDao();
     $userManager = $this->getServiceLocator()->get('dao_user_user_manager');
     $data = (array) $data;
     $staffsId = [];
     if ($global) {
         $officeData = ['name' => $data['name'], 'description' => $data['description'], 'address' => $data['address'], 'office_manager_id' => !empty($data['office_manager_id']) ? $data['office_manager_id'] : null, 'it_manager_id' => !empty($data['it_manager_id']) ? $data['it_manager_id'] : null, 'finance_manager_id' => !empty($data['finance_manager_id']) ? $data['finance_manager_id'] : null, 'country_id' => $data['country_id'], 'city_id' => $data['city_id'], 'province_id' => $data['province_id'], 'phone' => $data['phone']];
         if ($id) {
             if ($data['delete_attachment']) {
                 $this->removeAttachment($id);
             }
             $officeData['modified_date'] = date('Y-m-d');
             $officeManagerDao->save($officeData, ['id' => (int) $id]);
             $preStaffs = $userManager->fetchAll(['reporting_office_id' => $id]);
             foreach ($preStaffs as $staffId) {
                 array_push($staffsId, $staffId->getId());
             }
             if (!isset($data['staff']) && !empty($staffsId)) {
                 foreach ($staffsId as $staff) {
                     $userManager->setOfficeUser(0, $staff);
                 }
             } elseif (empty($staffsId) && isset($data['staff'])) {
                 foreach ($data['staff'] as $staff) {
                     $userManager->setOfficeUser($id, $staff);
                 }
             } elseif (isset($data['staff']) && !empty($staffsId)) {
                 $sameStaffs = array_intersect($data['staff'], $staffsId);
                 $deleteStaffs = array_diff($staffsId, $sameStaffs);
                 $newStaffs = array_diff($data['staff'], $sameStaffs);
                 foreach ($newStaffs as $staff) {
                     $userManager->setOfficeUser($id, $staff);
                 }
                 foreach ($deleteStaffs as $staff) {
                     $userManager->setOfficeUser(0, $staff);
                 }
             }
             if (isset($data['section'])) {
                 $officeSectionList = $this->getOfficeSectionsList($id);
                 if (count($data['section'])) {
                     foreach ($data['section'] as $submittedOfficeSectionId => $submittedOfficeSectionName) {
                         if (empty(trim($submittedOfficeSectionName))) {
                             continue;
                         }
                         // If section id found then it is an update else it is a new office section
                         if (array_key_exists($submittedOfficeSectionId, $officeSectionList)) {
                             if (trim($submittedOfficeSectionName) == $officeSectionList[$submittedOfficeSectionId]) {
                                 continue;
                             }
                             // Update name
                             $officeSectionManagerDao->save(['name' => $submittedOfficeSectionName], ['id' => $submittedOfficeSectionId]);
                         } else {
                             // Create office section
                             $officeSectionManagerDao->save(['name' => $submittedOfficeSectionName, 'office_id' => $id, 'disable' => 0]);
                         }
                     }
                 }
             }
         } else {
             $officeData['created_date'] = date('Y-m-d');
             $officeData['modified_date'] = null;
             $id = $officeManagerDao->save($officeData);
             if ($id > 0) {
                 /** @var \DDD\Dao\Textline\Apartment $productTexlineDao */
                 $productTexlineDao = $this->getServiceLocator()->get('dao_textline_apartment');
                 $receptionEntryTextLine = ['entity_id' => $id, 'entity_type' => Translation::PRODUCT_TEXTLINE_TYPE_OFFICE_RECEPTION_ENTRY, 'type' => Translation::PRODUCT_TYPE_OFFICE];
                 $receptionEntryTextLineId = $productTexlineDao->save($receptionEntryTextLine);
                 $officeManagerDao->save(['textline_id' => $receptionEntryTextLineId], ['id' => $id]);
                 if (isset($data['staff'])) {
                     foreach ($data['staff'] as $staff) {
                         $userManager->setOfficeUser($id, $staff);
                     }
                 }
                 if (isset($data['office_manager_id'])) {
                     $userManager->setOfficeUser($id, $data['office_manager_id']);
                 }
                 if (isset($data['finance_manager_id'])) {
                     $userManager->setOfficeUser($id, $data['finance_manager_id']);
                 }
                 if (isset($data['it_manager_id'])) {
                     $userManager->setOfficeUser($id, $data['it_manager_id']);
                 }
                 if (isset($data['section'])) {
                     foreach ($data['section'] as $section) {
                         if (strlen($section) > 0) {
                             $officeSectionManagerDao->save(['name' => $section, 'office_id' => $id]);
                         }
                     }
                 }
             }
         }
         if (!empty($files) && !empty($files['map_attachment'])) {
             $file = $files['map_attachment'];
             $attachmentPath = DirectoryStructure::FS_IMAGES_OFFICE . $id;
             $fullAttachmentPath = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_IMAGES_ROOT . $attachmentPath;
             if (!is_dir($fullAttachmentPath)) {
                 mkdir($fullAttachmentPath, 0775, true);
             }
             $oldData = $officeManagerDao->fetchOne(['id' => $id], ['map_attachment']);
             // remove old uploaded file
             if ($oldData->getMapAttachment()) {
                 $oldFile = $fullAttachmentPath . '/' . $oldData->getMapAttachment();
                 @unlink($oldFile);
             }
             $fileExtention = pathinfo($file['name'], PATHINFO_EXTENSION);
             if (!in_array(strtolower($fileExtention), ['jpg', 'jpeg', 'png', 'gif'])) {
                 return false;
             }
             $fileNewName = 'map_attachment.' . $fileExtention;
             Files::moveFile($file['tmp_name'], $fullAttachmentPath . '/' . $fileNewName);
             $officeManagerDao->save(['map_attachment' => $fileNewName], ['id' => $id]);
         }
         return $id;
     }
     return false;
 }
Пример #5
0
 private function uploadIncidentPhoto($entityId, $file)
 {
     try {
         $attachmentsDao = $this->getServiceLocator()->get('dao_task_attachments');
         $taskDao = new \DDD\Dao\Task\Task($this->getServiceLocator(), 'ArrayObject');
         $taskDetails = $taskDao->fetchOne(['id' => $entityId]);
         if ($taskDetails) {
             $uploadFolder = DirectoryStructure::FS_GINOSI_ROOT . DirectoryStructure::FS_UPLOADS_ROOT . DirectoryStructure::FS_UPLOADS_TASK_ATTACHMENTS . date('Y/m/d', strtotime($taskDetails['creation_date'])) . '/' . $entityId . '/';
             $destination = $uploadFolder . pathinfo($file['name'], PATHINFO_FILENAME) . '_' . round(microtime(true) * 1000) . '.' . pathinfo($file['name'], PATHINFO_EXTENSION);
             $response = Files::moveFile($file['tmp_name'], $destination);
             if ($response) {
                 $attachmentsDao->save(['task_id' => $entityId, 'file' => pathinfo($destination, PATHINFO_BASENAME)]);
                 return true;
             }
         }
         return false;
     } catch (\Exception $e) {
         return false;
     }
 }