当前位置: 首页>>代码示例>>PHP>>正文


PHP Contract::getById方法代码示例

本文整理汇总了PHP中Contract::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Contract::getById方法的具体用法?PHP Contract::getById怎么用?PHP Contract::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contract的用法示例。


在下文中一共展示了Contract::getById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUpdateAttributeValueAction

 /**
  * @depends testSuperUserKanbanBoardListAction
  */
 public function testUpdateAttributeValueAction()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $this->assertEquals('Negotiating', self::$contract->stage->value);
     //actionUpdateAttributeValue($id, $attribute, $value)
     $this->setGetArray(array('id' => self::$contract->id, 'attribute' => 'stage', 'value' => 'Verbal'));
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default/updateAttributeValue', true);
     $id = self::$contract->id;
     self::$contract->forget();
     self::$contract = Contract::getById($id);
     $this->assertEquals('Verbal', self::$contract->stage->value);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:ContractsSuperUserKanbanBoardWalkthroughTest.php

示例2: actionCopy

 public function actionCopy($id)
 {
     $copyToContract = new Contract();
     $postVariableName = get_class($copyToContract);
     if (!isset($_POST[$postVariableName])) {
         $contract = Contract::getById((int) $id);
         ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($contract);
         ZurmoCopyModelUtil::copy($contract, $copyToContract);
     }
     $this->processEdit($copyToContract);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:DefaultController1.php

示例3: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Test all default controller actions that do not require any POST/GET variables to be passed.
     //This does not include portlet controller actions.
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default');
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default/index');
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default/create');
     $content = $this->runControllerWithNoExceptionsAndGetContent('contracts/default/list');
     $this->assertContains('anyMixedAttributes', $content);
     //Test the search or paging of the listview.
     Yii::app()->clientScript->reset();
     //to make sure old js doesn't make it to the UI
     $this->setGetArray(array('ajax' => 'list-view'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('contracts/default/list');
     $this->assertNotContains('anyMixedAttributes', $content);
     $this->resetGetArray();
     //Default Controller actions requiring some sort of parameter via POST or GET
     //Load Model Edit Views
     $contracts = Contract::getAll();
     $this->assertEquals(12, count($contracts));
     $superContractId = self::getModelIdByModelNameAndName('Contract', 'superOpp');
     $superContractId2 = self::getModelIdByModelNameAndName('Contract', 'superOpp2');
     $superContractId3 = self::getModelIdByModelNameAndName('Contract', 'superOpp3');
     $superContractId4 = self::getModelIdByModelNameAndName('Contract', 'superOpp4');
     $superContractId5 = self::getModelIdByModelNameAndName('Contract', 'superOpp5');
     $superContractId6 = self::getModelIdByModelNameAndName('Contract', 'superOpp6');
     $superContractId7 = self::getModelIdByModelNameAndName('Contract', 'superOpp7');
     $superContractId8 = self::getModelIdByModelNameAndName('Contract', 'superOpp8');
     $superContractId9 = self::getModelIdByModelNameAndName('Contract', 'superOpp9');
     $superContractId10 = self::getModelIdByModelNameAndName('Contract', 'superOpp10');
     $superContractId11 = self::getModelIdByModelNameAndName('Contract', 'superOpp11');
     $superContractId12 = self::getModelIdByModelNameAndName('Contract', 'superOpp12');
     $this->setGetArray(array('id' => $superContractId));
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default/edit');
     //Save Contract.
     $superContract = Contract::getById($superContractId);
     $this->assertEquals(null, $superContract->description);
     $this->setPostArray(array('Contract' => array('description' => '456765421')));
     $this->runControllerWithRedirectExceptionAndGetContent('contracts/default/edit');
     $superContract = Contract::getById($superContractId);
     $this->assertEquals('456765421', $superContract->description);
     //Test having a failed validation on the Contract during save.
     $this->setGetArray(array('id' => $superContractId));
     $this->setPostArray(array('Contract' => array('name' => '')));
     $content = $this->runControllerWithNoExceptionsAndGetContent('contracts/default/edit');
     $this->assertContains('Name cannot be blank', $content);
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superContractId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('contracts/default/details');
     //Load Model MassEdit Views.
     //MassEdit view for single selected ids
     $this->setGetArray(array('selectedIds' => '4,5,6,7,8,9', 'selectAll' => ''));
     // Not Coding Standard
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('contracts/default/massEdit');
     $this->assertContains('<strong>6</strong>&#160;records selected for updating', $content);
     //MassEdit view for all result selected ids
     $this->setGetArray(array('selectAll' => '1'));
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('contracts/default/massEdit');
     $this->assertContains('<strong>12</strong>&#160;records selected for updating', $content);
     //save Model MassEdit for selected Ids
     //Test that the 2 contacts do not have the office phone number we are populating them with.
     $contract1 = Contract::getById($superContractId);
     $contract2 = Contract::getById($superContractId2);
     $contract3 = Contract::getById($superContractId3);
     $contract4 = Contract::getById($superContractId4);
     $this->assertNotEquals('7788', $contract1->description);
     $this->assertNotEquals('7788', $contract2->description);
     $this->assertNotEquals('7788', $contract3->description);
     $this->assertNotEquals('7788', $contract4->description);
     $this->setGetArray(array('selectedIds' => $superContractId . ',' . $superContractId2, 'selectAll' => '', 'Contract_page' => 1));
     $this->setPostArray(array('Contract' => array('description' => '7788'), 'MassEdit' => array('description' => 1)));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massEditProgressPageSize');
     $this->assertEquals(5, $pageSize);
     Yii::app()->pagination->setForCurrentUserByType('massEditProgressPageSize', 20);
     $this->runControllerWithRedirectExceptionAndGetContent('contracts/default/massEdit');
     Yii::app()->pagination->setForCurrentUserByType('massEditProgressPageSize', $pageSize);
     //Test that the 2 contract have the new office phone number and the other contacts do not.
     $contract1 = Contract::getById($superContractId);
     $contract2 = Contract::getById($superContractId2);
     $contract3 = Contract::getById($superContractId3);
     $contract4 = Contract::getById($superContractId4);
     $contract5 = Contract::getById($superContractId5);
     $contract6 = Contract::getById($superContractId6);
     $contract7 = Contract::getById($superContractId7);
     $contract8 = Contract::getById($superContractId8);
     $contract9 = Contract::getById($superContractId9);
     $contract10 = Contract::getById($superContractId10);
     $contract11 = Contract::getById($superContractId11);
     $contract12 = Contract::getById($superContractId12);
     $this->assertEquals('7788', $contract1->description);
     $this->assertEquals('7788', $contract2->description);
     $this->assertNotEquals('7788', $contract3->description);
     $this->assertNotEquals('7788', $contract4->description);
     $this->assertNotEquals('7788', $contract5->description);
     $this->assertNotEquals('7788', $contract6->description);
     $this->assertNotEquals('7788', $contract7->description);
//.........这里部分代码省略.........
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:101,代码来源:ContractsSuperUserWalkthroughTest.php

示例4: testSetStageAndSourceAndRetrieveDisplayName

 /**
  * @depends testCreateAndGetContractById
  */
 public function testSetStageAndSourceAndRetrieveDisplayName()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = User::getByUsername('billy');
     $stageValues = array('Prospecting', 'Negotiating', 'Closed Won');
     $stageFieldData = CustomFieldData::getByName('SalesStages');
     $stageFieldData->serializedData = serialize($stageValues);
     $this->assertTrue($stageFieldData->save());
     $sourceValues = array('Word of Mouth', 'Outbound', 'Trade Show');
     $sourceFieldData = CustomFieldData::getByName('LeadSources');
     $sourceFieldData->serializedData = serialize($sourceValues);
     $this->assertTrue($sourceFieldData->save());
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 500.54;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $user;
     $contract->name = '1000 Widgets';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     //eventually fix to make correct format
     $contract->stage->value = $stageValues[1];
     $contract->source->value = $sourceValues[1];
     $saved = $contract->save();
     $this->assertTrue($saved);
     $this->assertTrue($contract->id !== null);
     $id = $contract->id;
     unset($contract);
     $contract = Contract::getById($id);
     $this->assertEquals('Negotiating', $contract->stage->value);
     $this->assertEquals('Outbound', $contract->source->value);
     $this->assertEquals(1, $currencies[0]->rateToBase);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:37,代码来源:ContractTest.php

示例5: testEditOfTheContractForTheCustomFieldsPlacedForContractsModule

 /**
  * @depends testEditOfTheContractForTheTagCloudFieldAfterRemovingAllTagsPlacedForContractsModule
  */
 public function testEditOfTheContractForTheCustomFieldsPlacedForContractsModule()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Set the date and datetime variable values here.
     $date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
     $dateAssert = date('Y-m-d');
     $datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
     $datetimeAssert = date('Y-m-d H:i:') . "00";
     $baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
     //Retrieve the account id, the super user id and Contract Id.
     $accountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $superUserId = $super->id;
     $explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
     $contract = Contract::getByName('myEditContract');
     $contractId = $contract[0]->id;
     //Edit a new contract based on the custom fields.
     $this->setGetArray(array('id' => $contractId));
     $this->setPostArray(array('Contract' => array('name' => 'myEditContract', 'amount' => array('value' => 288000, 'currency' => array('id' => $baseCurrency->id)), 'account' => array('id' => $accountId), 'closeDate' => $date, 'stage' => array('value' => 'Qualification'), 'source' => array('value' => 'Inbound Call'), 'description' => 'This is the Edit Description', 'owner' => array('id' => $superUserId), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'decimalCstm' => '12', 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'picklistCstm' => array('value' => 'b'), 'multiselectCstm' => array('values' => array('gg', 'hh')), 'tagcloudCstm' => array('values' => array('reading', 'surfing')), 'countrylistCstm' => array('value' => 'aaaa'), 'statelistCstm' => array('value' => 'aaa1'), 'citylistCstm' => array('value' => 'ab1'), 'integerCstm' => '11', 'phoneCstm' => '259-784-2069', 'radioCstm' => array('value' => 'e'), 'textCstm' => 'This is a test Edit Text', 'textareaCstm' => 'This is a test Edit TextArea', 'urlCstm' => 'http://wwww.abc-edit.com')));
     $this->runControllerWithRedirectExceptionAndGetUrl('contracts/default/edit');
     //Check the details if they are saved properly for the custom fields.
     $contractId = self::getModelIdByModelNameAndName('Contract', 'myEditContract');
     $contract = Contract::getById($contractId);
     //Retrieve the permission of the Contract.
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($contract);
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals($contract->name, 'myEditContract');
     $this->assertEquals($contract->amount->value, '288000');
     $this->assertEquals($contract->amount->currency->id, $baseCurrency->id);
     $this->assertEquals($contract->account->id, $accountId);
     $this->assertEquals($contract->probability, '25');
     $this->assertEquals($contract->stage->value, 'Qualification');
     $this->assertEquals($contract->source->value, 'Inbound Call');
     $this->assertEquals($contract->description, 'This is the Edit Description');
     $this->assertEquals($contract->owner->id, $superUserId);
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($contract->checkboxCstm, '0');
     $this->assertEquals($contract->currencyCstm->value, 40);
     $this->assertEquals($contract->currencyCstm->currency->id, $baseCurrency->id);
     $this->assertEquals($contract->dateCstm, $dateAssert);
     $this->assertEquals($contract->datetimeCstm, $datetimeAssert);
     $this->assertEquals($contract->decimalCstm, '12');
     $this->assertEquals($contract->picklistCstm->value, 'b');
     $this->assertEquals($contract->integerCstm, 11);
     $this->assertEquals($contract->phoneCstm, '259-784-2069');
     $this->assertEquals($contract->radioCstm->value, 'e');
     $this->assertEquals($contract->textCstm, 'This is a test Edit Text');
     $this->assertEquals($contract->textareaCstm, 'This is a test Edit TextArea');
     $this->assertEquals($contract->urlCstm, 'http://wwww.abc-edit.com');
     $this->assertEquals($contract->dateCstm, $dateAssert);
     $this->assertEquals($contract->datetimeCstm, $datetimeAssert);
     $this->assertEquals($contract->countrylistCstm->value, 'aaaa');
     $this->assertEquals($contract->statelistCstm->value, 'aaa1');
     $this->assertEquals($contract->citylistCstm->value, 'ab1');
     $this->assertContains('gg', $contract->multiselectCstm->values);
     $this->assertContains('hh', $contract->multiselectCstm->values);
     $this->assertContains('reading', $contract->tagcloudCstm->values);
     $this->assertContains('surfing', $contract->tagcloudCstm->values);
     $metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Contract');
     $testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $contract);
     $this->assertEquals(132, $testCalculatedValue);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:66,代码来源:ContractsDesignerSuperUserWalkthroughTest.php


注:本文中的Contract::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。