public function testParseWorkflowFilterFriendlyName() { $json = "{\n\t\t\t\t\"task_routing\":{\n\t\t\t\t \"filters\":[\n\t\t\t\t\t {\n\t\t\t\t\t\t\"expression\":\"type=='sales'\",\n\t\t\t\t\t\t\"targets\":[\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQf6724bd5005b30eeb6ea990c3e59e536\",\n\t\t\t\t\t\t\t \"priority\": 5,\n\t\t\t\t\t\t\t \"timeout\": 30\n\t\t\t\t\t\t },\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQf6724bd5005b30eeb6ea990c3e59e536\",\n\t\t\t\t\t\t\t \"priority\": 10\n\t\t\t\t\t\t }\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"filter_friendly_name\":\"Sales\"\n\t\t\t\t\t },\n\t\t\t\t\t {\n\t\t\t\t\t\t\"expression\":\"type=='marketing'\",\n\t\t\t\t\t\t\"targets\":[\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQ8c62f84b61ccfa6a333757cd508f0aae\",\n\t\t\t\t\t\t\t \"priority\": 1,\n\t\t\t\t\t\t\t \"timeout\": 120\n\t\t\t\t\t\t },\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQ8c62f84b61ccfa6a333757cd508f0aae\",\n\t\t\t\t\t\t\t \"priority\": 3\n\t\t\t\t\t\t }\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"filter_friendly_name\":\"Marketing\"\n\t\t\t\t\t },\n\t\t\t\t\t {\n\t\t\t\t\t\t\"expression\":\"type=='support'\",\n\t\t\t\t\t\t\"targets\":[\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQ5940dc0da87eaf6e3321d62041d4403b\",\n\t\t\t\t\t\t\t \"priority\": 10,\n\t\t\t\t\t\t\t \"timeout\": 30\n\t\t\t\t\t\t },\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \"queue\":\"WQ5940dc0da87eaf6e3321d62041d4403b\",\n\t\t\t\t\t\t\t \"priority\": 15\n\t\t\t\t\t\t }\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"filter_friendly_name\":\"Support\"\n\t\t\t\t\t }\n\t\t\t\t ],\n\t\t\t\t \"default_filter\":{\n\t\t\t\t\t \"queue\":\"WQ6d29383312b24bd898a8df32779fc043\"\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}"; $config = WorkflowConfiguration::fromJson($json); $taskRoutingConfig = WorkflowConfiguration::parse($json)->task_routing; $this->assertEquals(3, count($taskRoutingConfig->filters)); $this->assertEquals(3, count($config->filters)); $this->assertEquals(1, count($config->default_filter)); // sales assertions $this->assertEquals("type=='sales'", $config->filters[0]->expression); $this->assertEquals("Sales", $config->filters[0]->friendly_name); $this->assertEquals(2, count($config->filters[0]->targets)); $this->assertEquals("WQf6724bd5005b30eeb6ea990c3e59e536", $config->filters[0]->targets[0]->queue); $this->assertEquals(5, $config->filters[0]->targets[0]->priority); $this->assertEquals(30, $config->filters[0]->targets[0]->timeout); $this->assertEquals("WQf6724bd5005b30eeb6ea990c3e59e536", $config->filters[0]->targets[1]->queue); $this->assertEquals(10, $config->filters[0]->targets[1]->priority); // marketing assertions $this->assertEquals("type=='marketing'", $config->filters[1]->expression); $this->assertEquals("Marketing", $config->filters[1]->friendly_name); $this->assertEquals(2, count($config->filters[1]->targets)); $this->assertEquals("WQ8c62f84b61ccfa6a333757cd508f0aae", $config->filters[1]->targets[0]->queue); $this->assertEquals(1, $config->filters[1]->targets[0]->priority); $this->assertEquals(120, $config->filters[1]->targets[0]->timeout); $this->assertEquals("WQ8c62f84b61ccfa6a333757cd508f0aae", $config->filters[1]->targets[1]->queue); $this->assertEquals(3, $config->filters[1]->targets[1]->priority); // support assertions $this->assertEquals("type=='support'", $config->filters[2]->expression); $this->assertEquals("Support", $config->filters[2]->friendly_name); $this->assertEquals(2, count($config->filters[2]->targets)); $this->assertEquals("WQ5940dc0da87eaf6e3321d62041d4403b", $config->filters[2]->targets[0]->queue); $this->assertEquals(10, $config->filters[2]->targets[0]->priority); $this->assertEquals(30, $config->filters[2]->targets[0]->timeout); $this->assertEquals("WQ5940dc0da87eaf6e3321d62041d4403b", $config->filters[2]->targets[1]->queue); $this->assertEquals(15, $config->filters[2]->targets[1]->priority); // default filter $this->assertEquals("WQ6d29383312b24bd898a8df32779fc043", $config->default_filter->queue); }
/** * * Saves SystemSettings to additional Tables in database * @param sfWebRequest $request * @return <type> */ public function executeSaveSystem(sfWebRequest $request) { $sysObj = new SystemSetting(); $data = $request->getPostParameters(); // save auth settings if (isset($data['authentication_type'])) { if($data['authentication_type'] == 'DBONLY') { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabase($data); } elseif ($data['authentication_type'] == 'DATABASE_LDAP') { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndLDAP($data); } else { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndOpenId($data); } } // save systemsetting if (isset($data['systemsetting_language'])) { $data = $sysObj->buildSystemSetting($data); SystemConfigurationTable::instance()->updateSystemConfiguration($data); } // store Email tab if (isset($data['emailtab_emailtype'])) { $data = $sysObj->buildEmailSetting($data); EmailConfigurationTable::instance()->updateEmailConfiguration($data); } // store user tab if (isset($data['userTab_defaultdurationtype'])) { $data = $sysObj->buildUserSetting($data); UserConfigurationTable::instance()->updateUserConfiguration($data); } // save authorization if(isset($data['authorizationTab_hiddenpanel'])) { AuthorizationConfigurationTable::instance()->setAuthorizationConfigurationToNull(); $items = $data['authorizationTab']; foreach ($items as $item => $key) { $item_data = array(); $item_data = explode('__', $item); AuthorizationConfigurationTable::instance()->updateAuthorizationConfigurationById($item_data[0],$item_data[1]); } } // save theme if(isset($data['guitab_theme'])) { UserConfigurationTable::instance()->updateTheme($data['guitab_theme']); } // store useragent settings tab if(isset($data['useragent_useragentsettings']) OR isset($data['useragent_useragentcreation'])) { $data = $sysObj->prepareUserAgentData($data); SystemConfigurationTable::instance()->updateUserAgent($data); } else { $data['useragent_useragentsettings'] = 0; $data['useragent_useragentcreation'] = 0; $data['writeDays'] = 0; } SystemConfigurationTable::instance()->updateUserAgent($data); // save worklfow config WorkflowConfigurationTable::instance()->deleteSettings(); $worklfow = $data['worklfow']; $position = 1; foreach($worklfow as $item => $key) { $workflow = new WorkflowConfiguration(); $workflow->setColumntext($item); $workflow->setIsactive($key); $workflow->setPosition($position++); $workflow->save(); } $this->renderText('{success:true}'); return sfView::NONE; }