2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 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['db']->query("DELETE FROM saved_search where id = '{$this->saved_search_id}'");
63 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
65 $current_user = $this->previousCurrentUser;
69 public function testSaveNumericFields()
72 require_once('modules/SavedSearch/SavedSearch.php');
73 $focus = new SavedSearch();
74 $focus->retrieve($this->saved_search_id);
75 $_REQUEST = unserialize(base64_decode($focus->contents));
76 $_REQUEST['start_range_amount_advanced'] = '$9,500.00';
77 $_REQUEST['end_range_amount_advanced'] = '$49,500.00';
79 $mockBean = new Bug42915MockOpportunity();
80 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
82 //Now retrieve what we have saved and test
83 $focus->retrieveSavedSearch($this->saved_search_id);
84 $formatted_data = $focus->contents;
86 $this->assertEquals(9500, $formatted_data['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
87 $this->assertEquals(49500, $formatted_data['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
89 $focus->populateRequest();
90 $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value $9,500.00");
91 $this->assertEquals('$49,500.00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value $49,500.00");
93 $current_user->setPreference('num_grp_sep', '.');
94 $current_user->setPreference('dec_sep', ',');
95 $current_user->save();
96 //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
97 get_number_seperators(true);
99 $focus = new SavedSearch();
100 $focus->retrieveSavedSearch($this->saved_search_id);
101 $focus->populateRequest();
102 $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value $9,500.00");
103 $this->assertEquals('$49.500,00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value $49,500.00");
105 //Okay so now what happens if they don't specify currency or separator or decimal values?
106 $_REQUEST['start_range_amount_advanced'] = '9500';
107 $_REQUEST['end_range_amount_advanced'] = '49500';
109 //Well then the populated values should be unformatted!
110 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
111 $focus->retrieveSavedSearch($this->saved_search_id);
112 $focus->populateRequest();
113 $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
114 $this->assertEquals(49500, $_REQUEST['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
118 public function testStoreQuerySaveAndPopulate()
120 global $current_user, $timedate;
122 $storeQuery = new StoreQuery();
123 //Simulate a search request here
126 'module' => 'Opportunities',
128 'searchFormTab' => 'advanced_search',
130 'name_advanced' => '',
131 'account_name_advanced' => '',
132 'amount_advanced_range_choice' => '=',
133 'range_amount_advanced' => '',
134 'start_range_amount_advanced' => '$9,500.00',
135 'end_range_amount_advanced' => '$45,900.00',
136 'date_closed_advanced_range_choice' => '=',
137 'range_date_closed_advanced' => '',
138 'start_range_date_closed_advanced' => '',
139 'end_range_date_closed_advanced' => '',
140 'next_step_advanced' => '',
141 'update_fields_team_name_advanced_collection' => '',
142 'team_name_advanced_new_on_update' => false,
143 'team_name_advanced_allow_update' => '',
144 'team_name_advanced_allowed_to_check' => false,
145 'team_name_advanced_collection_0' => '',
146 'id_team_name_advanced_collection_0' => '',
147 'team_name_advanced_type' => 'any',
148 'favorites_only_advanced' => 0,
150 'saved_search_name' => '',
151 'search_module' => '',
152 'saved_search_action' => '',
153 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED',
154 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME',
156 'sortOrder' => 'ASC',
157 'button' => 'Search',
158 'saved_search_select' => '_none',
159 'sugar_user_theme' => 'Sugar',
160 'ModuleBuilder' => 'helpHidden=true',
161 'Contacts_divs' => 'quotes_v=#',
162 'sugar_theme_gm_current' => 'All',
163 'globalLinksOpen' => 'true',
164 'SQLiteManager_currentLangue' => '2',
165 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca',
168 $storeQuery->saveFromRequest('Opportunities');
170 $storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
171 $this->assertEquals($storedSearch['start_range_amount_advanced'], 9500.00, 'Assert that start range amount $9,500.00 was saved unformatted as 9500.00');
172 $this->assertEquals($storedSearch['end_range_amount_advanced'], 45900.00, 'Assert that end range amount $45,900.00 was saved unformatted as 45900.00');
175 //Test that value is converted to user's numer formatting
176 unset($_REQUEST['start_range_amount_advanced']);
177 unset($_REQUEST['end_range_amount_advanced']);
178 $storeQuery->loadQuery('Opportunities');
179 $storeQuery->populateRequest();
180 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
181 $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9,500.00');
182 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
183 $this->assertEquals('$45,900.00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45,900.00');
185 //Now say the user changes his number preferences and switches back to this StoredQuery
186 $current_user->setPreference('num_grp_sep', '.');
187 $current_user->setPreference('dec_sep', ',');
188 $current_user->save();
189 //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
190 get_number_seperators(true);
192 //Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
193 unset($_REQUEST['start_range_amount_advanced']);
194 unset($_REQUEST['end_range_amount_advanced']);
195 $storeQuery->loadQuery('Opportunities');
196 $storeQuery->populateRequest();
197 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
198 $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9.500,00');
199 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
200 $this->assertEquals('$45.900,00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45.900,00');
202 //Okay so now what happens if they don't specify currency or separator or decimal values?
203 $_REQUEST['start_range_amount_advanced'] = 9500;
204 $_REQUEST['end_range_amount_advanced'] = 45900;
206 $storeQuery->saveFromRequest('Opportunities');
207 $storeQuery->loadQuery('Opportunities');
208 $storeQuery->populateRequest();
209 $this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
210 $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value remained as is (9500)');
211 $this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
212 $this->assertEquals(45900, $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value remained as is (45900)');
219 class Bug42915MockOpportunity extends Opportunity
222 var $field_defs = array (
229 'reportable' => true,
230 'comment' => 'Unique identifier',
235 'vname' => 'LBL_OPPORTUNITY_NAME',
237 'dbType' => 'varchar',
239 'unified_search' => true,
240 'comment' => 'Name of the opportunity',
241 'merge_filter' => 'selected',
242 'importable' => 'required',
247 'name' => 'date_entered',
248 'vname' => 'LBL_DATE_ENTERED',
249 'type' => 'datetime',
250 'group' => 'created_by_name',
251 'comment' => 'Date record created',
252 'enable_range_search' => '1',
253 'options' => 'date_range_search_dom',
257 'name' => 'date_modified',
258 'vname' => 'LBL_DATE_MODIFIED',
259 'type' => 'datetime',
260 'group' => 'modified_by_name',
261 'comment' => 'Date record last modified',
262 'enable_range_search' => '1',
263 'options' => 'date_range_search_dom',
265 'modified_user_id' =>
267 'name' => 'modified_user_id',
268 'rname' => 'user_name',
269 'id_name' => 'modified_user_id',
270 'vname' => 'LBL_MODIFIED',
271 'type' => 'assigned_user_name',
274 'group' => 'modified_by_name',
276 'reportable' => true,
277 'comment' => 'User who last modified record',
279 'modified_by_name' =>
281 'name' => 'modified_by_name',
282 'vname' => 'LBL_MODIFIED_NAME',
284 'reportable' => false,
285 'source' => 'non-db',
286 'rname' => 'user_name',
288 'id_name' => 'modified_user_id',
290 'link' => 'modified_user_link',
291 'duplicate_merge' => 'disabled',
295 'name' => 'created_by',
296 'rname' => 'user_name',
297 'id_name' => 'modified_user_id',
298 'vname' => 'LBL_CREATED',
299 'type' => 'assigned_user_name',
303 'group' => 'created_by_name',
304 'comment' => 'User who created record',
308 'name' => 'created_by_name',
309 'vname' => 'LBL_CREATED',
311 'reportable' => false,
312 'link' => 'created_by_link',
313 'rname' => 'user_name',
314 'source' => 'non-db',
316 'id_name' => 'created_by',
318 'duplicate_merge' => 'disabled',
319 'importable' => 'false',
323 'name' => 'description',
324 'vname' => 'LBL_DESCRIPTION',
326 'comment' => 'Full text of the note',
333 'vname' => 'LBL_DELETED',
336 'reportable' => false,
337 'comment' => 'Record deletion indicator',
341 'name' => 'created_by_link',
343 'relationship' => 'opportunities_created_by',
344 'vname' => 'LBL_CREATED_USER',
345 'link_type' => 'one',
347 'bean_name' => 'User',
348 'source' => 'non-db',
350 'modified_user_link' =>
352 'name' => 'modified_user_link',
354 'relationship' => 'opportunities_modified_user',
355 'vname' => 'LBL_MODIFIED_USER',
356 'link_type' => 'one',
358 'bean_name' => 'User',
359 'source' => 'non-db',
361 'assigned_user_id' =>
363 'name' => 'assigned_user_id',
364 'rname' => 'user_name',
365 'id_name' => 'assigned_user_id',
366 'vname' => 'LBL_ASSIGNED_TO_ID',
367 'group' => 'assigned_user_name',
371 'reportable' => true,
375 'comment' => 'User ID assigned to record',
376 'duplicate_merge' => 'disabled',
378 'assigned_user_name' =>
380 'name' => 'assigned_user_name',
381 'link' => 'assigned_user_link',
382 'vname' => 'LBL_ASSIGNED_TO_NAME',
383 'rname' => 'user_name',
385 'reportable' => false,
386 'source' => 'non-db',
388 'id_name' => 'assigned_user_id',
390 'duplicate_merge' => 'disabled',
392 'assigned_user_link' =>
394 'name' => 'assigned_user_link',
396 'relationship' => 'opportunities_assigned_user',
397 'vname' => 'LBL_ASSIGNED_TO_USER',
398 'link_type' => 'one',
400 'bean_name' => 'User',
401 'source' => 'non-db',
402 'duplicate_merge' => 'enabled',
403 'rname' => 'user_name',
404 'id_name' => 'assigned_user_id',
410 'vname' => 'LBL_TEAM_ID',
411 'group' => 'team_name',
412 'reportable' => false,
414 'type' => 'team_list',
416 'comment' => 'Team ID for the account',
420 'name' => 'team_set_id',
422 'id_name' => 'team_set_id',
423 'vname' => 'LBL_TEAM_SET_ID',
431 'name' => 'team_count',
432 'rname' => 'team_count',
433 'id_name' => 'team_id',
434 'vname' => 'LBL_TEAMS',
435 'join_name' => 'ts1',
440 'link' => 'team_count_link',
441 'massupdate' => false,
443 'source' => 'non-db',
444 'importable' => 'false',
445 'reportable' => false,
446 'duplicate_merge' => 'disabled',
452 'name' => 'team_name',
453 'db_concat_fields' =>
458 'sort_on' => 'tj.name',
461 'id_name' => 'team_id',
462 'vname' => 'LBL_TEAMS',
467 'link' => 'team_link',
468 'massupdate' => false,
469 'dbType' => 'varchar',
470 'source' => 'non-db',
472 'custom_type' => 'teamset',
476 'name' => 'team_link',
478 'relationship' => 'opportunities_team',
479 'vname' => 'LBL_TEAMS_LINK',
480 'link_type' => 'one',
482 'bean_name' => 'Team',
483 'source' => 'non-db',
484 'duplicate_merge' => 'disabled',
489 'name' => 'team_count_link',
491 'relationship' => 'opportunities_team_count_relationship',
492 'link_type' => 'one',
494 'bean_name' => 'TeamSet',
495 'source' => 'non-db',
496 'duplicate_merge' => 'disabled',
497 'reportable' => false,
504 'relationship' => 'opportunities_teams',
505 'bean_filter_field' => 'team_set_id',
506 'rhs_key_override' => true,
507 'source' => 'non-db',
508 'vname' => 'LBL_TEAMS',
509 'link_class' => 'TeamSetLink',
510 'link_file' => 'modules/Teams/TeamSetLink.php',
512 'reportable' => false,
514 'opportunity_type' =>
516 'name' => 'opportunity_type',
517 'vname' => 'LBL_TYPE',
519 'options' => 'opportunity_type_dom',
522 'comment' => 'Type of opportunity (ex: Existing, New)',
523 'merge_filter' => 'enabled',
527 'name' => 'account_name',
529 'id_name' => 'account_id',
530 'vname' => 'LBL_ACCOUNT_NAME',
532 'table' => 'accounts',
533 'join_name' => 'accounts',
535 'module' => 'Accounts',
536 'dbType' => 'varchar',
537 'link' => 'accounts',
539 'source' => 'non-db',
540 'unified_search' => true,
542 'importable' => 'required',
546 'name' => 'account_id',
547 'vname' => 'LBL_ACCOUNT_ID',
549 'source' => 'non-db',
554 'name' => 'campaign_id',
555 'comment' => 'Campaign that generated lead',
556 'vname' => 'LBL_CAMPAIGN_ID',
560 'table' => 'campaigns',
562 'module' => 'Campaigns',
563 'reportable' => false,
564 'massupdate' => false,
565 'duplicate_merge' => 'disabled',
569 'name' => 'campaign_name',
571 'id_name' => 'campaign_id',
572 'vname' => 'LBL_CAMPAIGN',
574 'link' => 'campaign_opportunities',
576 'table' => 'campaigns',
577 'module' => 'Campaigns',
578 'source' => 'non-db',
580 'campaign_opportunities' =>
582 'name' => 'campaign_opportunities',
584 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
585 'relationship' => 'campaign_opportunities',
586 'source' => 'non-db',
590 'name' => 'lead_source',
591 'vname' => 'LBL_LEAD_SOURCE',
593 'options' => 'lead_source_dom',
595 'comment' => 'Source of the opportunity',
596 'merge_filter' => 'enabled',
601 'vname' => 'LBL_AMOUNT',
602 'type' => 'currency',
603 'dbType' => 'double',
604 'comment' => 'Unconverted amount of the opportunity',
605 'duplicate_merge' => 'disabled',
606 'importable' => 'required',
608 'options' => 'numeric_range_search_dom',
609 'enable_range_search' => '1',
613 'name' => 'amount_usdollar',
614 'vname' => 'LBL_AMOUNT_USDOLLAR',
615 'type' => 'currency',
617 'dbType' => 'double',
618 'disable_num_format' => true,
620 'comment' => 'Formatted amount of the opportunity',
624 'name' => 'currency_id',
626 'group' => 'currency_id',
627 'vname' => 'LBL_CURRENCY',
630 'name' => 'getCurrencyDropDown',
633 'reportable' => false,
634 'comment' => 'Currency used for display purposes',
638 'name' => 'currency_name',
640 'id_name' => 'currency_id',
641 'vname' => 'LBL_CURRENCY_NAME',
644 'table' => 'currencies',
645 'module' => 'Currencies',
646 'source' => 'non-db',
649 'name' => 'getCurrencyNameDropDown',
653 'duplicate_merge' => 'disabled',
657 'name' => 'currency_symbol',
659 'id_name' => 'currency_id',
660 'vname' => 'LBL_CURRENCY_SYMBOL',
663 'table' => 'currencies',
664 'module' => 'Currencies',
665 'source' => 'non-db',
668 'name' => 'getCurrencySymbolDropDown',
672 'duplicate_merge' => 'disabled',
676 'name' => 'date_closed',
677 'vname' => 'LBL_DATE_CLOSED',
680 'comment' => 'Expected or actual date the oppportunity will close',
681 'importable' => 'required',
683 'enable_range_search' => '1',
684 'options' => 'date_range_search_dom',
688 'name' => 'next_step',
689 'vname' => 'LBL_NEXT_STEP',
692 'comment' => 'The next step in the sales process',
693 'merge_filter' => 'enabled',
697 'name' => 'sales_stage',
698 'vname' => 'LBL_SALES_STAGE',
700 'options' => 'sales_stage_dom',
703 'comment' => 'Indication of progression towards closure',
704 'merge_filter' => 'enabled',
705 'importable' => 'required',
710 'name' => 'probability',
711 'vname' => 'LBL_PROBABILITY',
713 'dbType' => 'double',
715 'comment' => 'The probability of closure',
722 'merge_filter' => 'enabled',
726 'name' => 'accounts',
728 'relationship' => 'accounts_opportunities',
729 'source' => 'non-db',
730 'link_type' => 'one',
731 'module' => 'Accounts',
732 'bean_name' => 'Account',
733 'vname' => 'LBL_ACCOUNTS',
737 'name' => 'contacts',
739 'relationship' => 'opportunities_contacts',
740 'source' => 'non-db',
741 'module' => 'Contacts',
742 'bean_name' => 'Contact',
748 'options' => 'opportunity_relationship_type_dom',
751 'vname' => 'LBL_CONTACTS',
757 'relationship' => 'opportunity_tasks',
758 'source' => 'non-db',
759 'vname' => 'LBL_TASKS',
765 'relationship' => 'opportunity_notes',
766 'source' => 'non-db',
767 'vname' => 'LBL_NOTES',
771 'name' => 'meetings',
773 'relationship' => 'opportunity_meetings',
774 'source' => 'non-db',
775 'vname' => 'LBL_MEETINGS',
781 'relationship' => 'opportunity_calls',
782 'source' => 'non-db',
783 'vname' => 'LBL_CALLS',
789 'relationship' => 'emails_opportunities_rel',
790 'source' => 'non-db',
791 'vname' => 'LBL_EMAILS',
795 'name' => 'documents',
797 'relationship' => 'documents_opportunities',
798 'source' => 'non-db',
799 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
805 'relationship' => 'quotes_opportunities',
806 'source' => 'non-db',
807 'vname' => 'LBL_QUOTES',
813 'relationship' => 'projects_opportunities',
814 'source' => 'non-db',
815 'vname' => 'LBL_PROJECTS',
821 'relationship' => 'opportunity_leads',
822 'source' => 'non-db',
823 'vname' => 'LBL_LEADS',
827 'name' => 'campaigns',
829 'relationship' => 'opportunities_campaign',
830 'module' => 'CampaignLog',
831 'bean_name' => 'CampaignLog',
832 'source' => 'non-db',
833 'vname' => 'LBL_CAMPAIGNS',
837 'name' => 'campaign_link',
839 'relationship' => 'opportunities_campaign',
840 'vname' => 'LBL_CAMPAIGNS',
841 'link_type' => 'one',
842 'module' => 'Campaigns',
843 'bean_name' => 'Campaign',
844 'source' => 'non-db',
848 'name' => 'currencies',
850 'relationship' => 'opportunity_currencies',
851 'source' => 'non-db',
852 'vname' => 'LBL_CURRENCIES',
856 'name' => 'contracts',
858 'vname' => 'LBL_CONTRACTS',
859 'relationship' => 'contracts_opportunities',
860 'source' => 'non-db',
864 'options' => 'date_range_search_dom',
865 'enforced' => 'false',
867 'enable_range_search' => '1',
869 'source' => 'custom_fields',
870 'name' => 'customdate_c',
871 'vname' => 'LBL_CUSTOMDATE',
877 'importable' => 'true',
878 'duplicate_merge' => 'disabled',
879 'duplicate_merge_dom_value' => '0',
881 'reportable' => true,
882 'calculated' => false,
884 'id' => 'Opportunitiescustomdate_c',
885 'custom_module' => 'Opportunities',
887 'customdatetime_c' =>
889 'enforced' => 'false',
892 'source' => 'custom_fields',
893 'name' => 'customdatetime_c',
894 'vname' => 'LBL_CUSTOMDATETIME',
895 'type' => 'datetimecombo',
900 'importable' => 'true',
901 'duplicate_merge' => 'disabled',
902 'duplicate_merge_dom_value' => '0',
904 'reportable' => true,
905 'calculated' => false,
907 'enable_range_search' => false,
908 'dbType' => 'datetime',
909 'id' => 'Opportunitiescustomdatetime_c',
910 'custom_module' => 'Opportunities',