Exemplo n.º 1
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $emptyName = false;
     if ($request->request->has('add_notification_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyName = true;
         }
         if (!$emptyName) {
             $currentDate = Util::getServerCurrentDateTime();
             $notificationScheme = new NotificationScheme($session->get('client/id'), $name, $description);
             $notificationSchemeId = $notificationScheme->save($currentDate);
             $this->getLogger()->addInfo('ADD Yongo Notification Scheme ' . $name, $this->getLoggerContext());
             return new RedirectResponse('/yongo/administration/notification-schemes');
         }
     }
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Issue Notification Scheme';
     $menuSelectedCategory = 'issue';
     return $this->render(__DIR__ . '/../../../Resources/views/administration/notification_scheme/Add.php', get_defined_vars());
 }
Exemplo n.º 2
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $notificationSchemeId = $request->get('id');
     $notificationScheme = $this->getRepository(NotificationScheme::class)->getMetaDataById($notificationSchemeId);
     if ($notificationScheme['client_id'] != $session->get('client/id')) {
         return new RedirectResponse('/general-settings/bad-link-access-denied');
     }
     $emptyName = false;
     $duplicateName = false;
     if ($request->request->has('copy_notification_scheme')) {
         $name = Util::cleanRegularInputField($request->request->get('name'));
         $description = Util::cleanRegularInputField($request->request->get('description'));
         if (empty($name)) {
             $emptyName = true;
         }
         $duplicateNotificationScheme = $this->getRepository(NotificationScheme::class)->getMetaDataByNameAndClientId($session->get('client/id'), mb_strtolower($name));
         if ($duplicateNotificationScheme) {
             $duplicateName = true;
         }
         if (!$emptyName && !$duplicateName) {
             $copiedNotificationScheme = new NotificationScheme($session->get('client/id'), $name, $description);
             $currentDate = Util::getServerCurrentDateTime();
             $copiedNotificationSchemeId = $copiedNotificationScheme->save($currentDate);
             $notificationSchemeData = $this->getRepository(NotificationScheme::class)->getDataByNotificationSchemeId($notificationSchemeId);
             while ($notificationSchemeData && ($data = $notificationSchemeData->fetch_array(MYSQLI_ASSOC))) {
                 $copiedNotificationScheme->addDataRaw($copiedNotificationSchemeId, $data['event_id'], $data['permission_role_id'], $data['group_id'], $data['user_id'], $data['current_assignee'], $data['reporter'], $data['current_user'], $data['project_lead'], $data['component_lead'], $data['all_watchers'], $data['user_picker_multiple_selection'], $currentDate);
             }
             $this->getLogger()->addInfo('Copy Yongo Notification Scheme ' . $notificationScheme['name'], $this->getLoggerContext());
             return new RedirectResponse('/yongo/administration/notification-schemes');
         }
     }
     $menuSelectedCategory = 'issue';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Copy Notification Scheme';
     return $this->render(__DIR__ . '/../../../Resources/views/administration/notification_scheme/Copy.php', get_defined_vars());
 }