2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 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 Bug42378Test extends Sugar_PHPUnit_Framework_TestCase
43 public function setUp()
45 $this->saved_search_id = md5(gmmktime());
47 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
48 $datetime_prefs = $GLOBALS['current_user']->getUserDateTimePreferences();
49 $GLOBALS['current_user']->setPreference('datef', 'm/d/Y', 0, 'global');
50 $GLOBALS['current_user']->save();
51 $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."', 'YTo0OTp7czoxMzoic2VhcmNoRm9ybVRhYiI7czoxNToiYWR2YW5jZWRfc2VhcmNoIjtzOjU6InF1ZXJ5IjtzOjQ6InRydWUiO3M6MTM6Im5hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjIxOiJhY2NvdW50X25hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjM0OiJjdXN0b21kYXRlX2NfYWR2YW5jZWRfcmFuZ2VfY2hvaWNlIjtzOjE6Ij0iO3M6Mjc6InJhbmdlX2N1c3RvbWRhdGVfY19hZHZhbmNlZCI7czoxMDoiMDMvMDEvMjAxMSI7czozMzoic3RhcnRfcmFuZ2VfY3VzdG9tZGF0ZV9jX2FkdmFuY2VkIjtzOjA6IiI7czozMToiZW5kX3JhbmdlX2N1c3RvbWRhdGVfY19hZHZhbmNlZCI7czowOiIiO3M6Mzg6ImN1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWRfcmFuZ2VfY2hvaWNlIjtzOjE6Ij0iO3M6MzE6InJhbmdlX2N1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWQiO3M6MTA6IjAzLzAyLzIwMTEiO3M6Mzc6InN0YXJ0X3JhbmdlX2N1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWQiO3M6MDoiIjtzOjM1OiJlbmRfcmFuZ2VfY3VzdG9tZGF0ZXRpbWVfY19hZHZhbmNlZCI7czowOiIiO3M6Mjg6ImFtb3VudF9hZHZhbmNlZF9yYW5nZV9jaG9pY2UiO3M6MToiPSI7czoyMToicmFuZ2VfYW1vdW50X2FkdmFuY2VkIjtzOjA6IiI7czoyNzoic3RhcnRfcmFuZ2VfYW1vdW50X2FkdmFuY2VkIjtzOjA6IiI7czoyNToiZW5kX3JhbmdlX2Ftb3VudF9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yZW50IjtzOjM6IkFsbCI7czoxNToiZ2xvYmFsTGlua3NPcGVuIjtzOjQ6InRydWUiO3M6ODoiYWR2YW5jZWQiO2I6MTt9')");
54 public function tearDown()
56 //$GLOBALS['db']->query("DELETE FROM saved_search where id = '{$this->saved_search_id}'");
57 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
58 unset($GLOBALS['current_user']);
62 * This test captures the scenario for date_modified field where range search is enabled
64 public function testSaveRangeDateFields()
66 require_once('modules/SavedSearch/SavedSearch.php');
67 $focus = new SavedSearch();
68 $focus->retrieve($this->saved_search_id);
69 $_REQUEST = unserialize(base64_decode($focus->contents));
70 $mockBean = new Bug42377MockOpportunity();
71 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
73 //Now retrieve what we have saved and test
74 $focus = new SavedSearch();
75 $focus->retrieve($this->saved_search_id);
76 $formatted_data = unserialize(base64_decode($focus->contents));
77 $this->assertEquals($formatted_data['range_date_modified_advanced'], '2011-03-01', "Assert that value is in db format ('2011-03-01')");
78 $this->assertEquals($formatted_data['start_range_date_entered_advanced'], '2011-03-01', "Assert that value is in db format ('2011-03-01')");
79 $this->assertEquals($formatted_data['end_range_date_entered_advanced'], '2011-03-05', "Assert that value is in db format ('2011-03-05')");
81 //Last check to see that the macro value is okay and preserved
82 $this->assertEquals($formatted_data['range_date_closed_advanced'], '[last_7_days]', "Assert that the macro date value [last_7_days] was preserved");
83 $this->assertEquals($formatted_data['date_closed_advanced_range_choice'], 'last_7_days', "Assert that the macro date value choice last_7_days was preserved");
87 * This test captures the scenario for date_modified field where range search is not enabled
89 public function testSaveDateFields()
91 require_once('modules/SavedSearch/SavedSearch.php');
92 $focus = new SavedSearch();
93 $focus->retrieve($this->saved_search_id);
94 $_REQUEST = unserialize(base64_decode($focus->contents));
95 unset($_REQUEST['start_range_date_modified_advanced']);
96 unset($_REQUEST['end_range_date_modified_advanced']);
97 unset($_REQUEST['range_date_modified_advanced']);
98 $_REQUEST['date_modified_advanced'] = '07/03/2009'; //Special date :)
99 $mockBean = new Bug42377MockOpportunity();
100 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
102 //Now retrieve what we have saved and test
103 $focus = new SavedSearch();
104 $focus->retrieve($this->saved_search_id);
105 $formatted_data = unserialize(base64_decode($focus->contents));
106 $this->assertEquals($formatted_data['date_modified_advanced'], '2009-07-03', "Assert that value is in db format ('2009-07-03')");
108 //Now test that when we populate the search form, we bring it back to user's date format
109 $focus->retrieveSavedSearch($this->saved_search_id);
110 $focus->populateRequest();
111 $this->assertEquals($_REQUEST['date_modified_advanced'], '07/03/2009', "Assert that dates in db format were converted back to user's date preference");
113 //Take this a step further, assume date format now changes, will date be populated correctly?
114 global $current_user;
115 $current_user->setPreference('datef', 'd/m/Y', 0, 'global');
116 $current_user->save();
118 //Now test that when we populate the search form, we bring it back to user's date format
119 $focus->retrieveSavedSearch($this->saved_search_id);
120 $focus->populateRequest();
121 $this->assertEquals($_REQUEST['date_modified_advanced'], '03/07/2009', "Assert that dates in db format were converted back to user's date preference");
124 public function testStoreQuerySaveAndPopulate()
126 global $current_user, $timedate;
128 $storeQuery = new StoreQuery();
129 //Simulate a search request here
132 'module' => 'Opportunities',
134 'searchFormTab' => 'advanced_search',
136 'name_advanced' => '',
137 'account_name_advanced' => '',
138 'amount_advanced_range_choice' => '=',
139 'range_amount_advanced' => '',
140 'start_range_amount_advanced' => '',
141 'end_range_amount_advanced' => '',
142 'date_closed_advanced_range_choice' => '=',
143 'range_date_closed_advanced' => '09/01/2008',
144 'start_range_date_closed_advanced' => '',
145 'end_range_date_closed_advanced' => '',
146 'next_step_advanced' => '',
147 'update_fields_team_name_advanced_collection' => '',
148 'team_name_advanced_new_on_update' => false,
149 'team_name_advanced_allow_update' => '',
150 'team_name_advanced_allowed_to_check' => false,
151 'team_name_advanced_collection_0' => '',
152 'id_team_name_advanced_collection_0' => '',
153 'team_name_advanced_type' => 'any',
154 'favorites_only_advanced' => 0,
156 'saved_search_name' => '',
157 'search_module' => '',
158 'saved_search_action' => '',
159 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED',
160 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME',
162 'sortOrder' => 'ASC',
163 'button' => 'Search',
164 'saved_search_select' => '_none',
165 'sugar_user_theme' => 'Sugar',
166 'ModuleBuilder' => 'helpHidden=true',
167 'Contacts_divs' => 'quotes_v=#',
168 'sugar_theme_gm_current' => 'All',
169 'globalLinksOpen' => 'true',
170 'SQLiteManager_currentLangue' => '2',
171 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca',
174 $storeQuery->saveFromRequest('Opportunities');
176 $storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
177 $this->assertEquals($storedSearch['range_date_closed_advanced'], '2008-09-01', 'Assert that search date 09/02/2008 was saved in db format 2008-09-01');
179 //Test that value is converted to user date preferences when retrieved
180 unset($_REQUEST['range_date_closed_advanced']);
181 $storeQuery->loadQuery('Opportunities');
182 $storeQuery->populateRequest();
183 $this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
184 $this->assertEquals($_REQUEST['range_date_closed_advanced'], '09/01/2008', 'Assert that search date in db_format 2008-09-01 was converted to user date preference 09/01/2008');
186 //Now say the user changes his date preferences and switches back to this StoredQuery
187 $current_user->setPreference('datef', 'Y.m.d', 0, 'global');
188 $current_user->save();
190 //Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
191 unset($_REQUEST['range_date_closed_advanced']);
192 $storeQuery->loadQuery('Opportunities');
193 $storeQuery->populateRequest();
194 $this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
195 $this->assertEquals($_REQUEST['range_date_closed_advanced'], '2008.09.01', 'Assert that search date in db_format 2008-09-01 was converted to user date preference 2008.09.01');
201 class Bug42377MockOpportunity extends Opportunity
204 var $field_defs = array (
211 'reportable' => true,
212 'comment' => 'Unique identifier',
217 'vname' => 'LBL_OPPORTUNITY_NAME',
219 'dbType' => 'varchar',
221 'unified_search' => true,
222 'comment' => 'Name of the opportunity',
223 'merge_filter' => 'selected',
224 'importable' => 'required',
229 'name' => 'date_entered',
230 'vname' => 'LBL_DATE_ENTERED',
231 'type' => 'datetime',
232 'group' => 'created_by_name',
233 'comment' => 'Date record created',
234 'enable_range_search' => '1',
235 'options' => 'date_range_search_dom',
239 'name' => 'date_modified',
240 'vname' => 'LBL_DATE_MODIFIED',
241 'type' => 'datetime',
242 'group' => 'modified_by_name',
243 'comment' => 'Date record last modified',
244 'enable_range_search' => '1',
245 'options' => 'date_range_search_dom',
247 'modified_user_id' =>
249 'name' => 'modified_user_id',
250 'rname' => 'user_name',
251 'id_name' => 'modified_user_id',
252 'vname' => 'LBL_MODIFIED',
253 'type' => 'assigned_user_name',
256 'group' => 'modified_by_name',
258 'reportable' => true,
259 'comment' => 'User who last modified record',
261 'modified_by_name' =>
263 'name' => 'modified_by_name',
264 'vname' => 'LBL_MODIFIED_NAME',
266 'reportable' => false,
267 'source' => 'non-db',
268 'rname' => 'user_name',
270 'id_name' => 'modified_user_id',
272 'link' => 'modified_user_link',
273 'duplicate_merge' => 'disabled',
277 'name' => 'created_by',
278 'rname' => 'user_name',
279 'id_name' => 'modified_user_id',
280 'vname' => 'LBL_CREATED',
281 'type' => 'assigned_user_name',
285 'group' => 'created_by_name',
286 'comment' => 'User who created record',
290 'name' => 'created_by_name',
291 'vname' => 'LBL_CREATED',
293 'reportable' => false,
294 'link' => 'created_by_link',
295 'rname' => 'user_name',
296 'source' => 'non-db',
298 'id_name' => 'created_by',
300 'duplicate_merge' => 'disabled',
301 'importable' => 'false',
305 'name' => 'description',
306 'vname' => 'LBL_DESCRIPTION',
308 'comment' => 'Full text of the note',
315 'vname' => 'LBL_DELETED',
318 'reportable' => false,
319 'comment' => 'Record deletion indicator',
323 'name' => 'created_by_link',
325 'relationship' => 'opportunities_created_by',
326 'vname' => 'LBL_CREATED_USER',
327 'link_type' => 'one',
329 'bean_name' => 'User',
330 'source' => 'non-db',
332 'modified_user_link' =>
334 'name' => 'modified_user_link',
336 'relationship' => 'opportunities_modified_user',
337 'vname' => 'LBL_MODIFIED_USER',
338 'link_type' => 'one',
340 'bean_name' => 'User',
341 'source' => 'non-db',
343 'assigned_user_id' =>
345 'name' => 'assigned_user_id',
346 'rname' => 'user_name',
347 'id_name' => 'assigned_user_id',
348 'vname' => 'LBL_ASSIGNED_TO_ID',
349 'group' => 'assigned_user_name',
353 'reportable' => true,
357 'comment' => 'User ID assigned to record',
358 'duplicate_merge' => 'disabled',
360 'assigned_user_name' =>
362 'name' => 'assigned_user_name',
363 'link' => 'assigned_user_link',
364 'vname' => 'LBL_ASSIGNED_TO_NAME',
365 'rname' => 'user_name',
367 'reportable' => false,
368 'source' => 'non-db',
370 'id_name' => 'assigned_user_id',
372 'duplicate_merge' => 'disabled',
374 'assigned_user_link' =>
376 'name' => 'assigned_user_link',
378 'relationship' => 'opportunities_assigned_user',
379 'vname' => 'LBL_ASSIGNED_TO_USER',
380 'link_type' => 'one',
382 'bean_name' => 'User',
383 'source' => 'non-db',
384 'duplicate_merge' => 'enabled',
385 'rname' => 'user_name',
386 'id_name' => 'assigned_user_id',
392 'vname' => 'LBL_TEAM_ID',
393 'group' => 'team_name',
394 'reportable' => false,
396 'type' => 'team_list',
398 'comment' => 'Team ID for the account',
402 'name' => 'team_set_id',
404 'id_name' => 'team_set_id',
405 'vname' => 'LBL_TEAM_SET_ID',
413 'name' => 'team_count',
414 'rname' => 'team_count',
415 'id_name' => 'team_id',
416 'vname' => 'LBL_TEAMS',
417 'join_name' => 'ts1',
422 'link' => 'team_count_link',
423 'massupdate' => false,
425 'source' => 'non-db',
426 'importable' => 'false',
427 'reportable' => false,
428 'duplicate_merge' => 'disabled',
434 'name' => 'team_name',
435 'db_concat_fields' =>
440 'sort_on' => 'tj.name',
443 'id_name' => 'team_id',
444 'vname' => 'LBL_TEAMS',
449 'link' => 'team_link',
450 'massupdate' => false,
451 'dbType' => 'varchar',
452 'source' => 'non-db',
454 'custom_type' => 'teamset',
458 'name' => 'team_link',
460 'relationship' => 'opportunities_team',
461 'vname' => 'LBL_TEAMS_LINK',
462 'link_type' => 'one',
464 'bean_name' => 'Team',
465 'source' => 'non-db',
466 'duplicate_merge' => 'disabled',
471 'name' => 'team_count_link',
473 'relationship' => 'opportunities_team_count_relationship',
474 'link_type' => 'one',
476 'bean_name' => 'TeamSet',
477 'source' => 'non-db',
478 'duplicate_merge' => 'disabled',
479 'reportable' => false,
486 'relationship' => 'opportunities_teams',
487 'bean_filter_field' => 'team_set_id',
488 'rhs_key_override' => true,
489 'source' => 'non-db',
490 'vname' => 'LBL_TEAMS',
491 'link_class' => 'TeamSetLink',
492 'link_file' => 'modules/Teams/TeamSetLink.php',
494 'reportable' => false,
496 'opportunity_type' =>
498 'name' => 'opportunity_type',
499 'vname' => 'LBL_TYPE',
501 'options' => 'opportunity_type_dom',
504 'comment' => 'Type of opportunity (ex: Existing, New)',
505 'merge_filter' => 'enabled',
509 'name' => 'account_name',
511 'id_name' => 'account_id',
512 'vname' => 'LBL_ACCOUNT_NAME',
514 'table' => 'accounts',
515 'join_name' => 'accounts',
517 'module' => 'Accounts',
518 'dbType' => 'varchar',
519 'link' => 'accounts',
521 'source' => 'non-db',
522 'unified_search' => true,
524 'importable' => 'required',
528 'name' => 'account_id',
529 'vname' => 'LBL_ACCOUNT_ID',
531 'source' => 'non-db',
536 'name' => 'campaign_id',
537 'comment' => 'Campaign that generated lead',
538 'vname' => 'LBL_CAMPAIGN_ID',
542 'table' => 'campaigns',
544 'module' => 'Campaigns',
545 'reportable' => false,
546 'massupdate' => false,
547 'duplicate_merge' => 'disabled',
551 'name' => 'campaign_name',
553 'id_name' => 'campaign_id',
554 'vname' => 'LBL_CAMPAIGN',
556 'link' => 'campaign_opportunities',
558 'table' => 'campaigns',
559 'module' => 'Campaigns',
560 'source' => 'non-db',
562 'campaign_opportunities' =>
564 'name' => 'campaign_opportunities',
566 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
567 'relationship' => 'campaign_opportunities',
568 'source' => 'non-db',
572 'name' => 'lead_source',
573 'vname' => 'LBL_LEAD_SOURCE',
575 'options' => 'lead_source_dom',
577 'comment' => 'Source of the opportunity',
578 'merge_filter' => 'enabled',
583 'vname' => 'LBL_AMOUNT',
584 'type' => 'currency',
585 'dbType' => 'double',
586 'comment' => 'Unconverted amount of the opportunity',
587 'duplicate_merge' => 'disabled',
588 'importable' => 'required',
590 'options' => 'numeric_range_search_dom',
591 'enable_range_search' => '1',
595 'name' => 'amount_usdollar',
596 'vname' => 'LBL_AMOUNT_USDOLLAR',
597 'type' => 'currency',
599 'dbType' => 'double',
600 'disable_num_format' => true,
602 'comment' => 'Formatted amount of the opportunity',
606 'name' => 'currency_id',
608 'group' => 'currency_id',
609 'vname' => 'LBL_CURRENCY',
612 'name' => 'getCurrencyDropDown',
615 'reportable' => false,
616 'comment' => 'Currency used for display purposes',
620 'name' => 'currency_name',
622 'id_name' => 'currency_id',
623 'vname' => 'LBL_CURRENCY_NAME',
626 'table' => 'currencies',
627 'module' => 'Currencies',
628 'source' => 'non-db',
631 'name' => 'getCurrencyNameDropDown',
635 'duplicate_merge' => 'disabled',
639 'name' => 'currency_symbol',
641 'id_name' => 'currency_id',
642 'vname' => 'LBL_CURRENCY_SYMBOL',
645 'table' => 'currencies',
646 'module' => 'Currencies',
647 'source' => 'non-db',
650 'name' => 'getCurrencySymbolDropDown',
654 'duplicate_merge' => 'disabled',
658 'name' => 'date_closed',
659 'vname' => 'LBL_DATE_CLOSED',
662 'comment' => 'Expected or actual date the oppportunity will close',
663 'importable' => 'required',
665 'enable_range_search' => '1',
666 'options' => 'date_range_search_dom',
670 'name' => 'next_step',
671 'vname' => 'LBL_NEXT_STEP',
674 'comment' => 'The next step in the sales process',
675 'merge_filter' => 'enabled',
679 'name' => 'sales_stage',
680 'vname' => 'LBL_SALES_STAGE',
682 'options' => 'sales_stage_dom',
685 'comment' => 'Indication of progression towards closure',
686 'merge_filter' => 'enabled',
687 'importable' => 'required',
692 'name' => 'probability',
693 'vname' => 'LBL_PROBABILITY',
695 'dbType' => 'double',
697 'comment' => 'The probability of closure',
704 'merge_filter' => 'enabled',
708 'name' => 'accounts',
710 'relationship' => 'accounts_opportunities',
711 'source' => 'non-db',
712 'link_type' => 'one',
713 'module' => 'Accounts',
714 'bean_name' => 'Account',
715 'vname' => 'LBL_ACCOUNTS',
719 'name' => 'contacts',
721 'relationship' => 'opportunities_contacts',
722 'source' => 'non-db',
723 'module' => 'Contacts',
724 'bean_name' => 'Contact',
730 'options' => 'opportunity_relationship_type_dom',
733 'vname' => 'LBL_CONTACTS',
739 'relationship' => 'opportunity_tasks',
740 'source' => 'non-db',
741 'vname' => 'LBL_TASKS',
747 'relationship' => 'opportunity_notes',
748 'source' => 'non-db',
749 'vname' => 'LBL_NOTES',
753 'name' => 'meetings',
755 'relationship' => 'opportunity_meetings',
756 'source' => 'non-db',
757 'vname' => 'LBL_MEETINGS',
763 'relationship' => 'opportunity_calls',
764 'source' => 'non-db',
765 'vname' => 'LBL_CALLS',
771 'relationship' => 'emails_opportunities_rel',
772 'source' => 'non-db',
773 'vname' => 'LBL_EMAILS',
777 'name' => 'documents',
779 'relationship' => 'documents_opportunities',
780 'source' => 'non-db',
781 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
787 'relationship' => 'quotes_opportunities',
788 'source' => 'non-db',
789 'vname' => 'LBL_QUOTES',
795 'relationship' => 'projects_opportunities',
796 'source' => 'non-db',
797 'vname' => 'LBL_PROJECTS',
803 'relationship' => 'opportunity_leads',
804 'source' => 'non-db',
805 'vname' => 'LBL_LEADS',
809 'name' => 'campaigns',
811 'relationship' => 'opportunities_campaign',
812 'module' => 'CampaignLog',
813 'bean_name' => 'CampaignLog',
814 'source' => 'non-db',
815 'vname' => 'LBL_CAMPAIGNS',
819 'name' => 'campaign_link',
821 'relationship' => 'opportunities_campaign',
822 'vname' => 'LBL_CAMPAIGNS',
823 'link_type' => 'one',
824 'module' => 'Campaigns',
825 'bean_name' => 'Campaign',
826 'source' => 'non-db',
830 'name' => 'currencies',
832 'relationship' => 'opportunity_currencies',
833 'source' => 'non-db',
834 'vname' => 'LBL_CURRENCIES',
838 'name' => 'contracts',
840 'vname' => 'LBL_CONTRACTS',
841 'relationship' => 'contracts_opportunities',
842 'source' => 'non-db',
846 'options' => 'date_range_search_dom',
847 'enforced' => 'false',
849 'enable_range_search' => '1',
851 'source' => 'custom_fields',
852 'name' => 'customdate_c',
853 'vname' => 'LBL_CUSTOMDATE',
859 'importable' => 'true',
860 'duplicate_merge' => 'disabled',
861 'duplicate_merge_dom_value' => '0',
863 'reportable' => true,
864 'calculated' => false,
866 'id' => 'Opportunitiescustomdate_c',
867 'custom_module' => 'Opportunities',
869 'customdatetime_c' =>
871 'enforced' => 'false',
874 'source' => 'custom_fields',
875 'name' => 'customdatetime_c',
876 'vname' => 'LBL_CUSTOMDATETIME',
877 'type' => 'datetimecombo',
882 'importable' => 'true',
883 'duplicate_merge' => 'disabled',
884 'duplicate_merge_dom_value' => '0',
886 'reportable' => true,
887 'calculated' => false,
889 'enable_range_search' => false,
890 'dbType' => 'datetime',
891 'id' => 'Opportunitiescustomdatetime_c',
892 'custom_module' => 'Opportunities',