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['db']->query("DELETE FROM saved_search where name = 'Bug42378Test'");
49 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
50 $datetime_prefs = $GLOBALS['current_user']->getUserDateTimePreferences();
51 $GLOBALS['current_user']->setPreference('datef', 'm/d/Y', 0, 'global');
52 $GLOBALS['current_user']->save();
53 $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 . "', 'Bug42378Test', 'Opportunities', 0, '2011-03-10 17:05:27', '2011-03-10 17:05:27', '".$GLOBALS["current_user"]->id."', 'YTo0OTp7czoxMzoic2VhcmNoRm9ybVRhYiI7czoxNToiYWR2YW5jZWRfc2VhcmNoIjtzOjU6InF1ZXJ5IjtzOjQ6InRydWUiO3M6MTM6Im5hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjIxOiJhY2NvdW50X25hbWVfYWR2YW5jZWQiO3M6MDoiIjtzOjM0OiJjdXN0b21kYXRlX2NfYWR2YW5jZWRfcmFuZ2VfY2hvaWNlIjtzOjE6Ij0iO3M6Mjc6InJhbmdlX2N1c3RvbWRhdGVfY19hZHZhbmNlZCI7czoxMDoiMDMvMDEvMjAxMSI7czozMzoic3RhcnRfcmFuZ2VfY3VzdG9tZGF0ZV9jX2FkdmFuY2VkIjtzOjA6IiI7czozMToiZW5kX3JhbmdlX2N1c3RvbWRhdGVfY19hZHZhbmNlZCI7czowOiIiO3M6Mzg6ImN1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWRfcmFuZ2VfY2hvaWNlIjtzOjE6Ij0iO3M6MzE6InJhbmdlX2N1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWQiO3M6MTA6IjAzLzAyLzIwMTEiO3M6Mzc6InN0YXJ0X3JhbmdlX2N1c3RvbWRhdGV0aW1lX2NfYWR2YW5jZWQiO3M6MDoiIjtzOjM1OiJlbmRfcmFuZ2VfY3VzdG9tZGF0ZXRpbWVfY19hZHZhbmNlZCI7czowOiIiO3M6Mjg6ImFtb3VudF9hZHZhbmNlZF9yYW5nZV9jaG9pY2UiO3M6MToiPSI7czoyMToicmFuZ2VfYW1vdW50X2FkdmFuY2VkIjtzOjA6IiI7czoyNzoic3RhcnRfcmFuZ2VfYW1vdW50X2FkdmFuY2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Rlbj10cnVlIjtzOjIyOiJzdWdhcl90aGVtZV9nbV9jdXJyZW50IjtzOjM6IkFsbCI7czoxNToiZ2xvYmFsTGlua3NPcGVuIjtzOjQ6InRydWUiO3M6ODoiYWR2YW5jZWQiO2I6MTt9')");
56 public function tearDown()
58 $GLOBALS['db']->query("DELETE FROM saved_search where id = '{$this->saved_search_id}'");
59 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
60 unset($GLOBALS['current_user']);
64 * This test captures the scenario for date_modified field where range search is enabled
66 public function testSaveRangeDateFields()
68 require_once('modules/SavedSearch/SavedSearch.php');
69 $focus = new SavedSearch();
70 $focus->retrieve($this->saved_search_id);
71 $_REQUEST = unserialize(base64_decode($focus->contents));
72 $mockBean = new Bug42377MockOpportunity();
73 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
75 //Now retrieve what we have saved and test
76 $focus = new SavedSearch();
77 $focus->retrieve($this->saved_search_id);
78 $formatted_data = unserialize(base64_decode($focus->contents));
79 $this->assertEquals($formatted_data['range_date_modified_advanced'], '2011-03-01', "Assert that value is in db format ('2011-03-01')");
80 $this->assertEquals($formatted_data['start_range_date_entered_advanced'], '2011-03-01', "Assert that value is in db format ('2011-03-01')");
81 $this->assertEquals($formatted_data['end_range_date_entered_advanced'], '2011-03-05', "Assert that value is in db format ('2011-03-05')");
83 //Last check to see that the macro value is okay and preserved
84 $this->assertEquals($formatted_data['range_date_closed_advanced'], '[last_7_days]', "Assert that the macro date value [last_7_days] was preserved");
85 $this->assertEquals($formatted_data['date_closed_advanced_range_choice'], 'last_7_days', "Assert that the macro date value choice last_7_days was preserved");
89 * This test captures the scenario for date_modified field where range search is not enabled
91 public function testSaveDateFields()
93 require_once('modules/SavedSearch/SavedSearch.php');
94 $focus = new SavedSearch();
95 $focus->retrieve($this->saved_search_id);
96 $_REQUEST = unserialize(base64_decode($focus->contents));
97 unset($_REQUEST['start_range_date_modified_advanced']);
98 unset($_REQUEST['end_range_date_modified_advanced']);
99 unset($_REQUEST['range_date_modified_advanced']);
100 $_REQUEST['date_modified_advanced'] = '07/03/2009'; //Special date :)
101 $mockBean = new Bug42377MockOpportunity();
102 $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
104 //Now retrieve what we have saved and test
105 $focus = new SavedSearch();
106 $focus->retrieve($this->saved_search_id);
107 $formatted_data = unserialize(base64_decode($focus->contents));
108 $this->assertEquals($formatted_data['date_modified_advanced'], '2009-07-03', "Assert that value is in db format ('2009-07-03')");
110 //Now test that when we populate the search form, we bring it back to user's date format
111 $focus->retrieveSavedSearch($this->saved_search_id);
112 $focus->populateRequest();
113 $this->assertEquals($_REQUEST['date_modified_advanced'], '07/03/2009', "Assert that dates in db format were converted back to user's date preference");
115 //Take this a step further, assume date format now changes, will date be populated correctly?
116 global $current_user;
117 $current_user->setPreference('datef', 'd/m/Y', 0, 'global');
118 $current_user->save();
120 //Now test that when we populate the search form, we bring it back to user's date format
121 $focus->retrieveSavedSearch($this->saved_search_id);
122 $focus->populateRequest();
123 $this->assertEquals($_REQUEST['date_modified_advanced'], '03/07/2009', "Assert that dates in db format were converted back to user's date preference");
126 public function testStoreQuerySaveAndPopulate()
128 global $current_user, $timedate;
130 $storeQuery = new StoreQuery();
131 //Simulate a search request here
134 'module' => 'Opportunities',
136 'searchFormTab' => 'advanced_search',
138 'name_advanced' => '',
139 'account_name_advanced' => '',
140 'amount_advanced_range_choice' => '=',
141 'range_amount_advanced' => '',
142 'start_range_amount_advanced' => '',
143 'end_range_amount_advanced' => '',
144 'date_closed_advanced_range_choice' => '=',
145 'range_date_closed_advanced' => '09/01/2008',
146 'start_range_date_closed_advanced' => '',
147 'end_range_date_closed_advanced' => '',
148 'next_step_advanced' => '',
149 'update_fields_team_name_advanced_collection' => '',
150 'team_name_advanced_new_on_update' => false,
151 'team_name_advanced_allow_update' => '',
152 'team_name_advanced_allowed_to_check' => false,
153 'team_name_advanced_collection_0' => '',
154 'id_team_name_advanced_collection_0' => '',
155 'team_name_advanced_type' => 'any',
156 'favorites_only_advanced' => 0,
158 'saved_search_name' => '',
159 'search_module' => '',
160 'saved_search_action' => '',
161 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED',
162 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME',
164 'sortOrder' => 'ASC',
165 'button' => 'Search',
166 'saved_search_select' => '_none',
167 'sugar_user_theme' => 'Sugar',
168 'ModuleBuilder' => 'helpHidden=true',
169 'Contacts_divs' => 'quotes_v=#',
170 'sugar_theme_gm_current' => 'All',
171 'globalLinksOpen' => 'true',
172 'SQLiteManager_currentLangue' => '2',
173 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca',
176 $storeQuery->saveFromRequest('Opportunities');
178 $storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
179 $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');
181 //Test that value is converted to user date preferences when retrieved
182 unset($_REQUEST['range_date_closed_advanced']);
183 $storeQuery->loadQuery('Opportunities');
184 $storeQuery->populateRequest();
185 $this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
186 $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');
188 //Now say the user changes his date preferences and switches back to this StoredQuery
189 $current_user->setPreference('datef', 'Y.m.d', 0, 'global');
190 $current_user->save();
192 //Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
193 unset($_REQUEST['range_date_closed_advanced']);
194 $storeQuery->loadQuery('Opportunities');
195 $storeQuery->populateRequest();
196 $this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
197 $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');
203 class Bug42377MockOpportunity extends Opportunity
206 var $field_defs = array (
213 'reportable' => true,
214 'comment' => 'Unique identifier',
219 'vname' => 'LBL_OPPORTUNITY_NAME',
221 'dbType' => 'varchar',
223 'unified_search' => true,
224 'comment' => 'Name of the opportunity',
225 'merge_filter' => 'selected',
226 'importable' => 'required',
231 'name' => 'date_entered',
232 'vname' => 'LBL_DATE_ENTERED',
233 'type' => 'datetime',
234 'group' => 'created_by_name',
235 'comment' => 'Date record created',
236 'enable_range_search' => '1',
237 'options' => 'date_range_search_dom',
241 'name' => 'date_modified',
242 'vname' => 'LBL_DATE_MODIFIED',
243 'type' => 'datetime',
244 'group' => 'modified_by_name',
245 'comment' => 'Date record last modified',
246 'enable_range_search' => '1',
247 'options' => 'date_range_search_dom',
249 'modified_user_id' =>
251 'name' => 'modified_user_id',
252 'rname' => 'user_name',
253 'id_name' => 'modified_user_id',
254 'vname' => 'LBL_MODIFIED',
255 'type' => 'assigned_user_name',
258 'group' => 'modified_by_name',
260 'reportable' => true,
261 'comment' => 'User who last modified record',
263 'modified_by_name' =>
265 'name' => 'modified_by_name',
266 'vname' => 'LBL_MODIFIED_NAME',
268 'reportable' => false,
269 'source' => 'non-db',
270 'rname' => 'user_name',
272 'id_name' => 'modified_user_id',
274 'link' => 'modified_user_link',
275 'duplicate_merge' => 'disabled',
279 'name' => 'created_by',
280 'rname' => 'user_name',
281 'id_name' => 'modified_user_id',
282 'vname' => 'LBL_CREATED',
283 'type' => 'assigned_user_name',
287 'group' => 'created_by_name',
288 'comment' => 'User who created record',
292 'name' => 'created_by_name',
293 'vname' => 'LBL_CREATED',
295 'reportable' => false,
296 'link' => 'created_by_link',
297 'rname' => 'user_name',
298 'source' => 'non-db',
300 'id_name' => 'created_by',
302 'duplicate_merge' => 'disabled',
303 'importable' => 'false',
307 'name' => 'description',
308 'vname' => 'LBL_DESCRIPTION',
310 'comment' => 'Full text of the note',
317 'vname' => 'LBL_DELETED',
320 'reportable' => false,
321 'comment' => 'Record deletion indicator',
325 'name' => 'created_by_link',
327 'relationship' => 'opportunities_created_by',
328 'vname' => 'LBL_CREATED_USER',
329 'link_type' => 'one',
331 'bean_name' => 'User',
332 'source' => 'non-db',
334 'modified_user_link' =>
336 'name' => 'modified_user_link',
338 'relationship' => 'opportunities_modified_user',
339 'vname' => 'LBL_MODIFIED_USER',
340 'link_type' => 'one',
342 'bean_name' => 'User',
343 'source' => 'non-db',
345 'assigned_user_id' =>
347 'name' => 'assigned_user_id',
348 'rname' => 'user_name',
349 'id_name' => 'assigned_user_id',
350 'vname' => 'LBL_ASSIGNED_TO_ID',
351 'group' => 'assigned_user_name',
355 'reportable' => true,
359 'comment' => 'User ID assigned to record',
360 'duplicate_merge' => 'disabled',
362 'assigned_user_name' =>
364 'name' => 'assigned_user_name',
365 'link' => 'assigned_user_link',
366 'vname' => 'LBL_ASSIGNED_TO_NAME',
367 'rname' => 'user_name',
369 'reportable' => false,
370 'source' => 'non-db',
372 'id_name' => 'assigned_user_id',
374 'duplicate_merge' => 'disabled',
376 'assigned_user_link' =>
378 'name' => 'assigned_user_link',
380 'relationship' => 'opportunities_assigned_user',
381 'vname' => 'LBL_ASSIGNED_TO_USER',
382 'link_type' => 'one',
384 'bean_name' => 'User',
385 'source' => 'non-db',
386 'duplicate_merge' => 'enabled',
387 'rname' => 'user_name',
388 'id_name' => 'assigned_user_id',
394 'vname' => 'LBL_TEAM_ID',
395 'group' => 'team_name',
396 'reportable' => false,
398 'type' => 'team_list',
400 'comment' => 'Team ID for the account',
404 'name' => 'team_set_id',
406 'id_name' => 'team_set_id',
407 'vname' => 'LBL_TEAM_SET_ID',
415 'name' => 'team_count',
416 'rname' => 'team_count',
417 'id_name' => 'team_id',
418 'vname' => 'LBL_TEAMS',
419 'join_name' => 'ts1',
424 'link' => 'team_count_link',
425 'massupdate' => false,
427 'source' => 'non-db',
428 'importable' => 'false',
429 'reportable' => false,
430 'duplicate_merge' => 'disabled',
436 'name' => 'team_name',
437 'db_concat_fields' =>
442 'sort_on' => 'tj.name',
445 'id_name' => 'team_id',
446 'vname' => 'LBL_TEAMS',
451 'link' => 'team_link',
452 'massupdate' => false,
453 'dbType' => 'varchar',
454 'source' => 'non-db',
456 'custom_type' => 'teamset',
460 'name' => 'team_link',
462 'relationship' => 'opportunities_team',
463 'vname' => 'LBL_TEAMS_LINK',
464 'link_type' => 'one',
466 'bean_name' => 'Team',
467 'source' => 'non-db',
468 'duplicate_merge' => 'disabled',
473 'name' => 'team_count_link',
475 'relationship' => 'opportunities_team_count_relationship',
476 'link_type' => 'one',
478 'bean_name' => 'TeamSet',
479 'source' => 'non-db',
480 'duplicate_merge' => 'disabled',
481 'reportable' => false,
488 'relationship' => 'opportunities_teams',
489 'bean_filter_field' => 'team_set_id',
490 'rhs_key_override' => true,
491 'source' => 'non-db',
492 'vname' => 'LBL_TEAMS',
493 'link_class' => 'TeamSetLink',
494 'link_file' => 'modules/Teams/TeamSetLink.php',
496 'reportable' => false,
498 'opportunity_type' =>
500 'name' => 'opportunity_type',
501 'vname' => 'LBL_TYPE',
503 'options' => 'opportunity_type_dom',
506 'comment' => 'Type of opportunity (ex: Existing, New)',
507 'merge_filter' => 'enabled',
511 'name' => 'account_name',
513 'id_name' => 'account_id',
514 'vname' => 'LBL_ACCOUNT_NAME',
516 'table' => 'accounts',
517 'join_name' => 'accounts',
519 'module' => 'Accounts',
520 'dbType' => 'varchar',
521 'link' => 'accounts',
523 'source' => 'non-db',
524 'unified_search' => true,
526 'importable' => 'required',
530 'name' => 'account_id',
531 'vname' => 'LBL_ACCOUNT_ID',
533 'source' => 'non-db',
538 'name' => 'campaign_id',
539 'comment' => 'Campaign that generated lead',
540 'vname' => 'LBL_CAMPAIGN_ID',
544 'table' => 'campaigns',
546 'module' => 'Campaigns',
547 'reportable' => false,
548 'massupdate' => false,
549 'duplicate_merge' => 'disabled',
553 'name' => 'campaign_name',
555 'id_name' => 'campaign_id',
556 'vname' => 'LBL_CAMPAIGN',
558 'link' => 'campaign_opportunities',
560 'table' => 'campaigns',
561 'module' => 'Campaigns',
562 'source' => 'non-db',
564 'campaign_opportunities' =>
566 'name' => 'campaign_opportunities',
568 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
569 'relationship' => 'campaign_opportunities',
570 'source' => 'non-db',
574 'name' => 'lead_source',
575 'vname' => 'LBL_LEAD_SOURCE',
577 'options' => 'lead_source_dom',
579 'comment' => 'Source of the opportunity',
580 'merge_filter' => 'enabled',
585 'vname' => 'LBL_AMOUNT',
586 'type' => 'currency',
587 'dbType' => 'double',
588 'comment' => 'Unconverted amount of the opportunity',
589 'duplicate_merge' => 'disabled',
590 'importable' => 'required',
592 'options' => 'numeric_range_search_dom',
593 'enable_range_search' => '1',
597 'name' => 'amount_usdollar',
598 'vname' => 'LBL_AMOUNT_USDOLLAR',
599 'type' => 'currency',
601 'dbType' => 'double',
602 'disable_num_format' => true,
604 'comment' => 'Formatted amount of the opportunity',
608 'name' => 'currency_id',
610 'group' => 'currency_id',
611 'vname' => 'LBL_CURRENCY',
614 'name' => 'getCurrencyDropDown',
617 'reportable' => false,
618 'comment' => 'Currency used for display purposes',
622 'name' => 'currency_name',
624 'id_name' => 'currency_id',
625 'vname' => 'LBL_CURRENCY_NAME',
628 'table' => 'currencies',
629 'module' => 'Currencies',
630 'source' => 'non-db',
633 'name' => 'getCurrencyNameDropDown',
637 'duplicate_merge' => 'disabled',
641 'name' => 'currency_symbol',
643 'id_name' => 'currency_id',
644 'vname' => 'LBL_CURRENCY_SYMBOL',
647 'table' => 'currencies',
648 'module' => 'Currencies',
649 'source' => 'non-db',
652 'name' => 'getCurrencySymbolDropDown',
656 'duplicate_merge' => 'disabled',
660 'name' => 'date_closed',
661 'vname' => 'LBL_DATE_CLOSED',
664 'comment' => 'Expected or actual date the oppportunity will close',
665 'importable' => 'required',
667 'enable_range_search' => '1',
668 'options' => 'date_range_search_dom',
672 'name' => 'next_step',
673 'vname' => 'LBL_NEXT_STEP',
676 'comment' => 'The next step in the sales process',
677 'merge_filter' => 'enabled',
681 'name' => 'sales_stage',
682 'vname' => 'LBL_SALES_STAGE',
684 'options' => 'sales_stage_dom',
687 'comment' => 'Indication of progression towards closure',
688 'merge_filter' => 'enabled',
689 'importable' => 'required',
694 'name' => 'probability',
695 'vname' => 'LBL_PROBABILITY',
697 'dbType' => 'double',
699 'comment' => 'The probability of closure',
706 'merge_filter' => 'enabled',
710 'name' => 'accounts',
712 'relationship' => 'accounts_opportunities',
713 'source' => 'non-db',
714 'link_type' => 'one',
715 'module' => 'Accounts',
716 'bean_name' => 'Account',
717 'vname' => 'LBL_ACCOUNTS',
721 'name' => 'contacts',
723 'relationship' => 'opportunities_contacts',
724 'source' => 'non-db',
725 'module' => 'Contacts',
726 'bean_name' => 'Contact',
732 'options' => 'opportunity_relationship_type_dom',
735 'vname' => 'LBL_CONTACTS',
741 'relationship' => 'opportunity_tasks',
742 'source' => 'non-db',
743 'vname' => 'LBL_TASKS',
749 'relationship' => 'opportunity_notes',
750 'source' => 'non-db',
751 'vname' => 'LBL_NOTES',
755 'name' => 'meetings',
757 'relationship' => 'opportunity_meetings',
758 'source' => 'non-db',
759 'vname' => 'LBL_MEETINGS',
765 'relationship' => 'opportunity_calls',
766 'source' => 'non-db',
767 'vname' => 'LBL_CALLS',
773 'relationship' => 'emails_opportunities_rel',
774 'source' => 'non-db',
775 'vname' => 'LBL_EMAILS',
779 'name' => 'documents',
781 'relationship' => 'documents_opportunities',
782 'source' => 'non-db',
783 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
789 'relationship' => 'quotes_opportunities',
790 'source' => 'non-db',
791 'vname' => 'LBL_QUOTES',
797 'relationship' => 'projects_opportunities',
798 'source' => 'non-db',
799 'vname' => 'LBL_PROJECTS',
805 'relationship' => 'opportunity_leads',
806 'source' => 'non-db',
807 'vname' => 'LBL_LEADS',
811 'name' => 'campaigns',
813 'relationship' => 'opportunities_campaign',
814 'module' => 'CampaignLog',
815 'bean_name' => 'CampaignLog',
816 'source' => 'non-db',
817 'vname' => 'LBL_CAMPAIGNS',
821 'name' => 'campaign_link',
823 'relationship' => 'opportunities_campaign',
824 'vname' => 'LBL_CAMPAIGNS',
825 'link_type' => 'one',
826 'module' => 'Campaigns',
827 'bean_name' => 'Campaign',
828 'source' => 'non-db',
832 'name' => 'currencies',
834 'relationship' => 'opportunity_currencies',
835 'source' => 'non-db',
836 'vname' => 'LBL_CURRENCIES',
840 'name' => 'contracts',
842 'vname' => 'LBL_CONTRACTS',
843 'relationship' => 'contracts_opportunities',
844 'source' => 'non-db',
848 'options' => 'date_range_search_dom',
849 'enforced' => 'false',
851 'enable_range_search' => '1',
853 'source' => 'custom_fields',
854 'name' => 'customdate_c',
855 'vname' => 'LBL_CUSTOMDATE',
861 'importable' => 'true',
862 'duplicate_merge' => 'disabled',
863 'duplicate_merge_dom_value' => '0',
865 'reportable' => true,
866 'calculated' => false,
868 'id' => 'Opportunitiescustomdate_c',
869 'custom_module' => 'Opportunities',
871 'customdatetime_c' =>
873 'enforced' => 'false',
876 'source' => 'custom_fields',
877 'name' => 'customdatetime_c',
878 'vname' => 'LBL_CUSTOMDATETIME',
879 'type' => 'datetimecombo',
884 'importable' => 'true',
885 'duplicate_merge' => 'disabled',
886 'duplicate_merge_dom_value' => '0',
888 'reportable' => true,
889 'calculated' => false,
891 'enable_range_search' => false,
892 'dbType' => 'datetime',
893 'id' => 'Opportunitiescustomdatetime_c',
894 'custom_module' => 'Opportunities',