Exemple #1
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $issueTypeSchemeId = $request->get('id');
     $type = $request->get('type');
     $issueTypeScheme = $this->getRepository(IssueTypeScheme::class)->getMetaDataById($issueTypeSchemeId);
     if ($issueTypeScheme['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_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyName = true;
         }
         $duplicateIssueTypeScheme = $this->getRepository(IssueTypeScheme::class)->getMetaDataByNameAndClientId($session->get('client/id'), mb_strtolower($name));
         if ($duplicateIssueTypeScheme) {
             $duplicateName = true;
         }
         if (!$emptyName && !$duplicateName) {
             $copiedIssueTypeScheme = new IssueTypeScheme($session->get('client/id'), $name, $description, $type);
             $currentDate = Util::getServerCurrentDateTime();
             $copiedIssueTypeSchemeId = $copiedIssueTypeScheme->save($currentDate);
             $issueTypeSchemeData = $this->getRepository(IssueTypeScheme::class)->getDataById($issueTypeSchemeId);
             while ($issueTypeSchemeData && ($data = $issueTypeSchemeData->fetch_array(MYSQLI_ASSOC))) {
                 $copiedIssueTypeScheme->addData($copiedIssueTypeSchemeId, $data['issue_type_id'], $currentDate);
             }
             $this->getLogger()->addInfo('Copy Yongo Issue Type Scheme ' . $issueTypeScheme['name'], $this->getLoggerContext());
             if ('workflow' == $type) {
                 return new RedirectResponse('/yongo/administration/workflows/issue-type-schemes');
             }
             return new RedirectResponse('/yongo/administration/issue-type-schemes');
         }
     }
     $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/issue/issue_type_scheme/Copy.php', get_defined_vars());
 }
Exemple #2
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $type = $request->get('type');
     if ($type == 'project') {
         $buttonLabel = 'Create Issue Type Scheme';
     } else {
         $buttonLabel = 'Create Workflow Issue Type Scheme';
     }
     $emptyIssueTypeName = false;
     $issueTypeExists = false;
     $allIssueTypes = $this->getRepository(IssueType::class)->getAll($session->get('client/id'));
     if ($request->request->has('new_type_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyIssueTypeName = true;
         }
         if (!$emptyIssueTypeName) {
             $issueTypeScheme = new IssueTypeScheme($session->get('client/id'), $name, $description, $type);
             $currentDate = Util::getServerCurrentDateTime();
             $issueTypeSchemeId = $issueTypeScheme->save($currentDate);
             foreach ($request->request as $key => $value) {
                 if (substr($key, 0, 11) == 'issue_type_') {
                     $issueTypeId = str_replace('issue_type_', '', $key);
                     $this->getRepository(IssueTypeScheme::class)->addData($issueTypeSchemeId, $issueTypeId, $currentDate);
                 }
             }
             $this->getLogger()->addInfo('ADD Yongo Issue Type Scheme ' . $name, $this->getLoggerContext());
             if ($type == 'project') {
                 return new RedirectResponse('/yongo/administration/issue-type-schemes');
             }
             return new RedirectResponse('/yongo/administration/workflows/issue-type-schemes');
         }
     }
     $menuSelectedCategory = 'issue';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Issue Type Scheme';
     return $this->render(__DIR__ . '/../../../Resources/views/administration/issue/issue_type_scheme/Add.php', get_defined_vars());
 }