]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/generic/SugarWidgets/Bug45716.php
Merge pull request #126 from telematika/master
[Github/sugarcrm.git] / tests / include / generic / SugarWidgets / Bug45716.php
1 <?php
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
5  * 
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.
12  * 
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
16  * details.
17  * 
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
21  * 02110-1301 USA.
22  * 
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.
25  * 
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.
29  * 
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  ********************************************************************************/
36
37
38 require_once('modules/Reports/Report.php');
39 require_once('include/generic/LayoutManager.php');
40 require_once('include/generic/SugarWidgets/SugarWidgetFieldrelate.php');
41
42 class Bug45716Helper {
43     public $all_fields = array (
44         'self:account_id' => 
45         array (
46             'name' => 'account_id',
47             'vname' => 'LBL_ACCOUNT_ID',
48             'type' => 'id',
49             'source' => 'non-db',
50             'audited' => true,
51             'module' => 'Opportunities',
52             'real_table' => 'opportunities',
53             ),
54         'self:account_id_c' => 
55         array (
56             'required' => false,
57             'source' => 'custom_fields',
58             'name' => 'account_id_c',
59             'vname' => 'LBL_LIST_RELATED_TO',
60             'type' => 'id',
61             'massupdate' => '0',
62             'default' => NULL,
63             'comments' => '',
64             'help' => '',
65             'importable' => 'true',
66             'duplicate_merge' => 'disabled',
67             'duplicate_merge_dom_value' => '0',
68             'audited' => false,
69             'reportable' => false,
70             'unified_search' => false,
71             'calculated' => false,
72             'len' => '36',
73             'size' => '20',
74             'id' => 'Opportunitiesaccount_id_c',
75             'custom_module' => 'Opportunities',
76             'module' => 'Opportunities',
77             'real_table' => 'opportunities_cstm',
78             ),
79         'self:account_link_c' => 
80         array (
81             'dependency' => '',
82             'required' => false,
83             'source' => 'non-db',
84             'name' => 'account_link_c',
85             'vname' => 'LBL_ACCOUNT_LINK',
86             'type' => 'relate',
87             'massupdate' => '0',
88             'default' => NULL,
89             'comments' => '',
90             'help' => '',
91             'importable' => 'true',
92             'duplicate_merge' => 'disabled',
93             'duplicate_merge_dom_value' => '0',
94             'audited' => false,
95             'reportable' => true,
96             'unified_search' => false,
97             'calculated' => false,
98             'len' => '255',
99             'size' => '20',
100             'id_name' => 'account_id_c',
101             'ext2' => 'Accounts',
102             'module' => 'Opportunities',
103             'rname' => 'name',
104             'quicksearch' => 'enabled',
105             'studio' => 'visible',
106             'id' => 'Opportunitiesaccount_link_c',
107             'custom_module' => 'Opportunities',
108             'real_table' => 'opportunities_cstm',
109             'secondary_table' => 'accounts',
110             ),
111         'self:account_name' => 
112         array (
113             'name' => 'account_name',
114             'rname' => 'name',
115             'id_name' => 'account_id',
116             'vname' => 'LBL_ACCOUNT_NAME',
117             'type' => 'relate',
118             'table' => 'accounts',
119             'join_name' => 'accounts',
120             'isnull' => 'true',
121             'module' => 'Opportunities',
122             'dbType' => 'varchar',
123             'link' => 'accounts',
124             'len' => '255',
125             'source' => 'non-db',
126             'unified_search' => true,
127             'required' => true,
128             'importable' => 'required',
129             'real_table' => 'opportunities',
130             ),
131         'self:accounts' => 
132         array (
133             'name' => 'accounts',
134             'type' => 'link',
135             'relationship' => 'accounts_opportunities',
136             'source' => 'non-db',
137             'link_type' => 'one',
138             'module' => 'Opportunities',
139             'bean_name' => 'Account',
140             'vname' => 'LBL_ACCOUNTS',
141             'real_table' => 'opportunities',
142             ),
143         'self:amount' => 
144         array (
145             'name' => 'amount',
146             'vname' => 'LBL_AMOUNT',
147             'type' => 'currency',
148             'dbType' => 'double',
149             'comment' => 'Unconverted amount of the opportunity',
150             'importable' => 'required',
151             'duplicate_merge' => '1',
152             'required' => true,
153             'options' => 'numeric_range_search_dom',
154             'enable_range_search' => true,
155             'module' => 'Opportunities',
156             'real_table' => 'opportunities',
157             ),
158         'self:amount_usdollar' => 
159         array (
160             'name' => 'amount_usdollar',
161             'vname' => 'LBL_AMOUNT_USDOLLAR',
162             'type' => 'currency',
163             'group' => 'amount',
164             'dbType' => 'double',
165             'disable_num_format' => true,
166             'duplicate_merge' => '0',
167             'audited' => true,
168             'comment' => 'Formatted amount of the opportunity',
169             'module' => 'Opportunities',
170             'real_table' => 'opportunities',
171             ),
172         'self:assigned_user_id' => 
173         array (
174             'name' => 'assigned_user_id',
175             'rname' => 'user_name',
176             'id_name' => 'assigned_user_id',
177             'vname' => 'LBL_ASSIGNED_TO_ID',
178             'group' => 'assigned_user_name',
179             'type' => 'relate',
180             'table' => 'users',
181             'module' => 'Opportunities',
182             'reportable' => true,
183             'isnull' => 'false',
184             'dbType' => 'id',
185             'audited' => true,
186             'comment' => 'User ID assigned to record',
187             'duplicate_merge' => 'disabled',
188             'real_table' => 'opportunities',
189             ),
190         'self:assigned_user_link' => 
191         array (
192             'name' => 'assigned_user_link',
193             'type' => 'link',
194             'relationship' => 'opportunities_assigned_user',
195             'vname' => 'LBL_ASSIGNED_TO_USER',
196             'link_type' => 'one',
197             'module' => 'Opportunities',
198             'bean_name' => 'User',
199             'source' => 'non-db',
200             'duplicate_merge' => 'enabled',
201             'rname' => 'user_name',
202             'id_name' => 'assigned_user_id',
203             'table' => 'users',
204             'real_table' => 'opportunities',
205             ),
206         'self:assigned_user_name' => 
207         array (
208             'name' => 'assigned_user_name',
209             'link' => 'assigned_user_link',
210             'vname' => 'LBL_ASSIGNED_TO_NAME',
211             'rname' => 'user_name',
212             'type' => 'relate',
213             'reportable' => false,
214             'source' => 'non-db',
215             'table' => 'users',
216             'id_name' => 'assigned_user_id',
217             'module' => 'Opportunities',
218             'duplicate_merge' => 'disabled',
219             'real_table' => 'opportunities',
220             ),
221         'self:calls' => 
222         array (
223             'name' => 'calls',
224             'type' => 'link',
225             'relationship' => 'opportunity_calls',
226             'source' => 'non-db',
227             'vname' => 'LBL_CALLS',
228             'module' => 'Opportunities',
229             'real_table' => 'opportunities',
230             ),
231         'self:campaign_id' => 
232         array (
233             'name' => 'campaign_id',
234             'comment' => 'Campaign that generated lead',
235             'vname' => 'LBL_CAMPAIGN_ID',
236             'rname' => 'id',
237             'type' => 'id',
238             'dbType' => 'id',
239             'table' => 'campaigns',
240             'isnull' => 'true',
241             'module' => 'Opportunities',
242             'reportable' => false,
243             'massupdate' => false,
244             'duplicate_merge' => 'disabled',
245             'real_table' => 'opportunities',
246             ),
247         'self:campaign_link' => 
248         array (
249             'name' => 'campaign_link',
250             'type' => 'link',
251             'relationship' => 'opportunities_campaign',
252             'vname' => 'LBL_CAMPAIGNS',
253             'link_type' => 'one',
254             'module' => 'Opportunities',
255             'bean_name' => 'Campaign',
256             'source' => 'non-db',
257             'reportable' => false,
258             'real_table' => 'opportunities',
259             ),
260         'self:campaign_name' => 
261         array (
262             'name' => 'campaign_name',
263             'rname' => 'name',
264             'id_name' => 'campaign_id',
265             'vname' => 'LBL_CAMPAIGN',
266             'type' => 'relate',
267             'link' => 'campaign_opportunities',
268             'isnull' => 'true',
269             'table' => 'campaigns',
270             'module' => 'Opportunities',
271             'source' => 'non-db',
272             'real_table' => 'opportunities',
273             ),
274         'self:campaign_opportunities' => 
275         array (
276             'name' => 'campaign_opportunities',
277             'type' => 'link',
278             'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
279             'relationship' => 'campaign_opportunities',
280             'source' => 'non-db',
281             'module' => 'Opportunities',
282             'real_table' => 'opportunities',
283             ),
284         'self:campaigns' => 
285         array (
286             'name' => 'campaigns',
287             'type' => 'link',
288             'relationship' => 'opportunities_campaign',
289             'module' => 'Opportunities',
290             'bean_name' => 'CampaignLog',
291             'source' => 'non-db',
292             'vname' => 'LBL_CAMPAIGNS',
293             'reportable' => false,
294             'real_table' => 'opportunities',
295             ),
296         'self:contacts' => 
297         array (
298             'name' => 'contacts',
299             'type' => 'link',
300             'relationship' => 'opportunities_contacts',
301             'source' => 'non-db',
302             'module' => 'Opportunities',
303             'bean_name' => 'Contact',
304             'rel_fields' => 
305             array (
306                 'contact_role' => 
307                 array (
308                     'type' => 'enum',
309                     'options' => 'opportunity_relationship_type_dom',
310                     ),
311                 ),
312             'vname' => 'LBL_CONTACTS',
313             'real_table' => 'opportunities',
314             ),
315         'self:contracts' => 
316         array (
317             'name' => 'contracts',
318             'type' => 'link',
319             'vname' => 'LBL_CONTRACTS',
320             'relationship' => 'contracts_opportunities',
321             'source' => 'non-db',
322             'module' => 'Opportunities',
323             'real_table' => 'opportunities',
324             ),
325         'self:created_by' => 
326         array (
327             'name' => 'created_by',
328             'rname' => 'user_name',
329             'id_name' => 'modified_user_id',
330             'vname' => 'LBL_CREATED',
331             'type' => 'assigned_user_name',
332             'table' => 'users',
333             'isnull' => 'false',
334             'dbType' => 'id',
335             'group' => 'created_by_name',
336             'comment' => 'User who created record',
337             'module' => 'Opportunities',
338             'real_table' => 'opportunities',
339             ),
340         'self:created_by_link' => 
341         array (
342             'name' => 'created_by_link',
343             'type' => 'link',
344             'relationship' => 'opportunities_created_by',
345             'vname' => 'LBL_CREATED_USER',
346             'link_type' => 'one',
347             'module' => 'Opportunities',
348             'bean_name' => 'User',
349             'source' => 'non-db',
350             'real_table' => 'opportunities',
351             ),
352         'self:created_by_name' => 
353         array (
354             'name' => 'created_by_name',
355             'vname' => 'LBL_CREATED',
356             'type' => 'relate',
357             'reportable' => false,
358             'link' => 'created_by_link',
359             'rname' => 'user_name',
360             'source' => 'non-db',
361             'table' => 'users',
362             'id_name' => 'created_by',
363             'module' => 'Opportunities',
364             'duplicate_merge' => 'disabled',
365             'importable' => 'false',
366             'real_table' => 'opportunities',
367             ),
368         'self:currencies' => 
369         array (
370             'name' => 'currencies',
371             'type' => 'link',
372             'relationship' => 'opportunity_currencies',
373             'source' => 'non-db',
374             'vname' => 'LBL_CURRENCIES',
375             'module' => 'Opportunities',
376             'real_table' => 'opportunities',
377             ),
378         'self:currency_id' => 
379         array (
380             'name' => 'currency_id',
381             'type' => 'id',
382             'group' => 'currency_id',
383             'vname' => 'LBL_CURRENCY',
384             'function' => 
385             array (
386                 'name' => 'getCurrencyDropDown',
387                 'returns' => 'html',
388                 ),
389             'reportable' => false,
390             'comment' => 'Currency used for display purposes',
391             'module' => 'Opportunities',
392             'real_table' => 'opportunities',
393             ),
394         'self:currency_name' => 
395         array (
396             'name' => 'currency_name',
397             'rname' => 'name',
398             'id_name' => 'currency_id',
399             'vname' => 'LBL_CURRENCY_NAME',
400             'type' => 'relate',
401             'isnull' => 'true',
402             'table' => 'currencies',
403             'module' => 'Opportunities',
404             'source' => 'non-db',
405             'function' => 
406             array (
407                 'name' => 'getCurrencyNameDropDown',
408                 'returns' => 'html',
409                 ),
410             'studio' => 'false',
411             'duplicate_merge' => 'disabled',
412             'real_table' => 'opportunities',
413             ),
414         'self:currency_symbol' => 
415         array (
416             'name' => 'currency_symbol',
417             'rname' => 'symbol',
418             'id_name' => 'currency_id',
419             'vname' => 'LBL_CURRENCY_SYMBOL',
420             'type' => 'relate',
421             'isnull' => 'true',
422             'table' => 'currencies',
423             'module' => 'Opportunities',
424             'source' => 'non-db',
425             'function' => 
426             array (
427                 'name' => 'getCurrencySymbolDropDown',
428                 'returns' => 'html',
429                 ),
430             'studio' => 'false',
431             'duplicate_merge' => 'disabled',
432             'real_table' => 'opportunities',
433             ),
434         'self:currency_target_c' => 
435         array (
436             'required' => false,
437             'source' => 'custom_fields',
438             'name' => 'currency_target_c',
439             'vname' => 'LBL_CURRENCY_TARGET',
440             'type' => 'currency',
441             'massupdate' => '0',
442             'default' => NULL,
443             'comments' => '',
444             'help' => '',
445             'importable' => 'false',
446             'duplicate_merge' => 'disabled',
447             'duplicate_merge_dom_value' => '0',
448             'audited' => false,
449             'reportable' => true,
450             'unified_search' => false,
451             'calculated' => false,
452             'len' => '26',
453             'size' => '20',
454             'enable_range_search' => false,
455             'id' => 'Opportunitiescurrency_target_c',
456             'custom_module' => 'Opportunities',
457             'module' => 'Opportunities',
458             'real_table' => 'opportunities_cstm',
459             ),
460         'self:date_closed' => 
461         array (
462             'name' => 'date_closed',
463             'vname' => 'LBL_DATE_CLOSED',
464             'type' => 'date',
465             'audited' => true,
466             'comment' => 'Expected or actual date the oppportunity will close',
467             'importable' => 'required',
468             'required' => true,
469             'enable_range_search' => true,
470             'options' => 'date_range_search_dom',
471             'module' => 'Opportunities',
472             'real_table' => 'opportunities',
473             ),
474         'self:date_entered' => 
475         array (
476             'name' => 'date_entered',
477             'vname' => 'LBL_DATE_ENTERED',
478             'type' => 'datetime',
479             'group' => 'created_by_name',
480             'comment' => 'Date record created',
481             'enable_range_search' => true,
482             'options' => 'date_range_search_dom',
483             'module' => 'Opportunities',
484             'real_table' => 'opportunities',
485             ),
486         'self:date_modified' => 
487         array (
488             'name' => 'date_modified',
489             'vname' => 'LBL_DATE_MODIFIED',
490             'type' => 'datetime',
491             'group' => 'modified_by_name',
492             'comment' => 'Date record last modified',
493             'enable_range_search' => true,
494             'options' => 'date_range_search_dom',
495             'module' => 'Opportunities',
496             'real_table' => 'opportunities',
497             ),
498         'self:deleted' => 
499         array (
500             'name' => 'deleted',
501             'vname' => 'LBL_DELETED',
502             'type' => 'bool',
503             'default' => '0',
504             'reportable' => false,
505             'comment' => 'Record deletion indicator',
506             'module' => 'Opportunities',
507             'real_table' => 'opportunities',
508             ),
509         'self:description' => 
510         array (
511             'name' => 'description',
512             'vname' => 'LBL_DESCRIPTION',
513             'type' => 'text',
514             'comment' => 'Full text of the note',
515             'rows' => 6,
516             'cols' => 80,
517             'module' => 'Opportunities',
518             'real_table' => 'opportunities',
519             ),
520         'self:documents' => 
521         array (
522             'name' => 'documents',
523             'type' => 'link',
524             'relationship' => 'documents_opportunities',
525             'source' => 'non-db',
526             'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
527             'module' => 'Opportunities',
528             'real_table' => 'opportunities',
529             ),
530         'self:emails' => 
531         array (
532             'name' => 'emails',
533             'type' => 'link',
534             'relationship' => 'emails_opportunities_rel',
535             'source' => 'non-db',
536             'vname' => 'LBL_EMAILS',
537             'module' => 'Opportunities',
538             'real_table' => 'opportunities',
539             ),
540         'self:id' => 
541         array (
542             'name' => 'id',
543             'vname' => 'LBL_ID',
544             'type' => 'id',
545             'required' => true,
546             'reportable' => true,
547             'comment' => 'Unique identifier',
548             'module' => 'Opportunities',
549             'real_table' => 'opportunities',
550             ),
551         'self:lead_source' => 
552         array (
553             'name' => 'lead_source',
554             'vname' => 'LBL_LEAD_SOURCE',
555             'type' => 'enum',
556             'options' => 'lead_source_dom',
557             'len' => '50',
558             'comment' => 'Source of the opportunity',
559             'merge_filter' => 'enabled',
560             'module' => 'Opportunities',
561             'real_table' => 'opportunities',
562             ),
563         'self:leads' => 
564         array (
565             'name' => 'leads',
566             'type' => 'link',
567             'relationship' => 'opportunity_leads',
568             'source' => 'non-db',
569             'vname' => 'LBL_LEADS',
570             'module' => 'Opportunities',
571             'real_table' => 'opportunities',
572             ),
573         'self:meetings' => 
574         array (
575             'name' => 'meetings',
576             'type' => 'link',
577             'relationship' => 'opportunity_meetings',
578             'source' => 'non-db',
579             'vname' => 'LBL_MEETINGS',
580             'module' => 'Opportunities',
581             'real_table' => 'opportunities',
582             ),
583         'self:modified_by_name' => 
584         array (
585             'name' => 'modified_by_name',
586             'vname' => 'LBL_MODIFIED_NAME',
587             'type' => 'relate',
588             'reportable' => false,
589             'source' => 'non-db',
590             'rname' => 'user_name',
591             'table' => 'users',
592             'id_name' => 'modified_user_id',
593             'module' => 'Opportunities',
594             'link' => 'modified_user_link',
595             'duplicate_merge' => 'disabled',
596             'real_table' => 'opportunities',
597             ),
598         'self:modified_user_id' => 
599         array (
600             'name' => 'modified_user_id',
601             'rname' => 'user_name',
602             'id_name' => 'modified_user_id',
603             'vname' => 'LBL_MODIFIED',
604             'type' => 'assigned_user_name',
605             'table' => 'users',
606             'isnull' => 'false',
607             'group' => 'modified_by_name',
608             'dbType' => 'id',
609             'reportable' => true,
610             'comment' => 'User who last modified record',
611             'module' => 'Opportunities',
612             'real_table' => 'opportunities',
613             ),
614         'self:modified_user_link' => 
615         array (
616             'name' => 'modified_user_link',
617             'type' => 'link',
618             'relationship' => 'opportunities_modified_user',
619             'vname' => 'LBL_MODIFIED_USER',
620             'link_type' => 'one',
621             'module' => 'Opportunities',
622             'bean_name' => 'User',
623             'source' => 'non-db',
624             'real_table' => 'opportunities',
625             ),
626         'self:name' => 
627         array (
628             'name' => 'name',
629             'vname' => 'LBL_OPPORTUNITY_NAME',
630             'type' => 'name',
631             'dbType' => 'varchar',
632             'len' => '50',
633             'unified_search' => true,
634             'comment' => 'Name of the opportunity',
635             'merge_filter' => 'selected',
636             'importable' => 'required',
637             'required' => true,
638             'module' => 'Opportunities',
639             'real_table' => 'opportunities',
640             ),
641         'self:next_step' => 
642         array (
643             'name' => 'next_step',
644             'vname' => 'LBL_NEXT_STEP',
645             'type' => 'varchar',
646             'len' => '100',
647             'comment' => 'The next step in the sales process',
648             'merge_filter' => 'enabled',
649             'module' => 'Opportunities',
650             'real_table' => 'opportunities',
651             ),
652         'self:notes' => 
653         array (
654             'name' => 'notes',
655             'type' => 'link',
656             'relationship' => 'opportunity_notes',
657             'source' => 'non-db',
658             'vname' => 'LBL_NOTES',
659             'module' => 'Opportunities',
660             'real_table' => 'opportunities',
661             ),
662         'self:opportunity_type' => 
663         array (
664             'name' => 'opportunity_type',
665             'vname' => 'LBL_TYPE',
666             'type' => 'enum',
667             'options' => 'opportunity_type_dom',
668             'len' => '255',
669             'audited' => true,
670             'comment' => 'Type of opportunity (ex: Existing, New)',
671             'merge_filter' => 'enabled',
672             'module' => 'Opportunities',
673             'real_table' => 'opportunities',
674             ),
675         'self:probability' => 
676         array (
677             'name' => 'probability',
678             'vname' => 'LBL_PROBABILITY',
679             'type' => 'int',
680             'dbType' => 'double',
681             'audited' => true,
682             'comment' => 'The probability of closure',
683             'validation' => 
684             array (
685                 'type' => 'range',
686                 'min' => 0,
687                 'max' => 100,
688                 ),
689             'merge_filter' => 'enabled',
690             'module' => 'Opportunities',
691             'real_table' => 'opportunities',
692             ),
693         'self:project' => 
694         array (
695             'name' => 'project',
696             'type' => 'link',
697             'relationship' => 'projects_opportunities',
698             'source' => 'non-db',
699             'vname' => 'LBL_PROJECTS',
700             'module' => 'Opportunities',
701             'real_table' => 'opportunities',
702             ),
703         'self:quotes' => 
704         array (
705             'name' => 'quotes',
706             'type' => 'link',
707             'relationship' => 'quotes_opportunities',
708             'source' => 'non-db',
709             'vname' => 'LBL_QUOTES',
710             'module' => 'Opportunities',
711             'real_table' => 'opportunities',
712             ),
713         'self:sales_stage' => 
714         array (
715             'name' => 'sales_stage',
716             'vname' => 'LBL_SALES_STAGE',
717             'type' => 'enum',
718             'options' => 'sales_stage_dom',
719             'len' => '255',
720             'audited' => true,
721             'comment' => 'Indication of progression towards closure',
722             'merge_filter' => 'enabled',
723             'importable' => 'required',
724             'required' => true,
725             'module' => 'Opportunities',
726             'real_table' => 'opportunities',
727             ),
728         'self:tasks' => 
729         array (
730             'name' => 'tasks',
731             'type' => 'link',
732             'relationship' => 'opportunity_tasks',
733             'source' => 'non-db',
734             'vname' => 'LBL_TASKS',
735             'module' => 'Opportunities',
736             'real_table' => 'opportunities',
737             ),
738         'self:team_count' => 
739         array (
740             'name' => 'team_count',
741             'rname' => 'team_count',
742             'id_name' => 'team_id',
743             'vname' => 'LBL_TEAMS',
744             'join_name' => 'ts1',
745             'table' => 'teams',
746             'type' => 'relate',
747             'required' => 'true',
748             'isnull' => 'true',
749             'module' => 'Opportunities',
750             'link' => 'team_count_link',
751             'massupdate' => false,
752             'dbType' => 'int',
753             'source' => 'non-db',
754             'importable' => 'false',
755             'reportable' => false,
756             'duplicate_merge' => 'disabled',
757             'studio' => 'false',
758             'hideacl' => true,
759             'real_table' => 'opportunities',
760             ),
761         'self:team_count_link' => 
762         array (
763             'name' => 'team_count_link',
764             'type' => 'link',
765             'relationship' => 'opportunities_team_count_relationship',
766             'link_type' => 'one',
767             'module' => 'Opportunities',
768             'bean_name' => 'TeamSet',
769             'source' => 'non-db',
770             'duplicate_merge' => 'disabled',
771             'reportable' => false,
772             'studio' => 'false',
773             'real_table' => 'opportunities',
774             ),
775         'self:team_id' => 
776         array (
777             'name' => 'team_id',
778             'vname' => 'LBL_TEAM_ID',
779             'group' => 'team_name',
780             'reportable' => false,
781             'dbType' => 'id',
782             'type' => 'team_list',
783             'audited' => true,
784             'comment' => 'Team ID for the account',
785             'module' => 'Opportunities',
786             'real_table' => 'opportunities',
787             ),
788         'self:team_link' => 
789         array (
790             'name' => 'team_link',
791             'type' => 'link',
792             'relationship' => 'opportunities_team',
793             'vname' => 'LBL_TEAMS_LINK',
794             'link_type' => 'one',
795             'module' => 'Opportunities',
796             'bean_name' => 'Team',
797             'source' => 'non-db',
798             'duplicate_merge' => 'disabled',
799             'studio' => 'false',
800             'real_table' => 'opportunities',
801             ),
802         'self:team_name' => 
803         array (
804             'name' => 'team_name',
805             'db_concat_fields' => 
806             array (
807                 0 => 'name',
808                 1 => 'name_2',
809                 ),
810             'sort_on' => 'tj.name',
811             'join_name' => 'tj',
812             'rname' => 'name',
813             'id_name' => 'team_id',
814             'vname' => 'LBL_TEAMS',
815             'type' => 'relate',
816             'required' => 'true',
817             'table' => 'teams',
818             'isnull' => 'true',
819             'module' => 'Opportunities',
820             'link' => 'team_link',
821             'massupdate' => false,
822             'dbType' => 'varchar',
823             'source' => 'non-db',
824             'len' => 36,
825             'custom_type' => 'teamset',
826             'real_table' => 'opportunities',
827             ),
828         'self:team_set_id' => 
829         array (
830             'name' => 'team_set_id',
831             'rname' => 'id',
832             'id_name' => 'team_set_id',
833             'vname' => 'LBL_TEAM_SET_ID',
834             'type' => 'team_set_id',
835             'audited' => true,
836             'studio' => 'false',
837             'dbType' => 'id',
838             'module' => 'Opportunities',
839             'real_table' => 'opportunities',
840             ),
841         'self:teams' => 
842         array (
843             'name' => 'teams',
844             'type' => 'link',
845             'relationship' => 'opportunities_teams',
846             'bean_filter_field' => 'team_set_id',
847             'rhs_key_override' => true,
848             'source' => 'non-db',
849             'vname' => 'LBL_TEAMS',
850             'link_class' => 'TeamSetLink',
851             'link_file' => 'modules/Teams/TeamSetLink.php',
852             'studio' => 'false',
853             'reportable' => false,
854             'module' => 'Opportunities',
855             'real_table' => 'opportunities',
856             ),
857         ); // END: all_fields
858
859
860
861
862     public $selected_loaded_custom_links = array (
863         'opportunities_cstm' => 
864         array (
865             'join_table_alias' => 'opportunities_cstm',
866             'base_table' => 'opportunities',
867             'real_table' => 'opportunities_cstm',
868             ),
869         'accounts_account_link_c' => 
870         array (
871             'join_table_alias' => 'accounts1',
872             'base_table' => 'accounts',
873             'join_id' => 'opportunities_cstm.account_id_c',
874             ),
875         ); // END: selected_loaded_custom_links
876
877
878
879     function getAttribute( $dontcare ) {
880         return $this;
881     }
882 }
883
884 class Bug45716Test extends Sugar_PHPUnit_Framework_TestCase
885 {
886     public function setUp() {
887         parent::setUp();
888         
889         $GLOBALS['action'] = 'index';
890         $GLOBALS['module'] = 'Reports';
891         $GLOBALS['app_strings'] = return_application_language('en_us');
892         $GLOBALS['app_list_strings'] = return_app_list_strings_language('en_us');
893         $GLOBALS['mod_strings'] = return_module_language('en_us','Reports');
894         $GLOBALS['db'] = DBManagerFactory::getInstance();
895         $GLOBALS['current_user'] = new User();
896         $GLOBALS['current_user']->retrieve('1');
897     }
898     
899     public function tearDown() {
900         unset($GLOBALS['module']);
901         unset($GLOBALS['action']);
902         unset($GLOBALS['mod_strings']);
903         unset($GLOBALS['current_user']);
904         parent::tearDown();
905     }
906
907     public function testCustomRelatedLink()
908     {
909         $layout_def =  array (
910             'name' => 'account_id_c',
911             'label' => 'Account Link',
912             'table_key' => 'self',
913             'table_alias' => 'opportunities_cstm',
914             'column_key' => 'self:account_link_c',
915             'type' => 'relate',
916             'fields' => 
917             array (
918                 'PRIMARYID' => '10765534-ff52-52ec-5840-4f16faec901f',
919                 'OPPORTUNITIES_NAME' => 'Trait Institute Inc - 1000 units',
920                 'OPPORTUNITIES_AMOUNT_UBC8F31' => '52183382.29',
921                 'OPPORTUNITIES_AMOUNT' => '52183382.29',
922                 'OPPORTUNITIES_AMOUNT_C9AC638' => '-99',
923                 'OPPORTUNITIES_CSTM_ACCE36316' => '13ce632e-605e-93ac-c209-4f16fa14e616',
924                 'ACCOUNTS1_NAME' => 'OTC Holdings',
925                 ),
926             );
927         $fakeLayoutManager = new Bug45716Helper();
928         $sugarWidget = new SugarWidgetFieldrelate($fakeLayoutManager);
929         
930         $output = $sugarWidget->displayList($layout_def);
931
932         $this->assertContains('record=13ce',$output, 'Missing the id in the output url');
933     }
934 }