Beispiel #1
0
 public function actionCreateCustomFieldsForOpportunitiesModule()
 {
     if (Yii::app()->user->userModel->username != 'super') {
         throw new NotSupportedException();
     }
     DesignerTestHelper::createCheckBoxAttribute('checkBox', false, 'Opportunity');
     DesignerTestHelper::createDateTimeAttribute('dateTime', false, 'Opportunity');
     DesignerTestHelper::createIntegerAttribute('integers', false, 'Opportunity');
     DesignerTestHelper::createMultiSelectDropDownAttribute('multiSelectDropDown', false, 'Opportunity');
     DesignerTestHelper::createTagCloudAttribute('tagCloud', false, 'Opportunity');
     DesignerTestHelper::createPhoneAttribute('phone', false, 'Opportunity');
     DesignerTestHelper::createRadioDropDownAttribute('radioDropDown', false, 'Opportunity');
     DesignerTestHelper::createUrlAttribute('url', false, 'Opportunity');
 }
 public function actionCreateCustomFieldsForContractsModule()
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     DesignerTestHelper::createCheckBoxAttribute('checkBox', false, 'Contract');
     DesignerTestHelper::createDateTimeAttribute('dateTime', false, 'Contract');
     DesignerTestHelper::createIntegerAttribute('integers', false, 'Contract');
     DesignerTestHelper::createMultiSelectDropDownAttribute('multiSelectDropDown', false, 'Contract');
     DesignerTestHelper::createTagCloudAttribute('tagCloud', false, 'Contract');
     DesignerTestHelper::createPhoneAttribute('phone', false, 'Contract');
     DesignerTestHelper::createRadioDropDownAttribute('radioDropDown', false, 'Contract');
     DesignerTestHelper::createUrlAttribute('url', false, 'Contract');
 }
 public function testRenderMappingRulesElementForDecimalAttributeWithPrecision()
 {
     Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
     DesignerTestHelper::createDecimalAttribute('decimal', false, 'Account');
     ImportRules::resetCache();
     $data = ImportModelTestItemImportRules::getMappableAttributeIndicesAndDerivedTypes();
     $mappingFormLayoutUtil = ImportToMappingFormLayoutUtil::make('ImportModelTestItem', new ZurmoActiveForm(), 'ImportModelTestItem', $data);
     $columnName = 'SampleColumn';
     //Test Decimal/Float attribute that has precision
     $content = $mappingFormLayoutUtil->renderMappingRulesElements($columnName, 'decimalCstm', 'Accounts', 'importColumn', array());
     $this->assertTrue(stripos($content, '<h4>Rules</h4>') !== false);
 }
 public function testSuperUserConvertActionWithTagCloud()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     Account::deleteAll();
     DesignerTestHelper::createTagCloudAttribute('tagcloud', false, 'Account');
     $this->setGetArray(array('moduleClassName' => 'AccountsModule', 'viewClassName' => 'AccountConvertToView'));
     $layout = array('panels' => array(array('title' => 'Panel Title', 'panelDetailViewOnly' => 1, 'rows' => array(array('cells' => array(array('element' => 'name'))), array('cells' => array(array('element' => 'tagcloudCstm')))))));
     $this->setPostArray(array('save' => 'Save', 'layout' => $layout));
     $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
     $this->assertContains('Layout saved successfully', $content);
     $lead = LeadTestHelper::createLeadbyNameForOwner('convertwithtagcloud', $super);
     $this->setGetArray(array('id' => $lead->id));
     $this->setPostArray(array('Account' => array('name' => 'mynewaccountfromleadtagcloudconvert', 'tagcloudCstm' => array('values' => 'English,French'))));
     $this->assertEquals(0, Account::getCount());
     $this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
     $this->assertEquals(1, Account::getCount());
     $accounts = Account::getAll();
     $this->assertEquals('English, French', strval($accounts[0]->tagcloudCstm));
 }