public function indexAction(Request $request, SessionInterface $session) { Util::checkUserIsLoggedInAndRedirect(); $emptyName = false; if ($request->request->has('add_field_configuration_scheme')) { $name = Util::cleanRegularInputField($request->request->get('name')); $description = Util::cleanRegularInputField($request->request->get('description')); if (empty($name)) { $emptyName = true; } if (!$emptyName) { $fieldConfigurationScheme = new FieldConfigurationScheme($session->get('client/id'), $name, $description); $currentDate = Util::getServerCurrentDateTime(); $fieldConfigurationSchemeId = $fieldConfigurationScheme->save($currentDate); $issueTypes = $this->getRepository(IssueType::class)->getAll($session->get('client/id')); while ($issueType = $issueTypes->fetch_array(MYSQLI_ASSOC)) { $this->getRepository(FieldConfigurationScheme::class)->addData($fieldConfigurationSchemeId, null, $issueType['id'], $currentDate); } $this->getLogger()->addInfo('ADD Yongo Field Configuration Scheme ' . $name, $this->getLoggerContext()); return new RedirectResponse('/yongo/administration/field-configurations/schemes'); } } $menuSelectedCategory = 'issue'; $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Event'; return $this->render(__DIR__ . '/../../../../Resources/views/administration/field/configuration_scheme/Add.php', get_defined_vars()); }
public function indexAction(Request $request, SessionInterface $session) { Util::checkUserIsLoggedInAndRedirect(); $fieldConfigurationSchemeId = $request->get('id'); $fieldConfigurationScheme = $this->getRepository(FieldConfigurationScheme::class)->getMetaDataById($fieldConfigurationSchemeId); if ($fieldConfigurationScheme['client_id'] != $session->get('client/id')) { return new RedirectResponse('/general-settings/bad-link-access-denied'); } $emptyName = false; $duplicateName = false; if ($request->request->has('copy_field_configuration_scheme')) { $name = Util::cleanRegularInputField($request->request->get('name')); $description = Util::cleanRegularInputField($request->request->get('description')); if (empty($name)) { $emptyName = true; } $duplicateFieldConfigurationScheme = $this->getRepository(FieldConfigurationScheme::class)->getMetaDataByNameAndClientId($session->get('client/id'), mb_strtolower($name)); if ($duplicateFieldConfigurationScheme) { $duplicateName = true; } if (!$emptyName && !$duplicateName) { $currentDate = Util::getServerCurrentDateTime(); $copiedFieldConfigurationScheme = new FieldConfigurationScheme($session->get('client/id'), $name, $description); $copiedFieldConfigurationSchemeId = $copiedFieldConfigurationScheme->save($currentDate); $fieldConfigurationSchemeData = $this->getRepository(FieldConfigurationScheme::class)->getDataByFieldConfigurationSchemeId($fieldConfigurationSchemeId); while ($fieldConfigurationSchemeData && ($data = $fieldConfigurationSchemeData->fetch_array(MYSQLI_ASSOC))) { $copiedFieldConfigurationScheme->addData($copiedFieldConfigurationSchemeId, $data['field_configuration_id'], $data['issue_type_id'], $currentDate); } $this->getLogger()->addInfo('Copy Yongo Field Configuration Scheme ' . $fieldConfigurationScheme['name'], $this->getLoggerContext()); return new RedirectResponse('/yongo/administration/field-configurations/schemes'); } } $menuSelectedCategory = 'issue'; $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Copy Field Configuration Scheme'; return $this->render(__DIR__ . '/../../../../Resources/views/administration/field/configuration_scheme/Copy.php', get_defined_vars()); }