コード例 #1
0
 public function actionLoadContractsSampler()
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     for ($i = 0; $i < 11; $i++) {
         $owner = Yii::app()->user->userModel;
         $name = 'Mass Delete ' . $i;
         $currencies = Currency::getAll();
         $currencyValue = new CurrencyValue();
         $currencyValue->value = 500.54;
         $currencyValue->currency = $currencies[0];
         $contract = new Contract();
         $contract->owner = $owner;
         $contract->name = $name;
         $contract->amount = $currencyValue;
         $contract->closeDate = '2011-01-01';
         //eventually fix to make correct format
         $contract->stage->value = 'Negotiating';
         $saved = $contract->save();
         if (!$saved) {
             throw new NotSupportedException();
         }
     }
 }
コード例 #2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     UserTestHelper::createBasicUser('jim');
     AllPermissionsOptimizationUtil::rebuild();
     ContractTestHelper::createContractStagesIfDoesNotExist();
     ContractTestHelper::createContractSourcesIfDoesNotExist();
     $currencies = Currency::getAll();
     //Make Contracts for testing chart data.
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 200;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc1';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Negotiating';
     $contract->source->value = 'Outbound';
     assert($contract->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 350;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc2';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Negotiating';
     $contract->source->value = 'Trade Show';
     assert($contract->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc2';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Verbal';
     $contract->source->value = 'Trade Show';
     assert($contract->save());
     // Not Coding Standard
 }
コード例 #3
0
ファイル: Save.php プロジェクト: sysraj86/carnivalcrm
        $focus->{$field} = $value;
    }
}
foreach ($focus->additional_column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
if (!empty($focus->date_of_contracts)) {
    $date = explode('/', $focus->date_of_contracts);
    $focus->date = $date[0];
    $focus->month = $date[1];
    $focus->year = $date[2];
}
$focus->save($check_notify);
// Check Cham diem va phan loai khach hang
if ($focus->parent_type == 'FITs' || $focus->parent_type == 'Accounts') {
    $rating = new CustomerRating();
    $rating->Rating($focus->parent_id, $focus->parent_type);
}
$return_id = $focus->id;
$contracts_values = array('id' => $_POST['contract_value_id'], 'num_of_cus' => $_POST['tong_sl_khach'], 'type_service' => $_POST['type_service'], 'age' => $_POST['age'], 'tour_cost' => $_POST['gia_tour'], 'tax' => $_POST['thue'], 'money' => $_POST['thanhtien'], 'deleted' => $_POST['deleted']);
// save contract_values
$contracts_values_line_count = count($contracts_values['id']);
$giatrihopdong = "";
for ($i = 0; $i < $contracts_values_line_count; $i++) {
    $contracts_value = new ContractValue();
    if (($contracts_values['money'][$i] != '' || $contracts_values['money'][$i] != 0) && $contracts_values['deleted'][$i] != 1) {
        $contracts_value->id = $contracts_values['id'][$i];
        $contracts_value->contract_value_id = $return_id;
コード例 #4
0
foreach ($sugar_demodata['contract_seed_data'] as $v) {
    $contract = new Contract();
    $contract->currency_id = '-99';
    $contract->name = $v['name'];
    $contract->reference_code = $v['reference_code'];
    $contract->status = 'signed';
    $contract->account_id = $account->id;
    $contract->total_contract_value = $v['total_contract_value'];
    $contract->team_id = 1;
    $contract->assigned_user_id = 'seed_will_id';
    $contract->start_date = $v['start_date'];
    $contract->end_date = $v['end_date'];
    $contract->company_signed_date = $v['company_signed_date'];
    $contract->customer_signed_date = $v['customer_signed_date'];
    $contract->description = $v['description'];
    $contract->save();
}
echo '.';
///
/// SEED DATA FOR KNOWLEDGE BASE
///
$kbtags_hash = array();
foreach ($sugar_demodata['kbdocument_seed_data_kbtags'] as $v) {
    $kbtag = new KBTag();
    $kbtag->tag_name = $v;
    $id = $kbtag->save();
    $kbtags_hash[$id] = $v;
}
echo '.';
foreach ($sugar_demodata['kbdocument_seed_data'] as $v) {
    $kbdoc = new KBDocument();
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
ファイル: ContractRepository.php プロジェクト: avaza/arc
 public function save(Contract $contract)
 {
     return $contract->save();
 }
コード例 #7
0
 function testAssignmentBeforeParentSaved()
 {
     $client = new Client(array('name' => 'HP'));
     $contract = new Contract(array('code' => 'test', 'date' => '2005-12-01'));
     $contract->save();
     $client->contract = $contract;
     $this->assertTrue($client->isNewRecord());
     $this->assertEqual($contract, $client->contract);
     $this->assertTrue($client->save());
     $this->assertEqual($contract, $client->contract);
     $this->assertCopy($contract, $client->contract(True));
     // assertEqual crashes
     // because of a nesting level too deep - recursive dependency
 }
コード例 #8
0
ファイル: playerView.php プロジェクト: kunal-bajpai/gfa
     if (isset($cont[0])) {
         $cont[0]->term = 1;
         $cont[0]->save();
     }
 }
 if (isset($_POST['return_transfer'])) {
     $transfer = Transfer::find_by_sql("SELECT * FROM transfers WHERE player = {$_GET['id']} AND returned = 0 ORDER BY start DESC");
     if (isset($transfer[0])) {
         $transfer[0]->returned = time();
         $transfer[0]->save();
     }
 }
 if (isset($_POST['contFrom']) && isset($_POST['contTo'])) {
     $newCont = new Contract();
     $newCont->set($_GET['id'], $_POST['team'], strtotime($_POST['contFrom']), strtotime($_POST['contTo']));
     $newCont->save();
 }
 if (isset($_POST['loanFrom']) && isset($_POST['loanTo'])) {
     $contractTeam = $player->find_contract_team();
     $newLoan = new Loan();
     $newLoan->set($_GET['id'], $contractTeam->id, $_POST['toteam'], strtotime($_POST['loanFrom']), strtotime($_POST['loanTo']));
     $newLoan->save();
 }
 if (isset($_POST['insTo'])) {
     $newIns = new Insurance();
     $newIns->set($_GET['id'], strtotime($_POST['insTo']));
     $newIns->save();
 }
 if (isset($_POST['visaTo'])) {
     $newVisa = new Visa();
     $newVisa->set($_GET['id'], strtotime($_POST['visaTo']));
コード例 #9
0
 public static function createContractWithProductsByNameForOwner($name, $owner, $account)
 {
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 500.54;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $owner;
     $contract->name = $name;
     $contract->account = $account;
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     //eventually fix to make correct format
     $contract->stage->value = 'Negotiating';
     $saved = $contract->save();
     assert('$saved');
     return $contract;
 }