Пример #1
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $emptyName = false;
     $allIssueTypes = $this->getRepository(IssueType::class)->getAll($session->get('client/id'));
     if ($request->request->has('new_issue_type_screen_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyName = true;
         }
         if (!$emptyName) {
             $issueTypeScreenScheme = new IssueTypeScreenScheme($session->get('client/id'), $name, $description);
             $currentDate = Util::getServerCurrentDateTime();
             $issueTypeScreenSchemeId = $issueTypeScreenScheme->save($currentDate);
             $issueTypes = $this->getRepository(IssueType::class)->getAll($session->get('client/id'));
             while ($issueType = $issueTypes->fetch_array(MYSQLI_ASSOC)) {
                 $this->getRepository(IssueTypeScreenScheme::class)->addData($issueTypeScreenSchemeId, $issueType['id'], $currentDate);
             }
             $this->getLogger()->addInfo('ADD Yongo Issue Type Screen Scheme ' . $name, $this->getLoggerContext());
             return new RedirectResponse('/yongo/administration/screens/issue-types');
         }
     }
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Issue Type Screen Scheme';
     return $this->render(__DIR__ . '/../../../../Resources/views/administration/screen/issue_type_scheme/Add.php', get_defined_vars());
 }
Пример #2
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $issueTypeScreenSchemeId = $request->get('id');
     $issueTypeScreenScheme = $this->getRepository(IssueTypeScreenScheme::class)->getMetaDataById($issueTypeScreenSchemeId);
     if ($issueTypeScreenScheme['client_id'] != $session->get('client/id')) {
         return new RedirectResponse('/general-settings/bad-link-access-denied');
     }
     $emptyName = false;
     $duplicateName = false;
     if ($request->request->has('copy_issue_type_screen_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyName = true;
         }
         $duplicateIssueTypeScreenScheme = $this->getRepository(IssueTypeScreenScheme::class)->getMetaDataByNameAndClientId($session->get('client/id'), mb_strtolower($name));
         if ($duplicateIssueTypeScreenScheme) {
             $duplicateName = true;
         }
         if (!$emptyName && !$duplicateName) {
             $copiedIssueTypeScreenScheme = new IssueTypeScreenScheme($session->get('client/id'), $name, $description);
             $currentDate = Util::getServerCurrentDateTime();
             $copiedIssueTypeScreenSchemeId = $copiedIssueTypeScreenScheme->save($currentDate);
             $issueTypeScreenSchemeData = $this->getRepository(IssueTypeScreenScheme::class)->getDataByIssueTypeScreenSchemeId($issueTypeScreenSchemeId);
             while ($issueTypeScreenSchemeData && ($data = $issueTypeScreenSchemeData->fetch_array(MYSQLI_ASSOC))) {
                 $copiedIssueTypeScreenScheme->addDataComplete($copiedIssueTypeScreenSchemeId, $data['issue_type_id'], $data['screen_scheme_id'], $currentDate);
             }
             $this->getLogger()->addInfo('Copy Yongo Issue Type Scheme ' . $issueTypeScreenScheme['name'], $this->getLoggerContext());
             return new RedirectResponse('/yongo/administration/screens/issue-types');
         }
     }
     $menuSelectedCategory = 'issue';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Copy Issue Type Scheme';
     return $this->render(__DIR__ . '/../../../../Resources/views/administration/screen/issue_type_scheme/Copy.php', get_defined_vars());
 }