2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
37 require_once('modules/MySettings/StoreQuery.php');
39 class Bug42915Test extends Sugar_PHPUnit_Framework_TestCase
41 var $previousCurrentUser;
44 public function setUp()
47 $this->previousCurrentUser = $current_user;
48 $this->saved_search_id = md5(gmmktime());
49 $current_user = SugarTestUserUtilities::createAnonymousUser();
50 $current_user->setPreference('num_grp_sep', ',', 0, 'global');
51 $current_user->setPreference('dec_sep', '.', 0, 'global');
52 $current_user->save();
54 //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
55 get_number_seperators(true);
57 $GLOBALS['db']->query("INSERT INTO saved_search (id, name, search_module, deleted, date_entered, date_modified, assigned_user_id, contents) VALUES ('" . $this->saved_search_id . "', 'Bug42738', 'Opportunities', 0, '2011-03-10 17:05:27', '2011-03-10 17:05:27', '".$GLOBALS["current_user"]->id."', 'YTozNjp7czoxMzoic2VhcmNoRm9ybVRhYiI7czoxNToiYWR2YW5jZWRfc2VhcmNoIjtzOjU6InF1ZXJ5IjtzOjQ6InRydWUiO3M6MTM6Im5hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjIxOiJhY2NvdW50X25hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjI4OiJhbW91bnRfYWR2YW5jZWRfcmFuZ2VfY2hvaWNlIjtzOjc6ImJldHdlZW4iO3M6MjE6InJhbmdlX2Ftb3VudF9hZHZhbmNlZCI7czowOiIiO3M6Mjc6InN0YXJ0X3JhbmdlX2Ftb3VudF9hZHZhbmNlZCI7ZDo5NTAwMDtzOjI1OiJlbmRfcmFuZ2VfYW1vdW50X2FkdmFuY2VkIjtkOjQ5NTAwO3M6MjA6ImRhdGVfY2xvc2VkX2FkdmFuY2VkIjtzOjA6IiI7czoxODoibmV4dF9zdGVwX2FkdmFuY2VkIjtzOjA6IiI7czo0MzoidXBkYXRlX2ZpZWxkc190ZWFtX25hbWVfYWR2YW5jZWRfY29sbGVjdGlvbiI7czowOiIiO3M6MzI6InRlYW1fbmFtZV9hZHZhbmNlZF9uZXdfb25fdXBkYXRlIjtzOjU6ImZhbHNlIjtzOjMxOiJ0ZWFtX25hbWVfYWR2YW5jZWRfYWxsb3dfdXBkYXRlIjtzOjA6IiI7czozNToidGVhbV9uYW1lX2FkdmFuY2VkX2FsbG93ZWRfdG9fY2hlY2siO3M6NToiZmFsc2UiO3M6MzE6InRlYW1fbmFtZV9hZHZhbmNlZF9jb2xsZWN0aW9uXzAiO3M6MDoiIjtzOjM0OiJpZF90ZWFtX25hbWVfYWR2YW5jZWRfY29sbGVjdGlvbl8wIjtzOjA6IiI7czoyMzoidGVhbV9uYW1lX2FkdmFuY2VkX3R5cGUiO3M6MzoiYW55IjtzOjIzOiJmYXZvcml0ZXNfb25seV9hZHZhbmNlZCI7czoxOiIwIjtzOjk6InNob3dTU0RJViI7czoyOiJubyI7czoxMzoic2VhcmNoX21vZHVsZSI7czoxMzoiT3Bwb3J0dW5pdGllcyI7czoxOToic2F2ZWRfc2VhcmNoX2FjdGlvbiI7czo0OiJzYXZlIjtzOjE0OiJkaXNwbGF5Q29sdW1ucyI7czo4OToiTkFNRXxBQ0NPVU5UX05BTUV8U0FMRVNfU1RBR0V8QU1PVU5UX1VTRE9MTEFSfERBVEVfQ0xPU0VEfEFTU0lHTkVEX1VTRVJfTkFNRXxEQVRFX0VOVEVSRUQiO3M6ODoiaGlkZVRhYnMiO3M6OTM6Ik9QUE9SVFVOSVRZX1RZUEV8TEVBRF9TT1VSQ0V8TkVYVF9TVEVQfFBST0JBQklMSVRZfENSRUFURURfQllfTkFNRXxURUFNX05BTUV8TU9ESUZJRURfQllfTkFNRSI7czo3OiJvcmRlckJ5IjtzOjQ6Ik5BTUUiO3M6OToic29ydE9yZGVyIjtzOjM6IkFTQyI7czoxNjoic3VnYXJfdXNlcl90aGVtZSI7czo1OiJTdWdhciI7czoxMzoiTW9kdWxlQnVpbGRlciI7czoxNToiaGVscEhpZGRlbj10cnVlIjtzOjEzOiJDb250YWN0c19kaXZzIjtzOjEwOiJxdW90ZXNfdj0jIjtzOjIyOiJzdWdhcl90aGVtZV9nbV9jdXJyZW50IjtzOjM6IkFsbCI7czoxNToiZ2xvYmFsTGlua3NPcGVuIjtzOjQ6InRydWUiO3M6Mjc6IlNRTGl0ZU1hbmFnZXJfY3VycmVudExhbmd1ZSI7czoxOiIyIjtzOjQ2OiJzdGFydF9yYW5nZV9hbW91bnRfYWR2YW5jZWRfdW5mb3JtYXR0ZWRfbnVtYmVyIjtiOjE7czo0Mzoic3RhcnRfcmFuZ2VfYW1vdW50X2FkdmFuY2VkX2N1cnJlbmN5X3N5bWJvbCI7czoxOiIkIjtzOjQ0OiJlbmRfcmFuZ2VfYW1vdW50X2FkdmFuY2VkX3VuZm9ybWF0dGVkX251bWJlciI7YjoxO3M6NDE6ImVuZF9yYW5nZV9hbW91bnRfYWR2YW5jZWRfY3VycmVuY3lfc3ltYm9sIjtzOjE6IiQiO3M6ODoiYWR2YW5jZWQiO2I6MTt9')");
60 public function tearDown()
62 $GLOBALS['current_user']->setPreference('num_grp_sep', null, 0, 'global');
63 $GLOBALS['current_user']->setPreference('dec_sep', null, 0, 'global');
64 $GLOBALS['current_user']->save();
65 get_number_seperators(true);
67 $GLOBALS['db']->query("DELETE FROM saved_search where id = '{$this->saved_search_id}'");
68 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
70 $current_user = $this->previousCurrentUser;
74 public function testSaveNumericFields()
77 require_once('modules/SavedSearch/SavedSearch.php');
78 $focus = new SavedSearch();
79 $focus->retrieve($this->saved_search_id);
80 $_REQUEST = unserialize(base64_decode($focus->contents));
81 $_REQUEST['start_range_amount_advanced'] = '$9,500.00';
82 $_REQUEST['end_range_amount_advanced'] = '$49,500.00';
84 $mockBean = new Bug42915MockOpportunity();
85 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
87 //Now retrieve what we have saved and test
88 $focus->retrieveSavedSearch($this->saved_search_id);
89 $formatted_data = $focus->contents;
91 $this->assertEquals(9500, $formatted_data['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
92 $this->assertEquals(49500, $formatted_data['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
94 $focus->populateRequest();
95 $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value $9,500.00");
96 $this->assertEquals('$49,500.00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value $49,500.00");
98 $current_user->setPreference('num_grp_sep', '.');
99 $current_user->setPreference('dec_sep', ',');
100 $current_user->save();
101 //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
102 get_number_seperators(true);
104 $focus = new SavedSearch();
105 $focus->retrieveSavedSearch($this->saved_search_id);
106 $focus->populateRequest();
107 $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value $9,500.00");
108 $this->assertEquals('$49.500,00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value $49,500.00");
110 //Okay so now what happens if they don't specify currency or separator or decimal values?
111 $_REQUEST['start_range_amount_advanced'] = '9500';
112 $_REQUEST['end_range_amount_advanced'] = '49500';
114 //Well then the populated values should be unformatted!
115 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
116 $focus->retrieveSavedSearch($this->saved_search_id);
117 $focus->populateRequest();
118 $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
119 $this->assertEquals(49500, $_REQUEST['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
123 public function testStoreQuerySaveAndPopulate()
125 global $current_user, $timedate;
127 $storeQuery = new StoreQuery();
128 //Simulate a search request here
131 'module' => 'Opportunities',
133 'searchFormTab' => 'advanced_search',
135 'name_advanced' => '',
136 'account_name_advanced' => '',
137 'amount_advanced_range_choice' => '=',
138 'range_amount_advanced' => '',
139 'start_range_amount_advanced' => '$9,500.00',
140 'end_range_amount_advanced' => '$45,900.00',
141 'date_closed_advanced_range_choice' => '=',
142 'range_date_closed_advanced' => '',
143 'start_range_date_closed_advanced' => '',
144 'end_range_date_closed_advanced' => '',
145 'next_step_advanced' => '',
146 'update_fields_team_name_advanced_collection' => '',
147 'team_name_advanced_new_on_update' => false,
148 'team_name_advanced_allow_update' => '',
149 'team_name_advanced_allowed_to_check' => false,
150 'team_name_advanced_collection_0' => '',
151 'id_team_name_advanced_collection_0' => '',
152 'team_name_advanced_type' => 'any',
153 'favorites_only_advanced' => 0,
155 'saved_search_name' => '',
156 'search_module' => '',
157 'saved_search_action' => '',
158 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED',
159 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME',
161 'sortOrder' => 'ASC',
162 'button' => 'Search',
163 'saved_search_select' => '_none',
164 'sugar_user_theme' => 'Sugar',
165 'ModuleBuilder' => 'helpHidden=true',
166 'Contacts_divs' => 'quotes_v=#',
167 'sugar_theme_gm_current' => 'All',
168 'globalLinksOpen' => 'true',
169 'SQLiteManager_currentLangue' => '2',
170 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca',
173 $storeQuery->saveFromRequest('Opportunities');
175 $storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
176 $this->assertEquals($storedSearch['start_range_amount_advanced'], 9500.00, 'Assert that start range amount $9,500.00 was saved unformatted as 9500.00');
177 $this->assertEquals($storedSearch['end_range_amount_advanced'], 45900.00, 'Assert that end range amount $45,900.00 was saved unformatted as 45900.00');
180 //Test that value is converted to user's numer formatting
181 unset($_REQUEST['start_range_amount_advanced']);
182 unset($_REQUEST['end_range_amount_advanced']);
183 $storeQuery->loadQuery('Opportunities');
184 $storeQuery->populateRequest();
185 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
186 $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9,500.00');
187 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
188 $this->assertEquals('$45,900.00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45,900.00');
190 //Now say the user changes his number preferences and switches back to this StoredQuery
191 $current_user->setPreference('num_grp_sep', '.');
192 $current_user->setPreference('dec_sep', ',');
193 $current_user->save();
194 //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
195 get_number_seperators(true);
197 //Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
198 unset($_REQUEST['start_range_amount_advanced']);
199 unset($_REQUEST['end_range_amount_advanced']);
200 $storeQuery->loadQuery('Opportunities');
201 $storeQuery->populateRequest();
202 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
203 $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9.500,00');
204 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
205 $this->assertEquals('$45.900,00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45.900,00');
207 //Okay so now what happens if they don't specify currency or separator or decimal values?
208 $_REQUEST['start_range_amount_advanced'] = 9500;
209 $_REQUEST['end_range_amount_advanced'] = 45900;
211 $storeQuery->saveFromRequest('Opportunities');
212 $storeQuery->loadQuery('Opportunities');
213 $storeQuery->populateRequest();
214 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
215 $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value remained as is (9500)');
216 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
217 $this->assertEquals(45900, $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value remained as is (45900)');
224 class Bug42915MockOpportunity extends Opportunity
227 var $field_defs = array (
234 'reportable' => true,
235 'comment' => 'Unique identifier',
240 'vname' => 'LBL_OPPORTUNITY_NAME',
242 'dbType' => 'varchar',
244 'unified_search' => true,
245 'comment' => 'Name of the opportunity',
246 'merge_filter' => 'selected',
247 'importable' => 'required',
252 'name' => 'date_entered',
253 'vname' => 'LBL_DATE_ENTERED',
254 'type' => 'datetime',
255 'group' => 'created_by_name',
256 'comment' => 'Date record created',
257 'enable_range_search' => '1',
258 'options' => 'date_range_search_dom',
262 'name' => 'date_modified',
263 'vname' => 'LBL_DATE_MODIFIED',
264 'type' => 'datetime',
265 'group' => 'modified_by_name',
266 'comment' => 'Date record last modified',
267 'enable_range_search' => '1',
268 'options' => 'date_range_search_dom',
270 'modified_user_id' =>
272 'name' => 'modified_user_id',
273 'rname' => 'user_name',
274 'id_name' => 'modified_user_id',
275 'vname' => 'LBL_MODIFIED',
276 'type' => 'assigned_user_name',
279 'group' => 'modified_by_name',
281 'reportable' => true,
282 'comment' => 'User who last modified record',
284 'modified_by_name' =>
286 'name' => 'modified_by_name',
287 'vname' => 'LBL_MODIFIED_NAME',
289 'reportable' => false,
290 'source' => 'non-db',
291 'rname' => 'user_name',
293 'id_name' => 'modified_user_id',
295 'link' => 'modified_user_link',
296 'duplicate_merge' => 'disabled',
300 'name' => 'created_by',
301 'rname' => 'user_name',
302 'id_name' => 'modified_user_id',
303 'vname' => 'LBL_CREATED',
304 'type' => 'assigned_user_name',
308 'group' => 'created_by_name',
309 'comment' => 'User who created record',
313 'name' => 'created_by_name',
314 'vname' => 'LBL_CREATED',
316 'reportable' => false,
317 'link' => 'created_by_link',
318 'rname' => 'user_name',
319 'source' => 'non-db',
321 'id_name' => 'created_by',
323 'duplicate_merge' => 'disabled',
324 'importable' => 'false',
328 'name' => 'description',
329 'vname' => 'LBL_DESCRIPTION',
331 'comment' => 'Full text of the note',
338 'vname' => 'LBL_DELETED',
341 'reportable' => false,
342 'comment' => 'Record deletion indicator',
346 'name' => 'created_by_link',
348 'relationship' => 'opportunities_created_by',
349 'vname' => 'LBL_CREATED_USER',
350 'link_type' => 'one',
352 'bean_name' => 'User',
353 'source' => 'non-db',
355 'modified_user_link' =>
357 'name' => 'modified_user_link',
359 'relationship' => 'opportunities_modified_user',
360 'vname' => 'LBL_MODIFIED_USER',
361 'link_type' => 'one',
363 'bean_name' => 'User',
364 'source' => 'non-db',
366 'assigned_user_id' =>
368 'name' => 'assigned_user_id',
369 'rname' => 'user_name',
370 'id_name' => 'assigned_user_id',
371 'vname' => 'LBL_ASSIGNED_TO_ID',
372 'group' => 'assigned_user_name',
376 'reportable' => true,
380 'comment' => 'User ID assigned to record',
381 'duplicate_merge' => 'disabled',
383 'assigned_user_name' =>
385 'name' => 'assigned_user_name',
386 'link' => 'assigned_user_link',
387 'vname' => 'LBL_ASSIGNED_TO_NAME',
388 'rname' => 'user_name',
390 'reportable' => false,
391 'source' => 'non-db',
393 'id_name' => 'assigned_user_id',
395 'duplicate_merge' => 'disabled',
397 'assigned_user_link' =>
399 'name' => 'assigned_user_link',
401 'relationship' => 'opportunities_assigned_user',
402 'vname' => 'LBL_ASSIGNED_TO_USER',
403 'link_type' => 'one',
405 'bean_name' => 'User',
406 'source' => 'non-db',
407 'duplicate_merge' => 'enabled',
408 'rname' => 'user_name',
409 'id_name' => 'assigned_user_id',
415 'vname' => 'LBL_TEAM_ID',
416 'group' => 'team_name',
417 'reportable' => false,
419 'type' => 'team_list',
421 'comment' => 'Team ID for the account',
425 'name' => 'team_set_id',
427 'id_name' => 'team_set_id',
428 'vname' => 'LBL_TEAM_SET_ID',
436 'name' => 'team_count',
437 'rname' => 'team_count',
438 'id_name' => 'team_id',
439 'vname' => 'LBL_TEAMS',
440 'join_name' => 'ts1',
445 'link' => 'team_count_link',
446 'massupdate' => false,
448 'source' => 'non-db',
449 'importable' => 'false',
450 'reportable' => false,
451 'duplicate_merge' => 'disabled',
457 'name' => 'team_name',
458 'db_concat_fields' =>
463 'sort_on' => 'tj.name',
466 'id_name' => 'team_id',
467 'vname' => 'LBL_TEAMS',
472 'link' => 'team_link',
473 'massupdate' => false,
474 'dbType' => 'varchar',
475 'source' => 'non-db',
477 'custom_type' => 'teamset',
481 'name' => 'team_link',
483 'relationship' => 'opportunities_team',
484 'vname' => 'LBL_TEAMS_LINK',
485 'link_type' => 'one',
487 'bean_name' => 'Team',
488 'source' => 'non-db',
489 'duplicate_merge' => 'disabled',
494 'name' => 'team_count_link',
496 'relationship' => 'opportunities_team_count_relationship',
497 'link_type' => 'one',
499 'bean_name' => 'TeamSet',
500 'source' => 'non-db',
501 'duplicate_merge' => 'disabled',
502 'reportable' => false,
509 'relationship' => 'opportunities_teams',
510 'bean_filter_field' => 'team_set_id',
511 'rhs_key_override' => true,
512 'source' => 'non-db',
513 'vname' => 'LBL_TEAMS',
514 'link_class' => 'TeamSetLink',
515 'link_file' => 'modules/Teams/TeamSetLink.php',
517 'reportable' => false,
519 'opportunity_type' =>
521 'name' => 'opportunity_type',
522 'vname' => 'LBL_TYPE',
524 'options' => 'opportunity_type_dom',
527 'comment' => 'Type of opportunity (ex: Existing, New)',
528 'merge_filter' => 'enabled',
532 'name' => 'account_name',
534 'id_name' => 'account_id',
535 'vname' => 'LBL_ACCOUNT_NAME',
537 'table' => 'accounts',
538 'join_name' => 'accounts',
540 'module' => 'Accounts',
541 'dbType' => 'varchar',
542 'link' => 'accounts',
544 'source' => 'non-db',
545 'unified_search' => true,
547 'importable' => 'required',
551 'name' => 'account_id',
552 'vname' => 'LBL_ACCOUNT_ID',
554 'source' => 'non-db',
559 'name' => 'campaign_id',
560 'comment' => 'Campaign that generated lead',
561 'vname' => 'LBL_CAMPAIGN_ID',
565 'table' => 'campaigns',
567 'module' => 'Campaigns',
568 'reportable' => false,
569 'massupdate' => false,
570 'duplicate_merge' => 'disabled',
574 'name' => 'campaign_name',
576 'id_name' => 'campaign_id',
577 'vname' => 'LBL_CAMPAIGN',
579 'link' => 'campaign_opportunities',
581 'table' => 'campaigns',
582 'module' => 'Campaigns',
583 'source' => 'non-db',
585 'campaign_opportunities' =>
587 'name' => 'campaign_opportunities',
589 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
590 'relationship' => 'campaign_opportunities',
591 'source' => 'non-db',
595 'name' => 'lead_source',
596 'vname' => 'LBL_LEAD_SOURCE',
598 'options' => 'lead_source_dom',
600 'comment' => 'Source of the opportunity',
601 'merge_filter' => 'enabled',
606 'vname' => 'LBL_AMOUNT',
607 'type' => 'currency',
608 'dbType' => 'double',
609 'comment' => 'Unconverted amount of the opportunity',
610 'duplicate_merge' => 'disabled',
611 'importable' => 'required',
613 'options' => 'numeric_range_search_dom',
614 'enable_range_search' => '1',
618 'name' => 'amount_usdollar',
619 'vname' => 'LBL_AMOUNT_USDOLLAR',
620 'type' => 'currency',
622 'dbType' => 'double',
623 'disable_num_format' => true,
625 'comment' => 'Formatted amount of the opportunity',
629 'name' => 'currency_id',
631 'group' => 'currency_id',
632 'vname' => 'LBL_CURRENCY',
635 'name' => 'getCurrencyDropDown',
638 'reportable' => false,
639 'comment' => 'Currency used for display purposes',
643 'name' => 'currency_name',
645 'id_name' => 'currency_id',
646 'vname' => 'LBL_CURRENCY_NAME',
649 'table' => 'currencies',
650 'module' => 'Currencies',
651 'source' => 'non-db',
654 'name' => 'getCurrencyNameDropDown',
658 'duplicate_merge' => 'disabled',
662 'name' => 'currency_symbol',
664 'id_name' => 'currency_id',
665 'vname' => 'LBL_CURRENCY_SYMBOL',
668 'table' => 'currencies',
669 'module' => 'Currencies',
670 'source' => 'non-db',
673 'name' => 'getCurrencySymbolDropDown',
677 'duplicate_merge' => 'disabled',
681 'name' => 'date_closed',
682 'vname' => 'LBL_DATE_CLOSED',
685 'comment' => 'Expected or actual date the oppportunity will close',
686 'importable' => 'required',
688 'enable_range_search' => '1',
689 'options' => 'date_range_search_dom',
693 'name' => 'next_step',
694 'vname' => 'LBL_NEXT_STEP',
697 'comment' => 'The next step in the sales process',
698 'merge_filter' => 'enabled',
702 'name' => 'sales_stage',
703 'vname' => 'LBL_SALES_STAGE',
705 'options' => 'sales_stage_dom',
708 'comment' => 'Indication of progression towards closure',
709 'merge_filter' => 'enabled',
710 'importable' => 'required',
715 'name' => 'probability',
716 'vname' => 'LBL_PROBABILITY',
718 'dbType' => 'double',
720 'comment' => 'The probability of closure',
727 'merge_filter' => 'enabled',
731 'name' => 'accounts',
733 'relationship' => 'accounts_opportunities',
734 'source' => 'non-db',
735 'link_type' => 'one',
736 'module' => 'Accounts',
737 'bean_name' => 'Account',
738 'vname' => 'LBL_ACCOUNTS',
742 'name' => 'contacts',
744 'relationship' => 'opportunities_contacts',
745 'source' => 'non-db',
746 'module' => 'Contacts',
747 'bean_name' => 'Contact',
753 'options' => 'opportunity_relationship_type_dom',
756 'vname' => 'LBL_CONTACTS',
762 'relationship' => 'opportunity_tasks',
763 'source' => 'non-db',
764 'vname' => 'LBL_TASKS',
770 'relationship' => 'opportunity_notes',
771 'source' => 'non-db',
772 'vname' => 'LBL_NOTES',
776 'name' => 'meetings',
778 'relationship' => 'opportunity_meetings',
779 'source' => 'non-db',
780 'vname' => 'LBL_MEETINGS',
786 'relationship' => 'opportunity_calls',
787 'source' => 'non-db',
788 'vname' => 'LBL_CALLS',
794 'relationship' => 'emails_opportunities_rel',
795 'source' => 'non-db',
796 'vname' => 'LBL_EMAILS',
800 'name' => 'documents',
802 'relationship' => 'documents_opportunities',
803 'source' => 'non-db',
804 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
810 'relationship' => 'quotes_opportunities',
811 'source' => 'non-db',
812 'vname' => 'LBL_QUOTES',
818 'relationship' => 'projects_opportunities',
819 'source' => 'non-db',
820 'vname' => 'LBL_PROJECTS',
826 'relationship' => 'opportunity_leads',
827 'source' => 'non-db',
828 'vname' => 'LBL_LEADS',
832 'name' => 'campaigns',
834 'relationship' => 'opportunities_campaign',
835 'module' => 'CampaignLog',
836 'bean_name' => 'CampaignLog',
837 'source' => 'non-db',
838 'vname' => 'LBL_CAMPAIGNS',
842 'name' => 'campaign_link',
844 'relationship' => 'opportunities_campaign',
845 'vname' => 'LBL_CAMPAIGNS',
846 'link_type' => 'one',
847 'module' => 'Campaigns',
848 'bean_name' => 'Campaign',
849 'source' => 'non-db',
853 'name' => 'currencies',
855 'relationship' => 'opportunity_currencies',
856 'source' => 'non-db',
857 'vname' => 'LBL_CURRENCIES',
861 'name' => 'contracts',
863 'vname' => 'LBL_CONTRACTS',
864 'relationship' => 'contracts_opportunities',
865 'source' => 'non-db',
869 'options' => 'date_range_search_dom',
870 'enforced' => 'false',
872 'enable_range_search' => '1',
874 'source' => 'custom_fields',
875 'name' => 'customdate_c',
876 'vname' => 'LBL_CUSTOMDATE',
882 'importable' => 'true',
883 'duplicate_merge' => 'disabled',
884 'duplicate_merge_dom_value' => '0',
886 'reportable' => true,
887 'calculated' => false,
889 'id' => 'Opportunitiescustomdate_c',
890 'custom_module' => 'Opportunities',
892 'customdatetime_c' =>
894 'enforced' => 'false',
897 'source' => 'custom_fields',
898 'name' => 'customdatetime_c',
899 'vname' => 'LBL_CUSTOMDATETIME',
900 'type' => 'datetimecombo',
905 'importable' => 'true',
906 'duplicate_merge' => 'disabled',
907 'duplicate_merge_dom_value' => '0',
909 'reportable' => true,
910 'calculated' => false,
912 'enable_range_search' => false,
913 'dbType' => 'datetime',
914 'id' => 'Opportunitiescustomdatetime_c',
915 'custom_module' => 'Opportunities',