public function indexAction(Request $request, SessionInterface $session) { Util::checkUserIsLoggedInAndRedirect(); $session->set('selected_product_id', SystemProduct::SYS_PRODUCT_YONGO); $emptyName = false; if ($request->request->has('add_field_configuration')) { $name = Util::cleanRegularInputField($request->request->get('name')); $description = Util::cleanRegularInputField($request->request->get('description')); if (empty($name)) { $emptyName = true; } if (!$emptyName) { $fieldConfiguration = new FieldConfiguration($session->get('client/id'), $name, $description); $currentDate = Util::getServerCurrentDateTime(); $fieldConfiguration->save($currentDate); $this->getLogger()->addInfo('ADD Yongo Field Configuration ' . $name, $this->getLoggerContext()); return new RedirectResponse('/yongo/administration/field-configurations'); } } $menuSelectedCategory = 'issue'; $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Add Field Configuration Scheme'; return $this->render(__DIR__ . '/../../../../Resources/views/administration/field/configuration/Add.php', get_defined_vars()); }
public function indexAction(Request $request, SessionInterface $session) { Util::checkUserIsLoggedInAndRedirect(); $fieldConfigurationId = $request->get('id'); $fieldConfiguration = $this->getRepository(FieldConfiguration::class)->getMetaDataById($fieldConfigurationId); if ($fieldConfiguration['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')) { $name = Util::cleanRegularInputField($request->request->get('name')); $description = Util::cleanRegularInputField($request->request->get('description')); if (empty($name)) { $emptyName = true; } $duplicateFieldConfiguration = $this->getRepository(FieldConfiguration::class)->getMetaDataByNameAndClientId($session->get('client/id'), mb_strtolower($name)); if ($duplicateFieldConfiguration) { $duplicateName = true; } if (!$emptyName && !$duplicateName) { $copiedFieldConfiguration = new FieldConfiguration($session->get('client/id'), $name, $description); $currentDate = Util::getServerCurrentDateTime(); $copiedFieldConfigurationId = $copiedFieldConfiguration->save($currentDate); $fieldConfigurationData = $this->getRepository(FieldConfiguration::class)->getDataByConfigurationId($fieldConfigurationId); while ($fieldConfigurationData && ($data = $fieldConfigurationData->fetch_array(MYSQLI_ASSOC))) { $copiedFieldConfiguration->addCompleteData($copiedFieldConfigurationId, $data['field_id'], $data['visible_flag'], $data['required_flag'], $data['field_description']); } $this->getLogger()->addInfo('Copy Yongo Field Configuration ' . $fieldConfiguration['name'], $this->getLoggerContext()); return new RedirectResponse('/yongo/administration/field-configurations'); } } $menuSelectedCategory = 'issue'; $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Copy Field Configuration'; return $this->render(__DIR__ . '/../../../../Resources/views/administration/field/configuration/Copy.php', get_defined_vars()); }