public function tearDown() { global $sugar_config; $this->currency_system->symbol = $this->backupSymbol; $this->currency_system->save(false); $sugar_config['default_currency_symbol'] = $this->backupSymbol; format_number(0, 0, 0, array('currency_id' => $this->currency_51568->id, 'currency_symbol' => $this->currency_51568->symbol)); format_number(0, 0, 0, array('currency_id' => -99, 'currency_symbol' => $this->currency_51568->getDefaultCurrencySymbol())); $this->currency_51568->mark_deleted($this->currency_51568->id); SugarTestHelper::tearDown(); get_number_seperators(true); }
/** * Create new currency * Create fake Opportunity with created currency * Try to get select for currency field and assert that new currency is selected * * @return void * @group 48570 */ public function testCurrencySelect() { $currency = new Currency(); $currency->iso4217 = 'EUR'; $currency->name = 'Euro'; $currency->symbol = 'E'; $currency->conversion_rate = 1.5; $currency->status = 'Active'; $currency->save(); $focus = new Opportunity(); $focus->id = __CLASS__; $focus->currency_id = $currency->id; $focus->team_id = '1'; $editView = new EditView(); $editView->showVCRControl = false; $editView->view = 'EditView'; $editView->setup('Opportunities', $focus); $editView->process(); $currency->mark_deleted($currency->id); $this->assertRegExp('/<option value="' . $focus->currency_id . '" selected>/sim', $editView->fieldDefs['currency_id']['value'], 'No selected option here'); }
require_once 'modules/Currencies/ListCurrency.php'; require_once 'modules/Currencies/Currency.php'; $focus = new Currency(); $lc = new ListCurrency(); $lc->handleAdd(); if (isset($_REQUEST['merge']) && $_REQUEST['merge'] == 'true') { $isMerge = true; } if (isset($_REQUEST['domerge'])) { $currencies = $_REQUEST['mergecur']; require_once 'modules/Opportunities/Opportunity.php'; $opp = new Opportunity(); $opp->update_currency_id($currencies, $_REQUEST['mergeTo']); foreach ($currencies as $cur) { if ($cur != $_REQUEST['mergeTo']) { $focus->mark_deleted($cur); } } } $lc->lookupCurrencies(); if (isset($focus->id)) { $focus_id = $focus->id; } else { $focus_id = ''; } $merge_button = ''; $pretable = ''; if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'merge' || isset($isMerge) && !$isMerge) { $merge_button = '<form name= "MERGE" method="POST" action="index.php"><input type="hidden" name="module" value="Currencies"><input type="hidden" name="record" value="' . $focus_id . '"><input type="hidden" name="action" value="index"><input type="hidden" name="merge" value="true"><input title="' . $mod_strings['LBL_MERGE'] . '" accessKey="' . $mod_strings['LBL_MERGE'] . '" class="button" type="submit" name="button" value="' . $mod_strings['LBL_MERGE'] . '" ></form>'; } if (isset($isMerge) && $isMerge) {
/********************************************************************************* * The contents of this file are subject to the SugarCRM Public License Version * 1.1.3 ("License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * All copies of the Covered Code must include on each user interface screen: * (i) the "Powered by SugarCRM" logo and * (ii) the SugarCRM copyright notice * in the same form as they appear in the distribution. See full license for * requirements. * * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ /********************************************************************************* ********************************************************************************/ require_once 'modules/Currencies/Currency.php'; global $mod_strings; $focus = new Currency(); if (!isset($_REQUEST['record'])) { sugar_die($mod_strings['ERR_DELETE_RECORD']); } $focus->mark_deleted($_REQUEST['record']); header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);
public function testsave() { $currency = new Currency(); $currency->name = 'Rand'; $currency->iso4217 = 'R'; $currency->symbol = 'SA Rand'; $currency->conversion_rate = '2'; $currency->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($currency->id)); $this->assertEquals(36, strlen($currency->id)); //mark the record as deleted and verify that this record cannot be retrieved anymore. $currency->mark_deleted($currency->id); $result = $currency->retrieve($currency->id); $this->assertEquals(-99, $result->id); }