Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/Leads/metadata/convertdefs.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
         'form'=>array(
47 47
             'hidden'=>array(
48 48
                 '<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
49
-    			'<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
50
-    			'<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
51
-    			'<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
52
-    			'<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
49
+                '<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
50
+                '<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
51
+                '<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
52
+                '<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
53 53
             )
54 54
         ),
55
-		'maxColumns' => '2', 
55
+        'maxColumns' => '2', 
56 56
         'widths' => array(
57 57
             array('label' => '10', 'field' => '30'), 
58 58
             array('label' => '10', 'field' => '30'),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     'copyData' => true,
106 106
     'required' => true,
107 107
     'select' => "account_name",
108
-	'default_action' => 'create',
108
+    'default_action' => 'create',
109 109
     'relationship' => 'accounts_contacts',
110 110
     'templateMeta' => array(
111 111
         'form'=>array(
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 array('name'=>'name', 'displayParams'=>array('size'=>90)),
230 230
             ), 
231 231
             array (
232
-               'date_start', 
232
+                'date_start', 
233 233
                 array (
234 234
                     'name' => 'duration_hours',
235 235
                     'label' => 'LBL_DURATION',
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 <span class="dateFormat">{sugar_translate label="LBL_HOURS_MINUTES" module="Calls"}',
251 251
                     'displayParams' => 
252 252
                     array (
253
-                      'required' => true,
253
+                        'required' => true,
254 254
                     ),
255 255
                 ),
256 256
             ),
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
                 array('name'=>'name', 'displayParams'=>array('size'=>90)),
289 289
             ), 
290 290
             array (
291
-               'date_start', 
292
-	            array (
291
+                'date_start', 
292
+                array (
293 293
                     'name' => 'duration_hours',
294 294
                     'label' => 'LBL_DURATION',
295 295
                     'customCode' => '{literal}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 <span class="dateFormat">{sugar_translate label="LBL_HOURS_MINUTES" module="Calls"}',
310 310
                     'displayParams' => 
311 311
                     array (
312
-                      'required' => true,
312
+                        'required' => true,
313 313
                     ),
314 314
                 ),
315 315
             ),
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
             array (
345 345
                 array('name'=>'name', 'displayParams'=>array('size'=>90)),
346 346
             ), 
347
-			array (
348
-               'status', 'priority'
347
+            array (
348
+                'status', 'priority'
349 349
             ), 
350 350
             
351 351
             array (
Please login to merge, or discard this patch.
modules/Leads/metadata/editviewdefs.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -1,177 +1,177 @@
 block discarded – undo
1 1
 <?php
2 2
 $viewdefs ['Leads'] = 
3 3
 array (
4
-  'EditView' => 
5
-  array (
4
+    'EditView' => 
5
+    array (
6 6
     'templateMeta' => 
7 7
     array (
8
-      'form' => 
9
-      array (
8
+        'form' => 
9
+        array (
10 10
         'hidden' => 
11 11
         array (
12
-          0 => '<input type="hidden" name="prospect_id" value="{if isset($smarty.request.prospect_id)}{$smarty.request.prospect_id}{else}{$bean->prospect_id}{/if}">',
13
-          1 => '<input type="hidden" name="account_id" value="{if isset($smarty.request.account_id)}{$smarty.request.account_id}{else}{$bean->account_id}{/if}">',
14
-          2 => '<input type="hidden" name="contact_id" value="{if isset($smarty.request.contact_id)}{$smarty.request.contact_id}{else}{$bean->contact_id}{/if}">',
15
-          3 => '<input type="hidden" name="opportunity_id" value="{if isset($smarty.request.opportunity_id)}{$smarty.request.opportunity_id}{else}{$bean->opportunity_id}{/if}">',
12
+            0 => '<input type="hidden" name="prospect_id" value="{if isset($smarty.request.prospect_id)}{$smarty.request.prospect_id}{else}{$bean->prospect_id}{/if}">',
13
+            1 => '<input type="hidden" name="account_id" value="{if isset($smarty.request.account_id)}{$smarty.request.account_id}{else}{$bean->account_id}{/if}">',
14
+            2 => '<input type="hidden" name="contact_id" value="{if isset($smarty.request.contact_id)}{$smarty.request.contact_id}{else}{$bean->contact_id}{/if}">',
15
+            3 => '<input type="hidden" name="opportunity_id" value="{if isset($smarty.request.opportunity_id)}{$smarty.request.opportunity_id}{else}{$bean->opportunity_id}{/if}">',
16 16
         ),
17 17
         'buttons' => 
18 18
         array (
19
-          0 => 'SAVE',
20
-          1 => 'CANCEL',
19
+            0 => 'SAVE',
20
+            1 => 'CANCEL',
21 21
         ),
22
-      ),
23
-      'maxColumns' => '2',
24
-      'widths' => 
25
-      array (
22
+        ),
23
+        'maxColumns' => '2',
24
+        'widths' => 
25
+        array (
26 26
         0 => 
27 27
         array (
28
-          'label' => '10',
29
-          'field' => '30',
28
+            'label' => '10',
29
+            'field' => '30',
30 30
         ),
31 31
         1 => 
32 32
         array (
33
-          'label' => '10',
34
-          'field' => '30',
33
+            'label' => '10',
34
+            'field' => '30',
35 35
         ),
36
-      ),
37
-      'javascript' => '<script type="text/javascript" language="Javascript">function copyAddressRight(form)  {ldelim} form.alt_address_street.value = form.primary_address_street.value;form.alt_address_city.value = form.primary_address_city.value;form.alt_address_state.value = form.primary_address_state.value;form.alt_address_postalcode.value = form.primary_address_postalcode.value;form.alt_address_country.value = form.primary_address_country.value;return true; {rdelim} function copyAddressLeft(form)  {ldelim} form.primary_address_street.value =form.alt_address_street.value;form.primary_address_city.value = form.alt_address_city.value;form.primary_address_state.value = form.alt_address_state.value;form.primary_address_postalcode.value =form.alt_address_postalcode.value;form.primary_address_country.value = form.alt_address_country.value;return true; {rdelim} </script>',
38
-      'useTabs' => false,
39
-      'tabDefs' => 
40
-      array (
36
+        ),
37
+        'javascript' => '<script type="text/javascript" language="Javascript">function copyAddressRight(form)  {ldelim} form.alt_address_street.value = form.primary_address_street.value;form.alt_address_city.value = form.primary_address_city.value;form.alt_address_state.value = form.primary_address_state.value;form.alt_address_postalcode.value = form.primary_address_postalcode.value;form.alt_address_country.value = form.primary_address_country.value;return true; {rdelim} function copyAddressLeft(form)  {ldelim} form.primary_address_street.value =form.alt_address_street.value;form.primary_address_city.value = form.alt_address_city.value;form.primary_address_state.value = form.alt_address_state.value;form.primary_address_postalcode.value =form.alt_address_postalcode.value;form.primary_address_country.value = form.alt_address_country.value;return true; {rdelim} </script>',
38
+        'useTabs' => false,
39
+        'tabDefs' => 
40
+        array (
41 41
         'LBL_CONTACT_INFORMATION' => 
42 42
         array (
43
-          'newTab' => false,
44
-          'panelDefault' => 'expanded',
43
+            'newTab' => false,
44
+            'panelDefault' => 'expanded',
45 45
         ),
46 46
         'LBL_PANEL_ADVANCED' => 
47 47
         array (
48
-          'newTab' => false,
49
-          'panelDefault' => 'expanded',
48
+            'newTab' => false,
49
+            'panelDefault' => 'expanded',
50 50
         ),
51 51
         'LBL_PANEL_ASSIGNMENT' => 
52 52
         array (
53
-          'newTab' => false,
54
-          'panelDefault' => 'expanded',
53
+            'newTab' => false,
54
+            'panelDefault' => 'expanded',
55
+        ),
55 56
         ),
56
-      ),
57 57
     ),
58 58
     'panels' => 
59 59
     array (
60
-      'LBL_CONTACT_INFORMATION' => 
61
-      array (
60
+        'LBL_CONTACT_INFORMATION' => 
61
+        array (
62 62
         0 => 
63 63
         array (
64
-          0 => 
65
-          array (
64
+            0 => 
65
+            array (
66 66
             'name' => 'first_name',
67 67
             'customCode' => '{html_options name="salutation" id="salutation" options=$fields.salutation.options selected=$fields.salutation.value}&nbsp;<input name="first_name"  id="first_name" size="25" maxlength="25" type="text" value="{$fields.first_name.value}">',
68
-          ),
68
+            ),
69 69
         ),
70 70
         1 => 
71 71
         array (
72
-          0 => 'last_name',
73
-          1 => 'phone_work',
72
+            0 => 'last_name',
73
+            1 => 'phone_work',
74 74
         ),
75 75
         2 => 
76 76
         array (
77
-          0 => 'title',
78
-          1 => 'phone_mobile',
77
+            0 => 'title',
78
+            1 => 'phone_mobile',
79 79
         ),
80 80
         3 => 
81 81
         array (
82
-          0 => 'department',
83
-          1 => 'phone_fax',
82
+            0 => 'department',
83
+            1 => 'phone_fax',
84 84
         ),
85 85
         4 => 
86 86
         array (
87
-          0 => 
88
-          array (
87
+            0 => 
88
+            array (
89 89
             'name' => 'account_name',
90 90
             'type' => 'varchar',
91 91
             'validateDependency' => false,
92 92
             'customCode' => '<input name="account_name" id="EditView_account_name" {if ($fields.converted.value == 1)}disabled="true"{/if} size="30" maxlength="255" type="text" value="{$fields.account_name.value}">',
93
-          ),
94
-          1 => 'website',
93
+            ),
94
+            1 => 'website',
95 95
         ),
96 96
         5 => 
97 97
         array (
98
-          0 => 
99
-          array (
98
+            0 => 
99
+            array (
100 100
             'name' => 'primary_address_street',
101 101
             'hideLabel' => true,
102 102
             'type' => 'address',
103 103
             'displayParams' => 
104 104
             array (
105
-              'key' => 'primary',
106
-              'rows' => 2,
107
-              'cols' => 30,
108
-              'maxlength' => 150,
105
+                'key' => 'primary',
106
+                'rows' => 2,
107
+                'cols' => 30,
108
+                'maxlength' => 150,
109 109
             ),
110
-          ),
111
-          1 => 
112
-          array (
110
+            ),
111
+            1 => 
112
+            array (
113 113
             'name' => 'alt_address_street',
114 114
             'hideLabel' => true,
115 115
             'type' => 'address',
116 116
             'displayParams' => 
117 117
             array (
118
-              'key' => 'alt',
119
-              'copy' => 'primary',
120
-              'rows' => 2,
121
-              'cols' => 30,
122
-              'maxlength' => 150,
118
+                'key' => 'alt',
119
+                'copy' => 'primary',
120
+                'rows' => 2,
121
+                'cols' => 30,
122
+                'maxlength' => 150,
123
+            ),
123 124
             ),
124
-          ),
125 125
         ),
126 126
         6 => 
127 127
         array (
128
-          0 => 'email1',
128
+            0 => 'email1',
129 129
         ),
130 130
         7 => 
131 131
         array (
132
-          0 => 'description',
132
+            0 => 'description',
133
+        ),
133 134
         ),
134
-      ),
135
-      'LBL_PANEL_ADVANCED' => 
136
-      array (
135
+        'LBL_PANEL_ADVANCED' => 
136
+        array (
137 137
         0 => 
138 138
         array (
139
-          0 => 'status',
140
-          1 => 'lead_source',
139
+            0 => 'status',
140
+            1 => 'lead_source',
141 141
         ),
142 142
         1 => 
143 143
         array (
144
-          0 => 
145
-          array (
144
+            0 => 
145
+            array (
146 146
             'name' => 'status_description',
147
-          ),
148
-          1 => 
149
-          array (
147
+            ),
148
+            1 => 
149
+            array (
150 150
             'name' => 'lead_source_description',
151
-          ),
151
+            ),
152 152
         ),
153 153
         2 => 
154 154
         array (
155
-          0 => 'opportunity_amount',
156
-          1 => 'refered_by',
155
+            0 => 'opportunity_amount',
156
+            1 => 'refered_by',
157 157
         ),
158 158
         3 => 
159 159
         array (
160
-          0 => 'campaign_name',
160
+            0 => 'campaign_name',
161 161
         ),
162
-      ),
163
-      'LBL_PANEL_ASSIGNMENT' => 
164
-      array (
162
+        ),
163
+        'LBL_PANEL_ASSIGNMENT' => 
164
+        array (
165 165
         0 => 
166 166
         array (
167
-          0 => 
168
-          array (
167
+            0 => 
168
+            array (
169 169
             'name' => 'assigned_user_name',
170 170
             'label' => 'LBL_ASSIGNED_TO',
171
-          ),
171
+            ),
172
+        ),
172 173
         ),
173
-      ),
174 174
     ),
175
-  ),
175
+    ),
176 176
 );
177 177
 ?>
Please login to merge, or discard this patch.
modules/Leads/metadata/SearchFields.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
         'last_name'=> array('query_type'=>'default'),
46 46
         'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true),
47 47
         'account_name'=> array('query_type'=>'default','db_field'=>array('leads.account_name')),
48
-		/*'acc_name_from_accounts' => array('query_type'=>'default','related_field'=>'account_name'),*/
48
+        /*'acc_name_from_accounts' => array('query_type'=>'default','related_field'=>'account_name'),*/
49 49
         'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options'=>'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50 50
         'do_not_call'=> array('query_type'=>'default', 'operator'=>'=', 'input_type' => 'checkbox'),
51 51
         'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','phone_home')),
52
-		'email'=> array(
53
-			'query_type' => 'default',
54
-			'operator' => 'subquery',
55
-			'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
56
-			'db_field' => array(
57
-				'id',
58
-			),
59
-		),	
52
+        'email'=> array(
53
+            'query_type' => 'default',
54
+            'operator' => 'subquery',
55
+            'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
56
+            'db_field' => array(
57
+                'id',
58
+            ),
59
+        ),	
60 60
         'favorites_only' => array(
61 61
             'query_type'=>'format',
62 62
             'operator' => 'subquery',
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
         'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
76 76
         'assigned_user_id'=> array('query_type'=>'default'),
77 77
         'status'=> array('query_type'=>'default', 'options'=>'lead_status_dom', 'template_var' => 'STATUS_OPTIONS'),
78
-		'open_only' => array(
79
-			'query_type'=>'default',
80
-			'db_field'=>array('status'),
81
-			'operator'=>'not in',
82
-			'closed_values' => array('Dead', 'Recycled', 'Converted'),
83
-			'type'=>'bool',
84
-		),
85
-		//Range Search Support 
86
-	    'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
-	    'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
-	    'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
-	    'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
-	    'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
78
+        'open_only' => array(
79
+            'query_type'=>'default',
80
+            'db_field'=>array('status'),
81
+            'operator'=>'not in',
82
+            'closed_values' => array('Dead', 'Recycled', 'Converted'),
83
+            'type'=>'bool',
84
+        ),
85
+        //Range Search Support 
86
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
87
+        'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
88
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
89
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
90
+        'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
91 91
         'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
92
-	    //Range Search Support 				
92
+        //Range Search Support 				
93 93
     );
94 94
 ?>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Leads/metadata/detailviewdefs.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,217 +1,217 @@
 block discarded – undo
1 1
 <?php
2 2
 $viewdefs ['Leads'] = 
3 3
 array (
4
-  'DetailView' => 
5
-  array (
4
+    'DetailView' => 
5
+    array (
6 6
     'templateMeta' => 
7 7
     array (
8
-      'form' => 
9
-      array (
8
+        'form' => 
9
+        array (
10 10
         'buttons' => 
11 11
         array (
12
-          0 => 'EDIT',
13
-          1 => 'DUPLICATE',
14
-          2 => 'DELETE',
15
-          3 => 
16
-          array (
12
+            0 => 'EDIT',
13
+            1 => 'DUPLICATE',
14
+            2 => 'DELETE',
15
+            3 => 
16
+            array (
17 17
             'customCode' => '{if $bean->aclAccess("edit") && !$DISABLE_CONVERT_ACTION}<input title="{$MOD.LBL_CONVERTLEAD_TITLE}" accessKey="{$MOD.LBL_CONVERTLEAD_BUTTON_KEY}" type="button" class="button" onClick="document.location=\'index.php?module=Leads&action=ConvertLead&record={$fields.id.value}\'" name="convert" value="{$MOD.LBL_CONVERTLEAD}">{/if}',
18 18
             'sugar_html' => 
19 19
             array (
20
-              'type' => 'button',
21
-              'value' => '{$MOD.LBL_CONVERTLEAD}',
22
-              'htmlOptions' => 
23
-              array (
20
+                'type' => 'button',
21
+                'value' => '{$MOD.LBL_CONVERTLEAD}',
22
+                'htmlOptions' => 
23
+                array (
24 24
                 'title' => '{$MOD.LBL_CONVERTLEAD_TITLE}',
25 25
                 'accessKey' => '{$MOD.LBL_CONVERTLEAD_BUTTON_KEY}',
26 26
                 'class' => 'button',
27 27
                 'onClick' => 'document.location=\'index.php?module=Leads&action=ConvertLead&record={$fields.id.value}\'',
28 28
                 'name' => 'convert',
29 29
                 'id' => 'convert_lead_button',
30
-              ),
31
-              'template' => '{if $bean->aclAccess("edit") && !$DISABLE_CONVERT_ACTION}[CONTENT]{/if}',
30
+                ),
31
+                'template' => '{if $bean->aclAccess("edit") && !$DISABLE_CONVERT_ACTION}[CONTENT]{/if}',
32 32
             ),
33
-          ),
34
-          4 => 'FIND_DUPLICATES',
35
-          5 => 
36
-          array (
33
+            ),
34
+            4 => 'FIND_DUPLICATES',
35
+            5 => 
36
+            array (
37 37
             'customCode' => '<input title="{$APP.LBL_MANAGE_SUBSCRIPTIONS}" class="button" onclick="this.form.return_module.value=\'Leads\'; this.form.return_action.value=\'DetailView\';this.form.return_id.value=\'{$fields.id.value}\'; this.form.action.value=\'Subscriptions\'; this.form.module.value=\'Campaigns\'; this.form.module_tab.value=\'Leads\';" type="submit" name="Manage Subscriptions" value="{$APP.LBL_MANAGE_SUBSCRIPTIONS}">',
38 38
             'sugar_html' => 
39 39
             array (
40
-              'type' => 'submit',
41
-              'value' => '{$APP.LBL_MANAGE_SUBSCRIPTIONS}',
42
-              'htmlOptions' => 
43
-              array (
40
+                'type' => 'submit',
41
+                'value' => '{$APP.LBL_MANAGE_SUBSCRIPTIONS}',
42
+                'htmlOptions' => 
43
+                array (
44 44
                 'title' => '{$APP.LBL_MANAGE_SUBSCRIPTIONS}',
45 45
                 'class' => 'button',
46 46
                 'id' => 'manage_subscriptions_button',
47 47
                 'onclick' => 'this.form.return_module.value=\'Leads\'; this.form.return_action.value=\'DetailView\';this.form.return_id.value=\'{$fields.id.value}\'; this.form.action.value=\'Subscriptions\'; this.form.module.value=\'Campaigns\'; this.form.module_tab.value=\'Leads\';',
48 48
                 'name' => '{$APP.LBL_MANAGE_SUBSCRIPTIONS}',
49
-              ),
49
+                ),
50
+            ),
50 51
             ),
51
-          ),
52
-          'AOS_GENLET' => 
53
-          array (
52
+            'AOS_GENLET' => 
53
+            array (
54 54
             'customCode' => '<input type="button" class="button" onClick="showPopup();" value="{$APP.LBL_GENERATE_LETTER}">',
55
-          ),
55
+            ),
56 56
         ),
57 57
         'headerTpl' => 'modules/Leads/tpls/DetailViewHeader.tpl',
58
-      ),
59
-      'maxColumns' => '2',
60
-      'widths' => 
61
-      array (
58
+        ),
59
+        'maxColumns' => '2',
60
+        'widths' => 
61
+        array (
62 62
         0 => 
63 63
         array (
64
-          'label' => '10',
65
-          'field' => '30',
64
+            'label' => '10',
65
+            'field' => '30',
66 66
         ),
67 67
         1 => 
68 68
         array (
69
-          'label' => '10',
70
-          'field' => '30',
69
+            'label' => '10',
70
+            'field' => '30',
71
+        ),
71 72
         ),
72
-      ),
73
-      'includes' => 
74
-      array (
73
+        'includes' => 
74
+        array (
75 75
         0 => 
76 76
         array (
77
-          'file' => 'modules/Leads/Lead.js',
77
+            'file' => 'modules/Leads/Lead.js',
78
+        ),
78 79
         ),
79
-      ),
80
-      'useTabs' => true,
81
-      'tabDefs' => 
82
-      array (
80
+        'useTabs' => true,
81
+        'tabDefs' => 
82
+        array (
83 83
         'LBL_CONTACT_INFORMATION' => 
84 84
         array (
85
-          'newTab' => true,
86
-          'panelDefault' => 'expanded',
85
+            'newTab' => true,
86
+            'panelDefault' => 'expanded',
87 87
         ),
88 88
         'LBL_PANEL_ADVANCED' => 
89 89
         array (
90
-          'newTab' => true,
91
-          'panelDefault' => 'expanded',
90
+            'newTab' => true,
91
+            'panelDefault' => 'expanded',
92 92
         ),
93 93
         'LBL_PANEL_ASSIGNMENT' => 
94 94
         array (
95
-          'newTab' => true,
96
-          'panelDefault' => 'expanded',
95
+            'newTab' => true,
96
+            'panelDefault' => 'expanded',
97
+        ),
97 98
         ),
98
-      ),
99 99
     ),
100 100
     'panels' => 
101 101
     array (
102
-      'LBL_CONTACT_INFORMATION' => 
103
-      array (
102
+        'LBL_CONTACT_INFORMATION' => 
103
+        array (
104 104
         0 => 
105 105
         array (
106
-          0 => 
107
-          array (
106
+            0 => 
107
+            array (
108 108
             'name' => 'full_name',
109 109
             'label' => 'LBL_NAME',
110
-          ),
111
-          1 => 'phone_work',
110
+            ),
111
+            1 => 'phone_work',
112 112
         ),
113 113
         1 => 
114 114
         array (
115
-          0 => 'title',
116
-          1 => 'phone_mobile',
115
+            0 => 'title',
116
+            1 => 'phone_mobile',
117 117
         ),
118 118
         2 => 
119 119
         array (
120
-          0 => 'department',
121
-          1 => 'phone_fax',
120
+            0 => 'department',
121
+            1 => 'phone_fax',
122 122
         ),
123 123
         3 => 
124 124
         array (
125
-          0 => 
126
-          array (
125
+            0 => 
126
+            array (
127 127
             'name' => 'account_name',
128
-          ),
129
-          1 => 'website',
128
+            ),
129
+            1 => 'website',
130 130
         ),
131 131
         4 => 
132 132
         array (
133
-          0 => 
134
-          array (
133
+            0 => 
134
+            array (
135 135
             'name' => 'primary_address_street',
136 136
             'label' => 'LBL_PRIMARY_ADDRESS',
137 137
             'type' => 'address',
138 138
             'displayParams' => 
139 139
             array (
140
-              'key' => 'primary',
140
+                'key' => 'primary',
141
+            ),
141 142
             ),
142
-          ),
143
-          1 => 
144
-          array (
143
+            1 => 
144
+            array (
145 145
             'name' => 'alt_address_street',
146 146
             'label' => 'LBL_ALTERNATE_ADDRESS',
147 147
             'type' => 'address',
148 148
             'displayParams' => 
149 149
             array (
150
-              'key' => 'alt',
150
+                'key' => 'alt',
151
+            ),
151 152
             ),
152
-          ),
153 153
         ),
154 154
         5 => 
155 155
         array (
156
-          0 => 'email1',
156
+            0 => 'email1',
157 157
         ),
158 158
         6 => 
159 159
         array (
160
-          0 => 'description',
160
+            0 => 'description',
161 161
         ),
162 162
         7 => 
163 163
         array (
164
-          0 => 
165
-          array (
164
+            0 => 
165
+            array (
166 166
             'name' => 'assigned_user_name',
167 167
             'label' => 'LBL_ASSIGNED_TO',
168
-          ),
168
+            ),
169
+        ),
169 170
         ),
170
-      ),
171
-      'LBL_PANEL_ADVANCED' => 
172
-      array (
171
+        'LBL_PANEL_ADVANCED' => 
172
+        array (
173 173
         0 => 
174 174
         array (
175
-          0 => 'status',
176
-          1 => 'lead_source',
175
+            0 => 'status',
176
+            1 => 'lead_source',
177 177
         ),
178 178
         1 => 
179 179
         array (
180
-          0 => 'status_description',
181
-          1 => 'lead_source_description',
180
+            0 => 'status_description',
181
+            1 => 'lead_source_description',
182 182
         ),
183 183
         2 => 
184 184
         array (
185
-          0 => 'opportunity_amount',
186
-          1 => 'refered_by',
185
+            0 => 'opportunity_amount',
186
+            1 => 'refered_by',
187 187
         ),
188 188
         3 => 
189 189
         array (
190
-          0 => 
191
-          array (
190
+            0 => 
191
+            array (
192 192
             'name' => 'campaign_name',
193 193
             'label' => 'LBL_CAMPAIGN',
194
-          ),
194
+            ),
195
+        ),
195 196
         ),
196
-      ),
197
-      'LBL_PANEL_ASSIGNMENT' => 
198
-      array (
197
+        'LBL_PANEL_ASSIGNMENT' => 
198
+        array (
199 199
         0 => 
200 200
         array (
201
-          0 => 
202
-          array (
201
+            0 => 
202
+            array (
203 203
             'name' => 'date_modified',
204 204
             'label' => 'LBL_DATE_MODIFIED',
205 205
             'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
206
-          ),
207
-          1 =>
208
-          array (
206
+            ),
207
+            1 =>
208
+            array (
209 209
             'name' => 'date_entered',
210 210
             'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
211
-          ),
211
+            ),
212 212
         ),
213
-      ),
213
+        ),
214
+    ),
214 215
     ),
215
-  ),
216 216
 );
217 217
 ?>
Please login to merge, or discard this patch.
modules/Leads/metadata/quickcreatedefs.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -47,131 +47,131 @@
 block discarded – undo
47 47
 
48 48
 $viewdefs ['Leads'] = 
49 49
 array (
50
-  'QuickCreate' => 
51
-  array (
50
+    'QuickCreate' => 
51
+    array (
52 52
     'templateMeta' => 
53 53
     array (
54
-      'form' => 
55
-      array (
54
+        'form' => 
55
+        array (
56 56
         'hidden' => 
57 57
         array (
58
-          0 => '<input type="hidden" name="prospect_id" value="{if isset($smarty.request.prospect_id)}{$smarty.request.prospect_id}{else}{$bean->prospect_id}{/if}">',
59
-          1 => '<input type="hidden" name="contact_id" value="{if isset($smarty.request.contact_id)}{$smarty.request.contact_id}{else}{$bean->contact_id}{/if}">',
60
-          2 => '<input type="hidden" name="opportunity_id" value="{if isset($smarty.request.opportunity_id)}{$smarty.request.opportunity_id}{else}{$bean->opportunity_id}{/if}">',
61
-          3 => '<input type="hidden" name="account_id" value="{if isset($smarty.request.account_id)}{$smarty.request.account_id}{else}{$bean->account_id}{/if}">',
58
+            0 => '<input type="hidden" name="prospect_id" value="{if isset($smarty.request.prospect_id)}{$smarty.request.prospect_id}{else}{$bean->prospect_id}{/if}">',
59
+            1 => '<input type="hidden" name="contact_id" value="{if isset($smarty.request.contact_id)}{$smarty.request.contact_id}{else}{$bean->contact_id}{/if}">',
60
+            2 => '<input type="hidden" name="opportunity_id" value="{if isset($smarty.request.opportunity_id)}{$smarty.request.opportunity_id}{else}{$bean->opportunity_id}{/if}">',
61
+            3 => '<input type="hidden" name="account_id" value="{if isset($smarty.request.account_id)}{$smarty.request.account_id}{else}{$bean->account_id}{/if}">',
62
+        ),
62 63
         ),
63
-      ),
64
-      'maxColumns' => '2',
65
-      'widths' => 
66
-      array (
64
+        'maxColumns' => '2',
65
+        'widths' => 
66
+        array (
67 67
         0 => 
68 68
         array (
69
-          'label' => '10',
70
-          'field' => '30',
69
+            'label' => '10',
70
+            'field' => '30',
71 71
         ),
72 72
         1 => 
73 73
         array (
74
-          'label' => '10',
75
-          'field' => '30',
74
+            'label' => '10',
75
+            'field' => '30',
76
+        ),
76 77
         ),
77
-      ),
78
-      'javascript' => '<script type="text/javascript" language="Javascript">function copyAddressRight(form)  {ldelim} form.alt_address_street.value = form.primary_address_street.value;form.alt_address_city.value = form.primary_address_city.value;form.alt_address_state.value = form.primary_address_state.value;form.alt_address_postalcode.value = form.primary_address_postalcode.value;form.alt_address_country.value = form.primary_address_country.value;return true; {rdelim} function copyAddressLeft(form)  {ldelim} form.primary_address_street.value =form.alt_address_street.value;form.primary_address_city.value = form.alt_address_city.value;form.primary_address_state.value = form.alt_address_state.value;form.primary_address_postalcode.value =form.alt_address_postalcode.value;form.primary_address_country.value = form.alt_address_country.value;return true; {rdelim} </script>',
79
-      'useTabs' => false,
78
+        'javascript' => '<script type="text/javascript" language="Javascript">function copyAddressRight(form)  {ldelim} form.alt_address_street.value = form.primary_address_street.value;form.alt_address_city.value = form.primary_address_city.value;form.alt_address_state.value = form.primary_address_state.value;form.alt_address_postalcode.value = form.primary_address_postalcode.value;form.alt_address_country.value = form.primary_address_country.value;return true; {rdelim} function copyAddressLeft(form)  {ldelim} form.primary_address_street.value =form.alt_address_street.value;form.primary_address_city.value = form.alt_address_city.value;form.primary_address_state.value = form.alt_address_state.value;form.primary_address_postalcode.value =form.alt_address_postalcode.value;form.primary_address_country.value = form.alt_address_country.value;return true; {rdelim} </script>',
79
+        'useTabs' => false,
80 80
     ),
81 81
     'panels' => 
82 82
     array (
83
-      'lbl_contact_information' => 
84
-      array (
83
+        'lbl_contact_information' => 
84
+        array (
85 85
         0 => 
86 86
         array (
87
-          0 => 
88
-          array (
87
+            0 => 
88
+            array (
89 89
             'name' => 'first_name',
90
-          ),
91
-          1 => 
92
-          array (
90
+            ),
91
+            1 => 
92
+            array (
93 93
             'name' => 'status',
94
-          ),
94
+            ),
95 95
         ),
96 96
         1 => 
97 97
         array (
98
-          0 => 
99
-          array (
98
+            0 => 
99
+            array (
100 100
             'name' => 'last_name',
101 101
             'displayParams' => 
102 102
             array (
103
-              'required' => true,
103
+                'required' => true,
104
+            ),
104 105
             ),
105
-          ),
106
-          1 => 
107
-          array (
106
+            1 => 
107
+            array (
108 108
             'name' => 'phone_work',
109
-          ),
109
+            ),
110 110
         ),
111 111
         2 => 
112 112
         array (
113
-          0 => 
114
-          array (
113
+            0 => 
114
+            array (
115 115
             'name' => 'title',
116
-          ),
117
-          1 => 
118
-          array (
116
+            ),
117
+            1 => 
118
+            array (
119 119
             'name' => 'phone_mobile',
120
-          ),
120
+            ),
121 121
         ),
122 122
         3 => 
123 123
         array (
124
-          0 => 
125
-          array (
124
+            0 => 
125
+            array (
126 126
             'name' => 'department',
127
-          ),
128
-          1 => 
129
-          array (
127
+            ),
128
+            1 => 
129
+            array (
130 130
             'name' => 'phone_fax',
131
-          ),
131
+            ),
132 132
         ),
133 133
         4 => 
134 134
         array (
135
-          0 => 
136
-          array (
135
+            0 => 
136
+            array (
137 137
             'name' => 'account_name',
138
-          ),
139
-          1 => 
140
-          array (
138
+            ),
139
+            1 => 
140
+            array (
141 141
             'name' => 'do_not_call',
142
-          ),
142
+            ),
143 143
         ),
144 144
         5 => 
145 145
         array (
146
-          0 => 
147
-          array (
146
+            0 => 
147
+            array (
148 148
             'name' => 'email1',
149
-          ),
149
+            ),
150 150
         ),
151 151
         6 => 
152 152
         array (
153
-          0 => 
154
-          array (
153
+            0 => 
154
+            array (
155 155
             'name' => 'lead_source',
156
-          ),
157
-          1 => 
158
-          array (
156
+            ),
157
+            1 => 
158
+            array (
159 159
             'name' => 'refered_by',
160
-          ),
160
+            ),
161 161
         ),
162 162
         7 => 
163 163
         array (
164
-          0 => 
165
-          array (
164
+            0 => 
165
+            array (
166 166
             'name' => 'assigned_user_name',
167
-          ),
168
-          1 => 
169
-          array (
167
+            ),
168
+            1 => 
169
+            array (
170 170
             'name' => 'team_name',
171
-          ),
171
+            ),
172 172
         ),
173
-      ),
173
+        ),
174
+    ),
174 175
     ),
175
-  ),
176 176
 );
177 177
 ?>
178 178
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Leads/metadata/listviewdefs.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 
44 44
 $listViewDefs ['Leads'] = 
45 45
 array (
46
-  'NAME' => 
47
-  array (
46
+    'NAME' => 
47
+    array (
48 48
     'width' => '10%',
49 49
     'label' => 'LBL_LIST_NAME',
50 50
     'link' => true,
@@ -52,180 +52,180 @@  discard block
 block discarded – undo
52 52
     'default' => true,
53 53
     'related_fields' => 
54 54
     array (
55
-      0 => 'first_name',
56
-      1 => 'last_name',
57
-      2 => 'salutation',
55
+        0 => 'first_name',
56
+        1 => 'last_name',
57
+        2 => 'salutation',
58
+    ),
58 59
     ),
59
-  ),
60
-  'STATUS' => 
61
-  array (
60
+    'STATUS' => 
61
+    array (
62 62
     'width' => '7%',
63 63
     'label' => 'LBL_LIST_STATUS',
64 64
     'default' => true,
65
-  ),
66
-  'ACCOUNT_NAME' => 
67
-  array (
65
+    ),
66
+    'ACCOUNT_NAME' => 
67
+    array (
68 68
     'width' => '15%',
69 69
     'label' => 'LBL_LIST_ACCOUNT_NAME',
70 70
     'default' => true,
71 71
     'related_fields' => 
72 72
     array (
73
-      0 => 'account_id',
73
+        0 => 'account_id',
74
+    ),
74 75
     ),
75
-  ),
76
-  'PHONE_WORK' => 
77
-  array (
76
+    'PHONE_WORK' => 
77
+    array (
78 78
     'width' => '15%',
79 79
     'label' => 'LBL_LIST_PHONE',
80 80
     'default' => true,
81
-  ),
82
-  'EMAIL1' => 
83
-  array (
81
+    ),
82
+    'EMAIL1' => 
83
+    array (
84 84
     'width' => '16%',
85 85
     'label' => 'LBL_LIST_EMAIL_ADDRESS',
86 86
     'sortable' => false,
87 87
     'customCode' => '{$EMAIL1_LINK}{$EMAIL1}</a>',
88 88
     'default' => true,
89
-  ),
90
-  'ASSIGNED_USER_NAME' => 
91
-  array (
89
+    ),
90
+    'ASSIGNED_USER_NAME' => 
91
+    array (
92 92
     'width' => '5%',
93 93
     'label' => 'LBL_LIST_ASSIGNED_USER',
94 94
     'module' => 'Employees',
95 95
     'id' => 'ASSIGNED_USER_ID',
96 96
     'default' => true,
97
-  ),
98
-  'TITLE' => 
99
-  array (
97
+    ),
98
+    'TITLE' => 
99
+    array (
100 100
     'width' => '10%',
101 101
     'label' => 'LBL_TITLE',
102 102
     'default' => false,
103
-  ),
104
-  'REFERED_BY' => 
105
-  array (
103
+    ),
104
+    'REFERED_BY' => 
105
+    array (
106 106
     'width' => '10%',
107 107
     'label' => 'LBL_REFERED_BY',
108 108
     'default' => false,
109
-  ),
110
-  'LEAD_SOURCE' => 
111
-  array (
109
+    ),
110
+    'LEAD_SOURCE' => 
111
+    array (
112 112
     'width' => '10%',
113 113
     'label' => 'LBL_LEAD_SOURCE',
114 114
     'default' => false,
115
-  ),
116
-  'DEPARTMENT' => 
117
-  array (
115
+    ),
116
+    'DEPARTMENT' => 
117
+    array (
118 118
     'width' => '10%',
119 119
     'label' => 'LBL_DEPARTMENT',
120 120
     'default' => false,
121
-  ),
122
-  'DO_NOT_CALL' => 
123
-  array (
121
+    ),
122
+    'DO_NOT_CALL' => 
123
+    array (
124 124
     'width' => '10%',
125 125
     'label' => 'LBL_DO_NOT_CALL',
126 126
     'default' => false,
127
-  ),
128
-  'PHONE_HOME' => 
129
-  array (
127
+    ),
128
+    'PHONE_HOME' => 
129
+    array (
130 130
     'width' => '10%',
131 131
     'label' => 'LBL_HOME_PHONE',
132 132
     'default' => false,
133
-  ),
134
-  'PHONE_MOBILE' => 
135
-  array (
133
+    ),
134
+    'PHONE_MOBILE' => 
135
+    array (
136 136
     'width' => '10%',
137 137
     'label' => 'LBL_MOBILE_PHONE',
138 138
     'default' => false,
139
-  ),
140
-  'PHONE_OTHER' => 
141
-  array (
139
+    ),
140
+    'PHONE_OTHER' => 
141
+    array (
142 142
     'width' => '10%',
143 143
     'label' => 'LBL_OTHER_PHONE',
144 144
     'default' => false,
145
-  ),
146
-  'PHONE_FAX' => 
147
-  array (
145
+    ),
146
+    'PHONE_FAX' => 
147
+    array (
148 148
     'width' => '10%',
149 149
     'label' => 'LBL_FAX_PHONE',
150 150
     'default' => false,
151
-  ),
152
-  'PRIMARY_ADDRESS_COUNTRY' => 
153
-  array (
151
+    ),
152
+    'PRIMARY_ADDRESS_COUNTRY' => 
153
+    array (
154 154
     'width' => '10%',
155 155
     'label' => 'LBL_PRIMARY_ADDRESS_COUNTRY',
156 156
     'default' => false,
157
-  ),
158
-  'PRIMARY_ADDRESS_STREET' => 
159
-  array (
157
+    ),
158
+    'PRIMARY_ADDRESS_STREET' => 
159
+    array (
160 160
     'width' => '10%',
161 161
     'label' => 'LBL_PRIMARY_ADDRESS_STREET',
162 162
     'default' => false,
163
-  ),
164
-  'PRIMARY_ADDRESS_CITY' => 
165
-  array (
163
+    ),
164
+    'PRIMARY_ADDRESS_CITY' => 
165
+    array (
166 166
     'width' => '10%',
167 167
     'label' => 'LBL_PRIMARY_ADDRESS_CITY',
168 168
     'default' => false,
169
-  ),
170
-  'PRIMARY_ADDRESS_STATE' => 
171
-  array (
169
+    ),
170
+    'PRIMARY_ADDRESS_STATE' => 
171
+    array (
172 172
     'width' => '10%',
173 173
     'label' => 'LBL_PRIMARY_ADDRESS_STATE',
174 174
     'default' => false,
175
-  ),
176
-  'PRIMARY_ADDRESS_POSTALCODE' => 
177
-  array (
175
+    ),
176
+    'PRIMARY_ADDRESS_POSTALCODE' => 
177
+    array (
178 178
     'width' => '10%',
179 179
     'label' => 'LBL_PRIMARY_ADDRESS_POSTALCODE',
180 180
     'default' => false,
181
-  ),
182
-  'ALT_ADDRESS_COUNTRY' => 
183
-  array (
181
+    ),
182
+    'ALT_ADDRESS_COUNTRY' => 
183
+    array (
184 184
     'width' => '10%',
185 185
     'label' => 'LBL_ALT_ADDRESS_COUNTRY',
186 186
     'default' => false,
187
-  ),
188
-  'ALT_ADDRESS_STREET' => 
189
-  array (
187
+    ),
188
+    'ALT_ADDRESS_STREET' => 
189
+    array (
190 190
     'width' => '10%',
191 191
     'label' => 'LBL_ALT_ADDRESS_STREET',
192 192
     'default' => false,
193
-  ),
194
-  'ALT_ADDRESS_CITY' => 
195
-  array (
193
+    ),
194
+    'ALT_ADDRESS_CITY' => 
195
+    array (
196 196
     'width' => '10%',
197 197
     'label' => 'LBL_ALT_ADDRESS_CITY',
198 198
     'default' => false,
199
-  ),
200
-  'ALT_ADDRESS_STATE' => 
201
-  array (
199
+    ),
200
+    'ALT_ADDRESS_STATE' => 
201
+    array (
202 202
     'width' => '10%',
203 203
     'label' => 'LBL_ALT_ADDRESS_STATE',
204 204
     'default' => false,
205
-  ),
206
-  'ALT_ADDRESS_POSTALCODE' => 
207
-  array (
205
+    ),
206
+    'ALT_ADDRESS_POSTALCODE' => 
207
+    array (
208 208
     'width' => '10%',
209 209
     'label' => 'LBL_ALT_ADDRESS_POSTALCODE',
210 210
     'default' => false,
211
-  ),
212
-  'CREATED_BY' => 
213
-  array (
211
+    ),
212
+    'CREATED_BY' => 
213
+    array (
214 214
     'width' => '10%',
215 215
     'label' => 'LBL_CREATED',
216 216
     'default' => false,
217
-  ),
218
-  'MODIFIED_BY_NAME' => 
219
-  array (
217
+    ),
218
+    'MODIFIED_BY_NAME' => 
219
+    array (
220 220
     'width' => '5%',
221 221
     'label' => 'LBL_MODIFIED',
222 222
     'default' => false,
223
-  ),
224
-  'DATE_ENTERED' => 
225
-  array (
223
+    ),
224
+    'DATE_ENTERED' => 
225
+    array (
226 226
     'width' => '10%',
227 227
     'label' => 'LBL_DATE_ENTERED',
228 228
     'default' => true,
229
-  ),  
229
+    ),  
230 230
 );
231 231
 ?>
232 232
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Leads/views/view.showduplicates.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             $this->ss->assign('RETURN_MODULE', 'Emails');
155 155
             $this->ss->assign('RETURN_ACTION', 'EditView');
156 156
             if(isset($_REQUEST['start'])) {
157
-               $this->ss->assign('START', $_REQUEST['start']);
157
+                $this->ss->assign('START', $_REQUEST['start']);
158 158
             }
159 159
         }
160 160
         ////	END INBOUND EMAIL WORKFLOW
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $template = 'modules/Leads/tpls/ShowDuplicates.tpl';
192 192
         if(file_exists('custom/' . $template))
193 193
         {
194
-           $template = 'custom/' . $template;
194
+            $template = 'custom/' . $template;
195 195
         }
196 196
 
197 197
         $saveLabel = string_format($app_strings['LBL_SAVE_OBJECT'], array($this->module));
Please login to merge, or discard this patch.
modules/Leads/views/view.convertlead.php 1 patch
Indentation   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         )
53 53
     {
54 54
         parent::SugarView($bean, $view_object_map);
55
-    	$this->medataDataFile = $this->fileName;
55
+        $this->medataDataFile = $this->fileName;
56 56
         if (file_exists("custom/$this->fileName"))
57 57
         {
58 58
             $this->medataDataFile = "custom/$this->fileName";
@@ -68,42 +68,42 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-	 * @see SugarView::display()
72
-	 */
73
-	public function display()
71
+     * @see SugarView::display()
72
+     */
73
+    public function display()
74 74
     {
75 75
         if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save')
76 76
         {
77
-        	return $this->handleSave();
77
+            return $this->handleSave();
78 78
         }
79 79
 
80
-    	global $beanList;
80
+        global $beanList;
81 81
 
82
-    	// get the EditView defs to check if opportunity_name exists, for a check below for populating data
83
-    	$opportunityNameInLayout = false;
84
-    	$editviewFile = 'modules/Leads/metadata/editviewdefs.php';
82
+        // get the EditView defs to check if opportunity_name exists, for a check below for populating data
83
+        $opportunityNameInLayout = false;
84
+        $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
85 85
         $this->medataDataFile = $editviewFile;
86 86
         if (file_exists("custom/{$editviewFile}"))
87 87
         {
88 88
             $this->medataDataFile = "custom/{$editviewFile}";
89 89
         }
90
-    	include($this->medataDataFile);
91
-    	foreach($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section){
92
-    	    foreach($section as $row_array){
93
-    	        foreach($row_array as $cell){
94
-        	        if(isset($cell['name']) && $cell['name'] == 'opportunity_name'){
95
-        	            $opportunityNameInLayout = true;
96
-        	        }
97
-    	        }
98
-    	    }
99
-    	}
90
+        include($this->medataDataFile);
91
+        foreach($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section){
92
+            foreach($section as $row_array){
93
+                foreach($row_array as $cell){
94
+                    if(isset($cell['name']) && $cell['name'] == 'opportunity_name'){
95
+                        $opportunityNameInLayout = true;
96
+                    }
97
+                }
98
+            }
99
+        }
100 100
 
101 101
         $this->medataDataFile = $this->fileName;
102 102
         if (file_exists("custom/$this->fileName"))
103 103
         {
104 104
             $this->medataDataFile = "custom/$this->fileName";
105 105
         }
106
-    	$this->loadDefs();
106
+        $this->loadDefs();
107 107
         $this->getRecord();
108 108
         $this->checkForDuplicates($this->focus);
109 109
         $smarty = new Sugar_Smarty();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $smarty->assign("module", "Leads");
166 166
         $smarty->assign("view", "convertlead");
167 167
         $smarty->assign("bean", $this->focus);
168
-		$smarty->assign("record_id", $this->focus->id);
168
+        $smarty->assign("record_id", $this->focus->id);
169 169
         global $mod_strings;
170 170
         $smarty->assign('MOD', $mod_strings);
171 171
         $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
         //Switch up list depending on copy or move
179 179
         if($sugar_config['lead_conv_activity_opt'] == 'move')
180 180
         {
181
-        	$smarty->assign('convertModuleListOptions', get_select_options_with_id(array('None'=>$app_strings['LBL_NONE'], 'Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));	
181
+            $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('None'=>$app_strings['LBL_NONE'], 'Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));	
182 182
         }
183 183
         else if($sugar_config['lead_conv_activity_opt'] == 'copy')
184 184
         {
185
-        	$smarty->assign('convertModuleListOptions', get_select_options_with_id(array('Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
185
+            $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
186 186
         }
187 187
         
188 188
         
@@ -207,49 +207,49 @@  discard block
 block discarded – undo
207 207
             $focus->fill_in_additional_detail_fields();
208 208
             foreach($focus->field_defs as $field => $def)
209 209
             {
210
-            	if(isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData'])
210
+                if(isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData'])
211 211
                 {
212
-	                if ($module == "Accounts" && $field == 'name')
213
-	                {
214
-	                    $focus->name = $this->focus->account_name;
215
-	                }
216
-	                else if ($module == "Opportunities" && $field == 'amount')
217
-	                {
218
-	                    $focus->amount = unformat_number($this->focus->opportunity_amount);
219
-	                } 
220
-                 	else if ($module == "Opportunities" && $field == 'name') {
221
-                 		if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)){
222
-                           $focus->name = $this->focus->opportunity_name;
223
-                 		}
224
-                   	}
225
-	                else if ($field == "id")
212
+                    if ($module == "Accounts" && $field == 'name')
213
+                    {
214
+                        $focus->name = $this->focus->account_name;
215
+                    }
216
+                    else if ($module == "Opportunities" && $field == 'amount')
217
+                    {
218
+                        $focus->amount = unformat_number($this->focus->opportunity_amount);
219
+                    } 
220
+                        else if ($module == "Opportunities" && $field == 'name') {
221
+                            if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)){
222
+                            $focus->name = $this->focus->opportunity_name;
223
+                            }
224
+                        }
225
+                    else if ($field == "id")
226 226
                     {
227
-						//If it is not a contact, don't copy the ID from the lead
228
-                    	if ($module == "Contacts") {
229
-                    	   $focus->$field = $this->focus->$field;
227
+                        //If it is not a contact, don't copy the ID from the lead
228
+                        if ($module == "Contacts") {
229
+                            $focus->$field = $this->focus->$field;
230 230
                         }
231 231
                     } else if (is_a($focus, "Company") && $field == 'phone_office')
232
-	                {
233
-	                	//Special case where company and person have the same field with a different name
234
-	                	$focus->phone_office = $this->focus->phone_work;
235
-	                }
236
-					else if (strpos($field, "billing_address") !== false && $focus->field_defs[$field]["type"] == "varchar") /* Bug 42219 fix */         
237
-					{
238
-						$tmp_field = str_replace("billing_", "primary_", $field);
239
-						$focus->field_defs[$field]["type"] = "text";
232
+                    {
233
+                        //Special case where company and person have the same field with a different name
234
+                        $focus->phone_office = $this->focus->phone_work;
235
+                    }
236
+                    else if (strpos($field, "billing_address") !== false && $focus->field_defs[$field]["type"] == "varchar") /* Bug 42219 fix */         
237
+                    {
238
+                        $tmp_field = str_replace("billing_", "primary_", $field);
239
+                        $focus->field_defs[$field]["type"] = "text";
240 240
                         if (isset($this->focus->$tmp_field)) {
241
-						    $focus->$field = $this->focus->$tmp_field;
241
+                            $focus->$field = $this->focus->$tmp_field;
242
+                        }
242 243
                         }
243
-					 }
244 244
 
245
-					else if (strpos($field, "shipping_address") !== false && $focus->field_defs[$field]["type"] == "varchar") /* Bug 42219 fix */
246
-					{
247
-						$tmp_field = str_replace("shipping_", "primary_", $field);
248
-						if (isset($this->focus->$tmp_field)) {
245
+                    else if (strpos($field, "shipping_address") !== false && $focus->field_defs[$field]["type"] == "varchar") /* Bug 42219 fix */
246
+                    {
247
+                        $tmp_field = str_replace("shipping_", "primary_", $field);
248
+                        if (isset($this->focus->$tmp_field)) {
249 249
                             $focus->$field = $this->focus->$tmp_field;
250 250
                         }
251
-						$focus->field_defs[$field]["type"] = "text";
252
-					}    					
251
+                        $focus->field_defs[$field]["type"] = "text";
252
+                    }    					
253 253
                     else if (isset($this->focus->$field))
254 254
                     {
255 255
                         $focus->$field = $this->focus->$field;
@@ -272,18 +272,18 @@  discard block
 block discarded – undo
272 272
 
273 273
     protected function getRecord()
274 274
     {
275
-    	$this->focus = new Lead();
276
-    	if (isset($_REQUEST['record']))
277
-    	{
278
-    		$this->focus->retrieve($_REQUEST['record']);
279
-    	}
275
+        $this->focus = new Lead();
276
+        if (isset($_REQUEST['record']))
277
+        {
278
+            $this->focus->retrieve($_REQUEST['record']);
279
+        }
280 280
     }
281 281
 
282 282
     protected function loadDefs()
283 283
     {
284
-    	$viewdefs = array();
285
-    	include($this->medataDataFile);
286
-    	$this->defs = $viewdefs;
284
+        $viewdefs = array();
285
+        include($this->medataDataFile);
286
+        $this->defs = $viewdefs;
287 287
     }
288 288
 
289 289
     /**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                     }
316 316
                     ";
317 317
         if ($validateSelect) {
318
-        	$jsOut  .= "
318
+            $jsOut  .= "
319 319
                     removeFromValidate('ConvertLead', '{$viewdef['select']}');";
320 320
         }
321 321
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             YAHOO.util.Event.onDOMReady(SUGAR.convert.toggle$module);";
349 349
         } else if (isset($viewdef['default_action'])  && $viewdef['default_action'] == "create")
350 350
         {
351
-             $jsOut .= "\n            SUGAR.convert.{$module}Enabled = true;";
351
+                $jsOut .= "\n            SUGAR.convert.{$module}Enabled = true;";
352 352
         }
353 353
         $jsOut .= "
354 354
             YAHOO.util.Event.addListener('new$module', 'click', SUGAR.convert.toggle$module);
@@ -441,14 +441,14 @@  discard block
 block discarded – undo
441 441
         foreach ($this->defs as $module => $vdef)
442 442
         {
443 443
             //Create a new record if "create" was selected
444
-        	if (!empty($_REQUEST["convert_create_$module"]) && $_REQUEST["convert_create_$module"] != "false")
444
+            if (!empty($_REQUEST["convert_create_$module"]) && $_REQUEST["convert_create_$module"] != "false")
445 445
             {
446 446
                 //Save the new record
447 447
                 $bean = $beanList[$module];
448
-	            if (empty($beans[$module]))
449
-	            	$beans[$module] = new $bean();
448
+                if (empty($beans[$module]))
449
+                    $beans[$module] = new $bean();
450 450
 
451
-            	$this->populateNewBean($module, $beans[$module], $beans['Contacts'], $lead);
451
+                $this->populateNewBean($module, $beans[$module], $beans['Contacts'], $lead);
452 452
                 // when creating a new contact, create the id for linking with other modules
453 453
                 // and do not populate it with lead's old account_id
454 454
                 if ($module == 'Contacts')
@@ -601,8 +601,8 @@  discard block
 block discarded – undo
601 601
         $beans
602 602
         )
603 603
     {
604
-    	global $beanList;
605
-    	echo "<div><ul>";
604
+        global $beanList;
605
+        echo "<div><ul>";
606 606
         foreach($beans as $bean)
607 607
         {
608 608
             $beanName = $bean->object_name;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             }
630 630
         }
631 631
 
632
-    	echo "</ul></div>";
632
+        echo "</ul></div>";
633 633
     }
634 634
 
635 635
     protected function handleActivities(
@@ -637,12 +637,12 @@  discard block
 block discarded – undo
637 637
         $beans
638 638
         )
639 639
     {
640
-    	global $app_list_strings;
640
+        global $app_list_strings;
641 641
         global $sugar_config;
642 642
         global $app_strings;
643
-    	$parent_types = $app_list_strings['record_type_display'];
643
+        $parent_types = $app_list_strings['record_type_display'];
644 644
 
645
-    	$activities = $this->getActivitiesFromLead($lead);
645
+        $activities = $this->getActivitiesFromLead($lead);
646 646
 
647 647
         //if account is being created, we will specify the account as the parent bean
648 648
         $accountParentInfo = array();
@@ -658,42 +658,42 @@  discard block
 block discarded – undo
658 658
             $accountParentInfo = array('id'=>$account_id,'type'=>'Accounts');
659 659
         }
660 660
 
661
-    	foreach($beans as $module => $bean)
662
-    	{
663
-	    	if (isset($parent_types[$module]))
664
-	    	{
661
+        foreach($beans as $module => $bean)
662
+        {
663
+            if (isset($parent_types[$module]))
664
+            {
665 665
                 if (empty($bean->id))
666 666
                 {
667 667
                     $bean->id = create_guid();
668
-		            $bean->new_with_id = true;
668
+                    $bean->new_with_id = true;
669 669
                 }
670 670
                 if( isset($_POST['lead_conv_ac_op_sel']) && $_POST['lead_conv_ac_op_sel'] != 'None')
671 671
                 {
672
-	                foreach($activities as $activity)
673
-			    	{
674
-	                            if (!isset($sugar_config['lead_conv_activity_opt']) || $sugar_config['lead_conv_activity_opt'] == 'copy') {
675
-	                                if (isset($_POST['lead_conv_ac_op_sel'])) {
676
-	                                    //if the copy to module(s) are defined, copy only to those module(s)
677
-	                                    if (is_array($_POST['lead_conv_ac_op_sel'])) {
678
-	                                        foreach ($_POST['lead_conv_ac_op_sel'] as $mod) {
679
-	                                            if ($mod == $module) {
680
-	                                                $this->copyActivityAndRelateToBean($activity, $bean, $accountParentInfo);
681
-	                                                break;
682
-	                                            }
683
-	                                        }
684
-	                                    }
685
-	                                }
686
-	                            }
687
-	                            else if ($sugar_config['lead_conv_activity_opt'] == 'move') {
688
-	                                // if to move activities, should be only one module selected
689
-	                                if ($_POST['lead_conv_ac_op_sel'] == $module) {
690
-	                                    $this->moveActivity($activity, $bean);
691
-	                                }
692
-	                            }
693
-			    	}
672
+                    foreach($activities as $activity)
673
+                    {
674
+                                if (!isset($sugar_config['lead_conv_activity_opt']) || $sugar_config['lead_conv_activity_opt'] == 'copy') {
675
+                                    if (isset($_POST['lead_conv_ac_op_sel'])) {
676
+                                        //if the copy to module(s) are defined, copy only to those module(s)
677
+                                        if (is_array($_POST['lead_conv_ac_op_sel'])) {
678
+                                            foreach ($_POST['lead_conv_ac_op_sel'] as $mod) {
679
+                                                if ($mod == $module) {
680
+                                                    $this->copyActivityAndRelateToBean($activity, $bean, $accountParentInfo);
681
+                                                    break;
682
+                                                }
683
+                                            }
684
+                                        }
685
+                                    }
686
+                                }
687
+                                else if ($sugar_config['lead_conv_activity_opt'] == 'move') {
688
+                                    // if to move activities, should be only one module selected
689
+                                    if ($_POST['lead_conv_ac_op_sel'] == $module) {
690
+                                        $this->moveActivity($activity, $bean);
691
+                                    }
692
+                                }
693
+                    }
694 694
                 }
695
-	    	}
696
-    	}
695
+            }
696
+        }
697 697
     }
698 698
 
699 699
     /**
@@ -745,46 +745,46 @@  discard block
 block discarded – undo
745 745
      * @param Lead $lead Lead to get activities from
746 746
      * @return Array of Activity SugarBeans .
747 747
      */
748
-	protected function getActivitiesFromLead(
749
-	    $lead
750
-	    )
751
-	{
752
-		if (!$lead) return;
753
-
754
-		global $beanList, $db;
755
-
756
-		$activitesList = array("Calls", "Tasks", "Meetings", "Emails", "Notes");
757
-		$activities = array();
758
-
759
-		foreach($activitesList as $module)
760
-		{
761
-			$beanName = $beanList[$module];
762
-			$activity = new $beanName();
763
-			$query = "SELECT id FROM {$activity->table_name} WHERE parent_id = '{$lead->id}' AND parent_type = 'Leads' AND deleted = 0";
764
-			$result = $db->query($query,true);
748
+    protected function getActivitiesFromLead(
749
+        $lead
750
+        )
751
+    {
752
+        if (!$lead) return;
753
+
754
+        global $beanList, $db;
755
+
756
+        $activitesList = array("Calls", "Tasks", "Meetings", "Emails", "Notes");
757
+        $activities = array();
758
+
759
+        foreach($activitesList as $module)
760
+        {
761
+            $beanName = $beanList[$module];
762
+            $activity = new $beanName();
763
+            $query = "SELECT id FROM {$activity->table_name} WHERE parent_id = '{$lead->id}' AND parent_type = 'Leads' AND deleted = 0";
764
+            $result = $db->query($query,true);
765 765
             while($row = $db->fetchByAssoc($result))
766 766
             {
767
-            	$activity = new $beanName();
768
-				$activity->retrieve($row['id']);
769
-				$activity->fixUpFormatting();
770
-				$activities[] = $activity;
767
+                $activity = new $beanName();
768
+                $activity->retrieve($row['id']);
769
+                $activity->fixUpFormatting();
770
+                $activities[] = $activity;
771 771
             }
772
-		}
772
+        }
773 773
 
774
-		return $activities;
775
-	}
774
+        return $activities;
775
+    }
776 776
 
777
-	protected function copyActivityAndRelateToBean(
778
-	    $activity,
779
-	    $bean,
777
+    protected function copyActivityAndRelateToBean(
778
+        $activity,
779
+        $bean,
780 780
         $parentArr = array()
781
-	    )
782
-	{
783
-		global $beanList;
781
+        )
782
+    {
783
+        global $beanList;
784 784
 
785
-		$newActivity = clone $activity;
786
-		$newActivity->id = create_guid();
787
-		$newActivity->new_with_id = true;
785
+        $newActivity = clone $activity;
786
+        $newActivity->id = create_guid();
787
+        $newActivity->new_with_id = true;
788 788
 
789 789
         //set the parent id and type if it was passed in, otherwise use blank to wipe it out
790 790
         $parentID = '';
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 
801 801
         }
802 802
 
803
-		//Special case to prevent duplicated tasks from appearing under Contacts multiple times
804
-    	if ($newActivity->module_dir == "Tasks" && $bean->module_dir != "Contacts")
805
-    	{
803
+        //Special case to prevent duplicated tasks from appearing under Contacts multiple times
804
+        if ($newActivity->module_dir == "Tasks" && $bean->module_dir != "Contacts")
805
+        {
806 806
             $newActivity->contact_id = $newActivity->contact_name = "";
807
-    	}
807
+        }
808 808
 
809
-		if ($rel = $this->findRelationship($newActivity, $bean))
809
+        if ($rel = $this->findRelationship($newActivity, $bean))
810 810
         {
811 811
             if (isset($newActivity->$rel))
812 812
             {
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
             $newActivity->parent_id =  $parentID;
828 828
             $newActivity->parent_type = $parentType;
829 829
 
830
-	        $newActivity->update_date_modified = false; //bug 41747
831
-	        $newActivity->save();
830
+            $newActivity->update_date_modified = false; //bug 41747
831
+            $newActivity->save();
832 832
             $newActivity->$rel->add($bean);
833 833
             if ($newActivity->module_dir == "Notes" && $newActivity->filename) {
834
-	        	UploadFile::duplicate_file($activity->id, $newActivity->id,  $newActivity->filename);
835
-	        }
836
-         }
837
-	}
834
+                UploadFile::duplicate_file($activity->id, $newActivity->id,  $newActivity->filename);
835
+            }
836
+            }
837
+    }
838 838
 
839 839
     /**
840 840
      * Populates the passed in Bean fron the contact and the $_REQUEST
@@ -842,102 +842,102 @@  discard block
 block discarded – undo
842 842
      * @param SugarBean $bean SugarBean to be populated.
843 843
      * @param Contact $contact Contact to relate the bean to.
844 844
      */
845
-	protected function populateNewBean(
846
-	    $module,
847
-	    $bean,
848
-	    $contact,
849
-	    $lead
850
-	    )
851
-	{
852
-		//Copy data from the contact to new bean
853
-		foreach($bean->field_defs as $field => $def)
854
-		{
855
-			if(!isset($_REQUEST[$module . $field]) && isset($lead->$field) && $field != 'id')
856
-			{
857
-				$bean->$field = $lead->$field;
858
-				if($field == 'date_entered') $bean->$field = gmdate($GLOBALS['timedate']->get_db_date_time_format()); //bug 41030
859
-			}
860
-		}
845
+    protected function populateNewBean(
846
+        $module,
847
+        $bean,
848
+        $contact,
849
+        $lead
850
+        )
851
+    {
852
+        //Copy data from the contact to new bean
853
+        foreach($bean->field_defs as $field => $def)
854
+        {
855
+            if(!isset($_REQUEST[$module . $field]) && isset($lead->$field) && $field != 'id')
856
+            {
857
+                $bean->$field = $lead->$field;
858
+                if($field == 'date_entered') $bean->$field = gmdate($GLOBALS['timedate']->get_db_date_time_format()); //bug 41030
859
+            }
860
+        }
861 861
         populateFromPost($module, $bean, true);
862
-		//Try to link to the new contact
863
-		$contactRel = "";
864
-		if (!empty($vdef['ConvertLead']['select']))
865
-		{
866
-			$select = $vdef['ConvertLead']['select'];
867
-			$fieldDef = $contact->field_defs[$select];
868
-			if (!empty($fieldDef['id_name']))
869
-			{
870
-				$bean->id = create_guid();
871
-				$bean->new_with_id = true;
872
-				$contact->$fieldDef['id_name'] = $bean->id ;
873
-				if ($fieldDef['id_name'] != $select) {
874
-					$rname = isset($fieldDef['rname']) ? $fieldDef['rname'] : "";
875
-					if (!empty($rname) && isset($bean->$rname))
876
-						$contact->$select = $bean->$rname;
877
-					else
878
-						$contact->$select = $bean->name;
879
-				}
880
-			}
881
-		} else if ($module != "Contacts"){
882
-			$contactRel = $this->findRelationship($contact, $bean);
883
-			if (!empty($contactRel))
884
-			{
885
-				$bean->id = create_guid();
886
-				$bean->new_with_id = true;
887
-				$contact->load_relationship ($contactRel) ;
888
-				$relObject = $contact->$contactRel->getRelationshipObject();
889
-				if ($relObject->relationship_type == "one-to-many" && $contact->$contactRel->_get_bean_position())
890
-				{
891
-					$id_field = $relObject->rhs_key;
892
-					$bean->$id_field = $contact->id;
893
-				} else {
894
-					$contact->$contactRel->add($bean);
895
-				}
896
-				//Set the parent of activites to the new Contact
897
-				if (isset($bean->field_defs['parent_id']) && isset($bean->field_defs['parent_type']))
898
-				{
899
-					$bean->parent_id = $contact->id;
900
-					$bean->parent_type = "Contacts";
901
-				}
902
-			}
903
-		}
904
-	}
905
-
906
-	protected function copyAddressFields($bean, $contact)
907
-	{
908
-	//Copy over address info from the contact to any beans with address not set
909
-	        foreach($bean->field_defs as $field => $def)
910
-			{
911
-				if(!isset($_REQUEST[$bean->module_dir . $field]) && strpos($field, "_address_") !== false)
912
-				{
913
-					$set = "primary";
914
-					if (strpos($field, "alt_") !== false || strpos($field, "shipping_") !== false)
915
-						$set = "alt";
916
-					$type = "";
917
-
918
-					if(strpos($field, "_address_street_2") !== false)
919
-						$type = "_address_street_2";
920
-					else if(strpos($field, "_address_street_3") !== false)
921
-						$type = "_address_street_3";
922
-					else if(strpos($field, "_address_street_4") !== false)
923
-						$type = "";
924
-					else if(strpos($field, "_address_street") !== false)
925
-						$type = "_address_street";
926
-					else if(strpos($field, "_address_city") !== false)
927
-						$type = "_address_city";
928
-					else if(strpos($field, "_address_state") !== false)
929
-						$type = "_address_state";
930
-					else if(strpos($field, "_address_postalcode") !== false)
931
-						$type = "_address_postalcode";
932
-					else if(strpos($field, "_address_country") !== false)
933
-						$type = "_address_country";
934
-
935
-						$var = $set.$type;
936
-					if (isset($contact->$var))
937
-						$bean->$field = $contact->$var;
938
-				}
939
-			}
940
-	}
862
+        //Try to link to the new contact
863
+        $contactRel = "";
864
+        if (!empty($vdef['ConvertLead']['select']))
865
+        {
866
+            $select = $vdef['ConvertLead']['select'];
867
+            $fieldDef = $contact->field_defs[$select];
868
+            if (!empty($fieldDef['id_name']))
869
+            {
870
+                $bean->id = create_guid();
871
+                $bean->new_with_id = true;
872
+                $contact->$fieldDef['id_name'] = $bean->id ;
873
+                if ($fieldDef['id_name'] != $select) {
874
+                    $rname = isset($fieldDef['rname']) ? $fieldDef['rname'] : "";
875
+                    if (!empty($rname) && isset($bean->$rname))
876
+                        $contact->$select = $bean->$rname;
877
+                    else
878
+                        $contact->$select = $bean->name;
879
+                }
880
+            }
881
+        } else if ($module != "Contacts"){
882
+            $contactRel = $this->findRelationship($contact, $bean);
883
+            if (!empty($contactRel))
884
+            {
885
+                $bean->id = create_guid();
886
+                $bean->new_with_id = true;
887
+                $contact->load_relationship ($contactRel) ;
888
+                $relObject = $contact->$contactRel->getRelationshipObject();
889
+                if ($relObject->relationship_type == "one-to-many" && $contact->$contactRel->_get_bean_position())
890
+                {
891
+                    $id_field = $relObject->rhs_key;
892
+                    $bean->$id_field = $contact->id;
893
+                } else {
894
+                    $contact->$contactRel->add($bean);
895
+                }
896
+                //Set the parent of activites to the new Contact
897
+                if (isset($bean->field_defs['parent_id']) && isset($bean->field_defs['parent_type']))
898
+                {
899
+                    $bean->parent_id = $contact->id;
900
+                    $bean->parent_type = "Contacts";
901
+                }
902
+            }
903
+        }
904
+    }
905
+
906
+    protected function copyAddressFields($bean, $contact)
907
+    {
908
+    //Copy over address info from the contact to any beans with address not set
909
+            foreach($bean->field_defs as $field => $def)
910
+            {
911
+                if(!isset($_REQUEST[$bean->module_dir . $field]) && strpos($field, "_address_") !== false)
912
+                {
913
+                    $set = "primary";
914
+                    if (strpos($field, "alt_") !== false || strpos($field, "shipping_") !== false)
915
+                        $set = "alt";
916
+                    $type = "";
917
+
918
+                    if(strpos($field, "_address_street_2") !== false)
919
+                        $type = "_address_street_2";
920
+                    else if(strpos($field, "_address_street_3") !== false)
921
+                        $type = "_address_street_3";
922
+                    else if(strpos($field, "_address_street_4") !== false)
923
+                        $type = "";
924
+                    else if(strpos($field, "_address_street") !== false)
925
+                        $type = "_address_street";
926
+                    else if(strpos($field, "_address_city") !== false)
927
+                        $type = "_address_city";
928
+                    else if(strpos($field, "_address_state") !== false)
929
+                        $type = "_address_state";
930
+                    else if(strpos($field, "_address_postalcode") !== false)
931
+                        $type = "_address_postalcode";
932
+                    else if(strpos($field, "_address_country") !== false)
933
+                        $type = "_address_country";
934
+
935
+                        $var = $set.$type;
936
+                    if (isset($contact->$var))
937
+                        $bean->$field = $contact->$var;
938
+                }
939
+            }
940
+    }
941 941
 
942 942
 
943 943
     protected function findRelationship(
@@ -945,12 +945,12 @@  discard block
 block discarded – undo
945 945
         $to
946 946
         )
947 947
     {
948
-    	global $dictionary;
949
-    	require_once("modules/TableDictionary.php");
950
-    	foreach ($from->field_defs as $field=>$def)
948
+        global $dictionary;
949
+        require_once("modules/TableDictionary.php");
950
+        foreach ($from->field_defs as $field=>$def)
951 951
         {
952 952
             if (isset($def['type']) && $def['type'] == "link" && isset($def['relationship'])) 
953
-			{
953
+            {
954 954
                 $rel_name = $def['relationship'];
955 955
                 $rel_def = "";
956 956
                 if (isset($dictionary[$from->object_name]['relationships']) && isset($dictionary[$from->object_name]['relationships'][$rel_name]))
@@ -964,16 +964,16 @@  discard block
 block discarded – undo
964 964
                 else if (isset($dictionary[$rel_name]) && isset($dictionary[$rel_name]['relationships'])
965 965
                         && isset($dictionary[$rel_name]['relationships'][$rel_name]))
966 966
                 {
967
-                	$rel_def = $dictionary[$rel_name]['relationships'][$rel_name];
967
+                    $rel_def = $dictionary[$rel_name]['relationships'][$rel_name];
968 968
                 }
969 969
                 if (!empty($rel_def)) {
970 970
                     if ($rel_def['lhs_module'] == $from->module_dir && $rel_def['rhs_module'] == $to->module_dir )
971 971
                     {
972
-                    	return $field;
972
+                        return $field;
973 973
                     }
974 974
                     else if ($rel_def['rhs_module'] == $from->module_dir && $rel_def['lhs_module'] == $to->module_dir )
975 975
                     {
976
-                    	return $field;
976
+                        return $field;
977 977
                     }
978 978
                 }
979 979
             }
@@ -994,16 +994,16 @@  discard block
 block discarded – undo
994 994
         }
995 995
         return false;
996 996
     }
997
-	/**
998
-	 * @see SugarView::_getModuleTitleParams()
999
-	 */
1000
-	protected function _getModuleTitleParams($browserTitle = false)
1001
-	{
1002
-	    global $mod_strings;
1003
-	    $params = parent::_getModuleTitleParams($browserTitle);
1004
-	    $params[] = "<a href='index.php?module=Leads&action=DetailView&record={$this->bean->id}'>{$this->bean->name}</a>";
1005
-	    $params[] = $mod_strings['LBL_CONVERTLEAD'];
1006
-    	return $params;
997
+    /**
998
+     * @see SugarView::_getModuleTitleParams()
999
+     */
1000
+    protected function _getModuleTitleParams($browserTitle = false)
1001
+    {
1002
+        global $mod_strings;
1003
+        $params = parent::_getModuleTitleParams($browserTitle);
1004
+        $params[] = "<a href='index.php?module=Leads&action=DetailView&record={$this->bean->id}'>{$this->bean->name}</a>";
1005
+        $params[] = $mod_strings['LBL_CONVERTLEAD'];
1006
+        return $params;
1007 1007
     }
1008 1008
 
1009 1009
 
@@ -1011,27 +1011,27 @@  discard block
 block discarded – undo
1011 1011
         $lead
1012 1012
         )
1013 1013
     {
1014
-    	if ($lead->status == "Converted")
1015
-    	{
1016
-    		echo ("<span class='error'>" . translate('LBL_CONVERTLEAD_WARNING'));
1017
-    		$dupes = array();
1018
-    		$q = "SELECT id, first_name, last_name FROM contacts WHERE first_name LIKE '{$lead->first_name}' AND last_name LIKE '{$lead->last_name}' AND deleted = 0";
1019
-    		$result = $lead->db->query($q);
1020
-    		while($row = $lead->db->fetchByAssoc($result)) {
1021
-    			$contact = new Contact();
1022
-    			$contact->retrieve($row['id']);
1023
-    			$dupes[$row['id']] = $contact->name;
1024
-    		}
1025
-    		if (!empty($dupes))
1026
-    		{
1027
-    			foreach($dupes as $id => $name)
1028
-    			{
1029
-    				echo (translate('LBL_CONVERTLEAD_WARNING_INTO_RECORD') . "<a href='index.php?module=Contacts&action=DetailView&record=$id'>$name</a>");
1030
-    				break;
1031
-    			}
1032
-    		}
1033
-    		echo "</span>";
1034
-    	}
1035
-    	return false;
1014
+        if ($lead->status == "Converted")
1015
+        {
1016
+            echo ("<span class='error'>" . translate('LBL_CONVERTLEAD_WARNING'));
1017
+            $dupes = array();
1018
+            $q = "SELECT id, first_name, last_name FROM contacts WHERE first_name LIKE '{$lead->first_name}' AND last_name LIKE '{$lead->last_name}' AND deleted = 0";
1019
+            $result = $lead->db->query($q);
1020
+            while($row = $lead->db->fetchByAssoc($result)) {
1021
+                $contact = new Contact();
1022
+                $contact->retrieve($row['id']);
1023
+                $dupes[$row['id']] = $contact->name;
1024
+            }
1025
+            if (!empty($dupes))
1026
+            {
1027
+                foreach($dupes as $id => $name)
1028
+                {
1029
+                    echo (translate('LBL_CONVERTLEAD_WARNING_INTO_RECORD') . "<a href='index.php?module=Contacts&action=DetailView&record=$id'>$name</a>");
1030
+                    break;
1031
+                }
1032
+            }
1033
+            echo "</span>";
1034
+        }
1035
+        return false;
1036 1036
     }
1037 1037
 }
Please login to merge, or discard this patch.
modules/UpgradeWizard/silentUpgrade_dce_step2.php 1 patch
Indentation   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -47,128 +47,128 @@  discard block
 block discarded – undo
47 47
 ////	UTILITIES THAT MUST BE LOCAL :(
48 48
 //local function for clearing cache
49 49
 function clearCacheSU($thedir, $extension) {
50
-	if ($current = @opendir($thedir)) {
51
-		while (false !== ($children = readdir($current))) {
52
-			if ($children != "." && $children != "..") {
53
-				if (is_dir($thedir . "/" . $children)) {
54
-					clearCacheSU($thedir . "/" . $children, $extension);
55
-				}
56
-				elseif (is_file($thedir . "/" . $children) && substr_count($children, $extension)) {
57
-					unlink($thedir . "/" . $children);
58
-				}
59
-			}
60
-		}
61
-	}
62
- }
63
- //Bug 24890, 24892. default_permissions not written to config.php. Following function checks and if
64
- //no found then adds default_permissions to the config file.
65
- function checkConfigForPermissions(){
66
-     if(file_exists(getcwd().'/config.php')){
67
-         require(getcwd().'/config.php');
68
-     }
69
-     global $sugar_config;
70
-     if(!isset($sugar_config['default_permissions'])){
71
-             $sugar_config['default_permissions'] = array (
72
-                     'dir_mode' => 02770,
73
-                     'file_mode' => 0660,
74
-                     'user' => '',
75
-                     'group' => '',
76
-             );
77
-         ksort($sugar_config);
78
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
79
-        	//writing to the file
80
- 		}
81
-     }
50
+    if ($current = @opendir($thedir)) {
51
+        while (false !== ($children = readdir($current))) {
52
+            if ($children != "." && $children != "..") {
53
+                if (is_dir($thedir . "/" . $children)) {
54
+                    clearCacheSU($thedir . "/" . $children, $extension);
55
+                }
56
+                elseif (is_file($thedir . "/" . $children) && substr_count($children, $extension)) {
57
+                    unlink($thedir . "/" . $children);
58
+                }
59
+            }
60
+        }
61
+    }
62
+    }
63
+    //Bug 24890, 24892. default_permissions not written to config.php. Following function checks and if
64
+    //no found then adds default_permissions to the config file.
65
+    function checkConfigForPermissions(){
66
+        if(file_exists(getcwd().'/config.php')){
67
+            require(getcwd().'/config.php');
68
+        }
69
+        global $sugar_config;
70
+        if(!isset($sugar_config['default_permissions'])){
71
+                $sugar_config['default_permissions'] = array (
72
+                        'dir_mode' => 02770,
73
+                        'file_mode' => 0660,
74
+                        'user' => '',
75
+                        'group' => '',
76
+                );
77
+            ksort($sugar_config);
78
+            if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
79
+            //writing to the file
80
+            }
81
+        }
82 82
 }
83 83
 function checkLoggerSettings(){
84
-	if(file_exists(getcwd().'/config.php')){
85
-         require(getcwd().'/config.php');
86
-     }
84
+    if(file_exists(getcwd().'/config.php')){
85
+            require(getcwd().'/config.php');
86
+        }
87 87
     global $sugar_config;
88
-	if(!isset($sugar_config['logger'])){
89
-	    $sugar_config['logger'] =array (
90
-			'level'=>'fatal',
91
-		    'file' =>
92
-		     array (
93
-		      'ext' => '.log',
94
-		      'name' => 'sugarcrm',
95
-		      'dateFormat' => '%c',
96
-		      'maxSize' => '10MB',
97
-		      'maxLogs' => 10,
98
-		      'suffix' => '', // bug51583, change default suffix to blank for backwards comptability
99
-		    ),
100
-		  );
101
-		 ksort($sugar_config);
102
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
103
-        	//writing to the file
104
- 		}
105
-	 }
88
+    if(!isset($sugar_config['logger'])){
89
+        $sugar_config['logger'] =array (
90
+            'level'=>'fatal',
91
+            'file' =>
92
+                array (
93
+                'ext' => '.log',
94
+                'name' => 'sugarcrm',
95
+                'dateFormat' => '%c',
96
+                'maxSize' => '10MB',
97
+                'maxLogs' => 10,
98
+                'suffix' => '', // bug51583, change default suffix to blank for backwards comptability
99
+            ),
100
+            );
101
+            ksort($sugar_config);
102
+            if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
103
+            //writing to the file
104
+            }
105
+        }
106 106
 }
107 107
 
108 108
 function checkResourceSettings(){
109
-	if(file_exists(getcwd().'/config.php')){
110
-         require(getcwd().'/config.php');
111
-     }
109
+    if(file_exists(getcwd().'/config.php')){
110
+            require(getcwd().'/config.php');
111
+        }
112 112
     global $sugar_config;
113
-	if(!isset($sugar_config['resource_management'])){
114
-	  $sugar_config['resource_management'] =
115
-		  array (
116
-		    'special_query_limit' => 50000,
117
-		    'special_query_modules' =>
118
-		    array (
119
-		      0 => 'Reports',
120
-		      1 => 'Export',
121
-		      2 => 'Import',
122
-		      3 => 'Administration',
123
-		      4 => 'Sync',
124
-		    ),
125
-		    'default_limit' => 1000,
126
-		  );
127
-		 ksort($sugar_config);
128
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
129
-        	//writing to the file
130
- 		}
131
-	}
113
+    if(!isset($sugar_config['resource_management'])){
114
+        $sugar_config['resource_management'] =
115
+            array (
116
+            'special_query_limit' => 50000,
117
+            'special_query_modules' =>
118
+            array (
119
+                0 => 'Reports',
120
+                1 => 'Export',
121
+                2 => 'Import',
122
+                3 => 'Administration',
123
+                4 => 'Sync',
124
+            ),
125
+            'default_limit' => 1000,
126
+            );
127
+            ksort($sugar_config);
128
+            if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
129
+            //writing to the file
130
+            }
131
+    }
132 132
 }
133 133
 
134 134
 function createMissingRels(){
135
-	$relForObjects = array('leads'=>'Leads','campaigns'=>'Campaigns','prospects'=>'Prospects');
136
-	foreach($relForObjects as $relObjName=>$relModName){
137
-		//assigned_user
138
-		$guid = create_guid();
139
-		$query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_assigned_user'";
140
-		$result= $GLOBALS['db']->query($query, true);
141
-		$a = null;
142
-		$a = $GLOBALS['db']->fetchByAssoc($result);
143
-		if(!isset($a['id']) && empty($a['id']) ){
144
-			$qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
135
+    $relForObjects = array('leads'=>'Leads','campaigns'=>'Campaigns','prospects'=>'Prospects');
136
+    foreach($relForObjects as $relObjName=>$relModName){
137
+        //assigned_user
138
+        $guid = create_guid();
139
+        $query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_assigned_user'";
140
+        $result= $GLOBALS['db']->query($query, true);
141
+        $a = null;
142
+        $a = $GLOBALS['db']->fetchByAssoc($result);
143
+        if(!isset($a['id']) && empty($a['id']) ){
144
+            $qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
145 145
 						VALUES ('{$guid}', '{$relObjName}_assigned_user','Users','users','id','{$relModName}','{$relObjName}','assigned_user_id',NULL,NULL,NULL,'one-to-many',NULL,NULL,'0','0')";
146
-			$GLOBALS['db']->query($qRel);
147
-		}
148
-		//modified_user
149
-		$guid = create_guid();
150
-		$query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_modified_user'";
151
-		$result= $GLOBALS['db']->query($query, true);
152
-		$a = null;
153
-		$a = $GLOBALS['db']->fetchByAssoc($result);
154
-		if(!isset($a['id']) && empty($a['id']) ){
155
-			$qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
146
+            $GLOBALS['db']->query($qRel);
147
+        }
148
+        //modified_user
149
+        $guid = create_guid();
150
+        $query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_modified_user'";
151
+        $result= $GLOBALS['db']->query($query, true);
152
+        $a = null;
153
+        $a = $GLOBALS['db']->fetchByAssoc($result);
154
+        if(!isset($a['id']) && empty($a['id']) ){
155
+            $qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
156 156
 						VALUES ('{$guid}', '{$relObjName}_modified_user','Users','users','id','{$relModName}','{$relObjName}','modified_user_id',NULL,NULL,NULL,'one-to-many',NULL,NULL,'0','0')";
157
-			$GLOBALS['db']->query($qRel);
158
-		}
159
-		//created_by
160
-		$guid = create_guid();
161
-		$query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_created_by'";
162
-		$result= $GLOBALS['db']->query($query, true);
163
-		$a = null;
164
-		$a = $GLOBALS['db']->fetchByAssoc($result);
165
-    	if(!isset($a['id']) && empty($a['id']) ){
166
-			$qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
157
+            $GLOBALS['db']->query($qRel);
158
+        }
159
+        //created_by
160
+        $guid = create_guid();
161
+        $query = "SELECT id FROM relationships WHERE relationship_name = '{$relObjName}_created_by'";
162
+        $result= $GLOBALS['db']->query($query, true);
163
+        $a = null;
164
+        $a = $GLOBALS['db']->fetchByAssoc($result);
165
+        if(!isset($a['id']) && empty($a['id']) ){
166
+            $qRel = "INSERT INTO relationships (id,relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted)
167 167
 						VALUES ('{$guid}', '{$relObjName}_created_by','Users','users','id','{$relModName}','{$relObjName}','created_by',NULL,NULL,NULL,'one-to-many',NULL,NULL,'0','0')";
168
-			$GLOBALS['db']->query($qRel);
169
-    	}
170
-	}
171
-	//Also add tracker perf relationship
168
+            $GLOBALS['db']->query($qRel);
169
+        }
170
+    }
171
+    //Also add tracker perf relationship
172 172
 }
173 173
 
174 174
 
@@ -212,22 +212,22 @@  discard block
 block discarded – undo
212 212
 }
213 213
 
214 214
 function addDefaultModuleRoles($defaultRoles = array()) {
215
-	foreach($defaultRoles as $roleName=>$role){
215
+    foreach($defaultRoles as $roleName=>$role){
216 216
         foreach($role as $category=>$actions){
217 217
             foreach($actions as $name=>$access_override){
218 218
                     $query = "SELECT * FROM acl_actions WHERE name='$name' AND category = '$category' AND acltype='$roleName' AND deleted=0 ";
219
-					$result = $GLOBALS['db']->query($query);
220
-					//only add if an action with that name and category don't exist
221
-					$row=$GLOBALS['db']->fetchByAssoc($result);
222
-					if ($row == null) {
223
-	                	$guid = create_guid();
224
-	                	$currdate = gmdate('Y-m-d H:i:s');
225
-	                	$query= "INSERT INTO acl_actions (id,date_entered,date_modified,modified_user_id,name,category,acltype,aclaccess,deleted ) VALUES ('$guid','$currdate','$currdate','1','$name','$category','$roleName','$access_override','0')";
226
-						$GLOBALS['db']->query($query);
227
-	                }
219
+                    $result = $GLOBALS['db']->query($query);
220
+                    //only add if an action with that name and category don't exist
221
+                    $row=$GLOBALS['db']->fetchByAssoc($result);
222
+                    if ($row == null) {
223
+                        $guid = create_guid();
224
+                        $currdate = gmdate('Y-m-d H:i:s');
225
+                        $query= "INSERT INTO acl_actions (id,date_entered,date_modified,modified_user_id,name,category,acltype,aclaccess,deleted ) VALUES ('$guid','$currdate','$currdate','1','$name','$category','$roleName','$access_override','0')";
226
+                        $GLOBALS['db']->query($query);
227
+                    }
228 228
             }
229 229
         }
230
-	}
230
+    }
231 231
 }
232 232
 
233 233
 function verifyArguments($argv,$usage_dce,$usage_regular){
@@ -300,33 +300,33 @@  discard block
 block discarded – undo
300 300
 }
301 301
 
302 302
 function upgradeDCEFiles($argv,$instanceUpgradePath){
303
-	//copy and update following files from upgrade package
304
-	$upgradeTheseFiles = array('cron.php','download.php','index.php','install.php','soap.php','sugar_version.php','vcal_server.php');
305
-	foreach($upgradeTheseFiles as $file){
306
-		$srcFile = clean_path("{$instanceUpgradePath}/$file");
307
-		$destFile = clean_path("{$argv[3]}/$file");
308
-		if(file_exists($srcFile)){
309
-			if(!is_dir(dirname($destFile))) {
310
-				mkdir_recursive(dirname($destFile)); // make sure the directory exists
311
-			}
312
-			copy_recursive($srcFile,$destFile);
313
-			$_GET['TEMPLATE_PATH'] = $destFile;
314
-			$_GET['CONVERT_FILE_ONLY'] = true;
315
-			if(!class_exists('TemplateConverter')){
316
-				include($argv[7].'templateConverter.php');
317
-			}else{
318
-				TemplateConverter::convertFile($_GET['TEMPLATE_PATH']);
319
-			}
303
+    //copy and update following files from upgrade package
304
+    $upgradeTheseFiles = array('cron.php','download.php','index.php','install.php','soap.php','sugar_version.php','vcal_server.php');
305
+    foreach($upgradeTheseFiles as $file){
306
+        $srcFile = clean_path("{$instanceUpgradePath}/$file");
307
+        $destFile = clean_path("{$argv[3]}/$file");
308
+        if(file_exists($srcFile)){
309
+            if(!is_dir(dirname($destFile))) {
310
+                mkdir_recursive(dirname($destFile)); // make sure the directory exists
311
+            }
312
+            copy_recursive($srcFile,$destFile);
313
+            $_GET['TEMPLATE_PATH'] = $destFile;
314
+            $_GET['CONVERT_FILE_ONLY'] = true;
315
+            if(!class_exists('TemplateConverter')){
316
+                include($argv[7].'templateConverter.php');
317
+            }else{
318
+                TemplateConverter::convertFile($_GET['TEMPLATE_PATH']);
319
+            }
320 320
 
321 321
 
322
-		}
323
-	}
322
+        }
323
+    }
324 324
 }
325 325
 
326 326
 
327 327
 
328 328
 function threeWayMerge(){
329
-	//using threeway merge apis
329
+    //using threeway merge apis
330 330
 }
331 331
 ////	END UTILITIES THAT MUST BE LOCAL :(
332 332
 ///////////////////////////////////////////////////////////////////////////////
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 
341 341
 // only run from command line
342 342
 if(isset($_SERVER['HTTP_USER_AGENT'])) {
343
-	fwrite(STDERR,'This utility may only be run from the command line or command prompt.');
344
-	exit(1);
343
+    fwrite(STDERR,'This utility may only be run from the command line or command prompt.');
344
+    exit(1);
345 345
 }
346 346
 //Clean_string cleans out any file  passed in as a parameter
347 347
 $_SERVER['PHP_SELF'] = 'silentUpgrade.php';
@@ -449,18 +449,18 @@  discard block
 block discarded – undo
449 449
 
450 450
 
451 451
 if($upgradeType == constant('DCE_INSTANCE')){
452
-   	//$instanceUpgradePath = "{$argv[1]}/DCEUpgrade/{$zip_from_dir}";
453
-   	//$instanceUpgradePath = "{$argv[1]}";
454
-	include ("ini_setup.php");
452
+        //$instanceUpgradePath = "{$argv[1]}/DCEUpgrade/{$zip_from_dir}";
453
+        //$instanceUpgradePath = "{$argv[1]}";
454
+    include ("ini_setup.php");
455 455
 
456
-	//get new template path for use in later processing
456
+    //get new template path for use in later processing
457 457
     $dceupgrade_pos = strpos($argv[1], '/DCEUpgrade');
458 458
     $newtemplate_path = substr($argv[1], 0, $dceupgrade_pos);
459 459
 
460
-	require("{$argv[4]}/sugar_version.php");
461
-	global $sugar_version;
460
+    require("{$argv[4]}/sugar_version.php");
461
+    global $sugar_version;
462 462
 
463
-	/*
463
+    /*
464 464
 	//require classes if they do not exist, as these were not in pre 550 entrypoint.php and need to be loaded first
465 465
     if(!class_exists('VardefManager')){
466 466
         require_once("{$newtemplate_path}/include/SugarObjects/VardefManager.php");
@@ -473,69 +473,69 @@  discard block
 block discarded – undo
473 473
 	}
474 474
     */
475 475
 
476
-	//load up entrypoint from original template
477
-   	require_once("{$argv[4]}/include/entryPoint.php");
476
+    //load up entrypoint from original template
477
+        require_once("{$argv[4]}/include/entryPoint.php");
478 478
 
479
-	require_once("{$newtemplate_path}/include/utils/zip_utils.php");
480
-	require_once("{$newtemplate_path}/modules/Administration/UpgradeHistory.php");
479
+    require_once("{$newtemplate_path}/include/utils/zip_utils.php");
480
+    require_once("{$newtemplate_path}/modules/Administration/UpgradeHistory.php");
481 481
 
482
-	// We need to run the silent upgrade as the admin user
483
-	require_once("{$newtemplate_path}/modules/Users/User.php");
484
-	global $current_user;
485
-	$current_user = new User();
486
-	$current_user->retrieve('1');
482
+    // We need to run the silent upgrade as the admin user
483
+    require_once("{$newtemplate_path}/modules/Users/User.php");
484
+    global $current_user;
485
+    $current_user = new User();
486
+    $current_user->retrieve('1');
487 487
 
488 488
 
489
-	//This is DCE instance
490
-      global $sugar_config;
491
-      global $sugar_version;
489
+    //This is DCE instance
490
+        global $sugar_config;
491
+        global $sugar_version;
492 492
 //    require_once("{$cwd}/sugar_version.php"); //provides instance version, flavor etc..
493
-     //provides instance version, flavor etc..
493
+        //provides instance version, flavor etc..
494 494
     $isDCEInstance = true;
495 495
     $configOptions = $sugar_config['dbconfig'];
496 496
 
497
-	$GLOBALS['log']	= LoggerManager::getLogger('SugarCRM');
498
-	$db				= &DBManagerFactory::getInstance();
499
-       		///////////////////////////////////////////////////////////////////////////////
500
-	////	MAKE SURE PATCH IS COMPATIBLE
497
+    $GLOBALS['log']	= LoggerManager::getLogger('SugarCRM');
498
+    $db				= &DBManagerFactory::getInstance();
499
+                ///////////////////////////////////////////////////////////////////////////////
500
+    ////	MAKE SURE PATCH IS COMPATIBLE
501 501
 
502
-	if(is_file("{$argv[1]}/manifest.php")) {
503
-		// provides $manifest array
504
-		include("{$argv[1]}/manifest.php");
505
-	}
506
-	//If Instance then the files will be accessed from Template/DCEUpgrade folder
507
-	$zip_from_dir = '';
502
+    if(is_file("{$argv[1]}/manifest.php")) {
503
+        // provides $manifest array
504
+        include("{$argv[1]}/manifest.php");
505
+    }
506
+    //If Instance then the files will be accessed from Template/DCEUpgrade folder
507
+    $zip_from_dir = '';
508 508
     if( isset( $manifest['copy_files']['from_dir'] ) && $manifest['copy_files']['from_dir'] != "" ){
509
-	    $zip_from_dir   = $manifest['copy_files']['from_dir'];
510
-	}
509
+        $zip_from_dir   = $manifest['copy_files']['from_dir'];
510
+    }
511 511
 
512
-	$instanceUpgradePath = "{$argv[1]}/{$zip_from_dir}";
513
-	$_SESSION['sugar_version_file'] = '';
514
-	$srcFile = clean_path("{$instanceUpgradePath}/sugar_version.php");
515
-	if(file_exists($srcFile)) {
516
-	   $_SESSION['sugar_version_file'] = $srcFile;
517
-	}
512
+    $instanceUpgradePath = "{$argv[1]}/{$zip_from_dir}";
513
+    $_SESSION['sugar_version_file'] = '';
514
+    $srcFile = clean_path("{$instanceUpgradePath}/sugar_version.php");
515
+    if(file_exists($srcFile)) {
516
+        $_SESSION['sugar_version_file'] = $srcFile;
517
+    }
518 518
 
519 519
 
520
-	global $instancePath;
521
-	$instancePath = $instanceUpgradePath;
522
-	$_SESSION['instancePath'] = $instancePath;
523
-	if(file_exists("{$instanceUpgradePath}/modules/UpgradeWizard/uw_utils.php")){
524
-		require_once("{$instanceUpgradePath}/modules/UpgradeWizard/uw_utils.php");
525
-	} else{
526
-		require_once("{$newtemplate_path}/modules/UpgradeWizard/uw_utils.php");
527
-	}
520
+    global $instancePath;
521
+    $instancePath = $instanceUpgradePath;
522
+    $_SESSION['instancePath'] = $instancePath;
523
+    if(file_exists("{$instanceUpgradePath}/modules/UpgradeWizard/uw_utils.php")){
524
+        require_once("{$instanceUpgradePath}/modules/UpgradeWizard/uw_utils.php");
525
+    } else{
526
+        require_once("{$newtemplate_path}/modules/UpgradeWizard/uw_utils.php");
527
+    }
528 528
 
529 529
     $ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt' || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt');
530
-	$_SESSION['upgrade_from_flavor'] = $manifest['name'];
530
+    $_SESSION['upgrade_from_flavor'] = $manifest['name'];
531 531
 
532 532
     //check for db upgrade
533 533
     //check exit on conflicts
534 534
     $skipDBUpgrade = 'no'; //default
535 535
     if($argv[6] != null && !empty($argv[6])){
536
-    	if(strtolower($argv[6]) == 'yes'){
537
-    	  $skipDBUpgrade = 'yes'; //override
538
-    	}
536
+        if(strtolower($argv[6]) == 'yes'){
537
+            $skipDBUpgrade = 'yes'; //override
538
+        }
539 539
     }
540 540
     global $unzip_dir;
541 541
     $unzip_dir = $argv[1];
@@ -544,16 +544,16 @@  discard block
 block discarded – undo
544 544
     $path = $argv[2];
545 545
 
546 546
     if($skipDBUpgrade == 'no'){
547
-    	//upgrade the db
548
-	    ///////////////////////////////////////////////////////////////////////////////
549
-		////	HANDLE PREINSTALL SCRIPTS
550
-		$file = "{$argv[1]}/".constant('SUGARCRM_PRE_INSTALL_FILE');
551
-		if(is_file($file)) {
552
-			include($file);
553
-			logThis('Running pre_install()...', $path);
554
-			pre_install();
555
-			logThis('pre_install() done.', $path);
556
-		}
547
+        //upgrade the db
548
+        ///////////////////////////////////////////////////////////////////////////////
549
+        ////	HANDLE PREINSTALL SCRIPTS
550
+        $file = "{$argv[1]}/".constant('SUGARCRM_PRE_INSTALL_FILE');
551
+        if(is_file($file)) {
552
+            include($file);
553
+            logThis('Running pre_install()...', $path);
554
+            pre_install();
555
+            logThis('pre_install() done.', $path);
556
+        }
557 557
 
558 558
 
559 559
         //run the 3-way merge
@@ -565,23 +565,23 @@  discard block
 block discarded – undo
565 565
             logThis('Finished 3 way merge()...', $path);
566 566
         }
567 567
 
568
-		logThis('Starting post_install()...', $path);
569
-		$file = "{$argv[1]}/".constant('SUGARCRM_POST_INSTALL_FILE');
570
-		if(is_file($file)) {
571
-		    include($file);
572
-			post_install();
573
-		}
574
-		logThis('post_install() done.', $path);
568
+        logThis('Starting post_install()...', $path);
569
+        $file = "{$argv[1]}/".constant('SUGARCRM_POST_INSTALL_FILE');
570
+        if(is_file($file)) {
571
+            include($file);
572
+            post_install();
573
+        }
574
+        logThis('post_install() done.', $path);
575 575
 
576
-    	///////////////////////////////////////////////////////////////////////////////
577
-		//clean vardefs
578
-		logThis('Performing UWrebuild()...', $path);
579
-			UWrebuild();
580
-		logThis('UWrebuild() done.', $path);
576
+        ///////////////////////////////////////////////////////////////////////////////
577
+        //clean vardefs
578
+        logThis('Performing UWrebuild()...', $path);
579
+            UWrebuild();
580
+        logThis('UWrebuild() done.', $path);
581 581
 
582
-		logThis('begin check default permissions .', $path);
583
-	    	checkConfigForPermissions();
584
-	    logThis('end check default permissions .', $path);
582
+        logThis('begin check default permissions .', $path);
583
+            checkConfigForPermissions();
584
+        logThis('end check default permissions .', $path);
585 585
 
586 586
         logThis('begin check logger settings .', $path);
587 587
             checkLoggerSettings();
@@ -605,63 +605,63 @@  discard block
 block discarded – undo
605 605
         include($newtemplate_path.'/include/modules.php');
606 606
         $newModuleList = $moduleList;
607 607
 
608
-		///    RELOAD NEW DEFINITIONS
609
-		global $ACLActions, $beanList, $beanFiles;
610
-		include($newtemplate_path.'/modules/ACLActions/actiondefs.php');
611
-
612
-		//First repair the databse to ensure it is up to date with the new vardefs/tabledefs
613
-		logThis('About to repair the database.', $path);
614
-		//Use Repair and rebuild to update the database.
615
-		global $dictionary;
616
-		require_once($newtemplate_path.'/modules/Administration/QuickRepairAndRebuild.php');
617
-		$rac = new RepairAndClear();
618
-		$rac->clearVardefs();
619
-		$rac->rebuildExtensions();
620
-
621
-		$repairedTables = array();
622
-
623
-		//Force vardefs to be reloaded
624
-		$GLOBALS['reload_vardefs'] = true;
625
-
626
-		foreach ($beanFiles as $bean => $file) {
627
-			if(file_exists($newtemplate_path . '/' . $file) && $bean != 'UpgradeHistory'){
628
-				unset($GLOBALS['dictionary'][$bean]);
629
-				require_once($newtemplate_path . '/' . $file);
630
-
631
-				$focus = new $bean ();
632
-				if(empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
633
-				   continue;
634
-				}
635
-
636
-				if (($focus instanceOf SugarBean)) {
637
-					$sql = $db->repairTable($focus, true);
638
-					if(!empty($sql)) {
639
-			   		   logThis($sql, $path);
640
-			   		   $repairedTables[$focus->table_name] = true;
641
-					}
642
-				}
643
-			}
644
-		}
608
+        ///    RELOAD NEW DEFINITIONS
609
+        global $ACLActions, $beanList, $beanFiles;
610
+        include($newtemplate_path.'/modules/ACLActions/actiondefs.php');
611
+
612
+        //First repair the databse to ensure it is up to date with the new vardefs/tabledefs
613
+        logThis('About to repair the database.', $path);
614
+        //Use Repair and rebuild to update the database.
615
+        global $dictionary;
616
+        require_once($newtemplate_path.'/modules/Administration/QuickRepairAndRebuild.php');
617
+        $rac = new RepairAndClear();
618
+        $rac->clearVardefs();
619
+        $rac->rebuildExtensions();
620
+
621
+        $repairedTables = array();
622
+
623
+        //Force vardefs to be reloaded
624
+        $GLOBALS['reload_vardefs'] = true;
625
+
626
+        foreach ($beanFiles as $bean => $file) {
627
+            if(file_exists($newtemplate_path . '/' . $file) && $bean != 'UpgradeHistory'){
628
+                unset($GLOBALS['dictionary'][$bean]);
629
+                require_once($newtemplate_path . '/' . $file);
630
+
631
+                $focus = new $bean ();
632
+                if(empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
633
+                    continue;
634
+                }
635
+
636
+                if (($focus instanceOf SugarBean)) {
637
+                    $sql = $db->repairTable($focus, true);
638
+                    if(!empty($sql)) {
639
+                            logThis($sql, $path);
640
+                            $repairedTables[$focus->table_name] = true;
641
+                    }
642
+                }
643
+            }
644
+        }
645 645
 
646
-		unset ($dictionary);
647
-		include ($newtemplate_path.'/modules/TableDictionary.php');
648
-		foreach ($dictionary as $meta) {
649
-			$tablename = $meta['table'];
646
+        unset ($dictionary);
647
+        include ($newtemplate_path.'/modules/TableDictionary.php');
648
+        foreach ($dictionary as $meta) {
649
+            $tablename = $meta['table'];
650 650
 
651
-			if(isset($repairedTables[$tablename])) {
652
-			   continue;
653
-			}
651
+            if(isset($repairedTables[$tablename])) {
652
+                continue;
653
+            }
654 654
 
655
-			$fielddefs = $meta['fields'];
656
-			$indices = $meta['indices'];
657
-			$sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true);
658
-			if(!empty($sql)) {
659
-			    logThis($sql, $path);
660
-			    $repairedTables[$tablename] = true;
661
-			}
655
+            $fielddefs = $meta['fields'];
656
+            $indices = $meta['indices'];
657
+            $sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true);
658
+            if(!empty($sql)) {
659
+                logThis($sql, $path);
660
+                $repairedTables[$tablename] = true;
661
+            }
662 662
 
663
-		}
664
-		logThis('database repaired', $path);
663
+        }
664
+        logThis('database repaired', $path);
665 665
 
666 666
         //include tab controller
667 667
         require_once($newtemplate_path.'/modules/MySettings/TabController.php');
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 
686 686
         //add the new tabs to the array
687 687
         foreach($newModuleList as $nm ){
688
-          $tabs[$nm] = $nm;
688
+            $tabs[$nm] = $nm;
689 689
         }
690 690
 
691 691
         //now assign the modules to system tabs
@@ -694,75 +694,75 @@  discard block
 block discarded – undo
694 694
 
695 695
 
696 696
 
697
-	    if($ce_to_pro_ent){
698
-	    	//add the global team if it does not exist
699
-			$globalteam = new Team();
700
-			$globalteam->retrieve('1');
701
-			include($newtemplate_path.'/modules/Administration/language/en_us.lang.php');
702
-			if(isset($globalteam->name)){
697
+        if($ce_to_pro_ent){
698
+            //add the global team if it does not exist
699
+            $globalteam = new Team();
700
+            $globalteam->retrieve('1');
701
+            include($newtemplate_path.'/modules/Administration/language/en_us.lang.php');
702
+            if(isset($globalteam->name)){
703 703
 
704
-			   echo 'Global '.$mod_strings['LBL_UPGRADE_TEAM_EXISTS'].'<br>';
705
-			   logThis(" Finish Building private teams", $path);
704
+                echo 'Global '.$mod_strings['LBL_UPGRADE_TEAM_EXISTS'].'<br>';
705
+                logThis(" Finish Building private teams", $path);
706 706
 
707
-			}else{
708
-			   $globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team);
709
-			}
707
+            }else{
708
+                $globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team);
709
+            }
710 710
 
711
-	    	//build private teams
712
-		    logThis(" Start Building private teams", $path);
713
-		    upgradeModulesForTeam();
714
-		    logThis(" Finish Building private teams", $path);
711
+            //build private teams
712
+            logThis(" Start Building private teams", $path);
713
+            upgradeModulesForTeam();
714
+            logThis(" Finish Building private teams", $path);
715 715
 
716
-			//build team sets
717
-		    logThis(" Start Building the team_set and team_sets_teams", $path);
718
-		    upgradeModulesForTeamsets();
719
-		    logThis(" Finish Building the team_set and team_sets_teams", $path);
716
+            //build team sets
717
+            logThis(" Start Building the team_set and team_sets_teams", $path);
718
+            upgradeModulesForTeamsets();
719
+            logThis(" Finish Building the team_set and team_sets_teams", $path);
720 720
 
721
-		    //upgrade teams
722
-			if(file_exists($newtemplate_path.'/modules/Administration/upgradeTeams.php')) {
723
-				logThis(" Start {$newtemplate_path}/modules/Administration/upgradeTeams.php", $path);
724
-				include($newtemplate_path.'/modules/Administration/upgradeTeams.php');
725
-				logThis(" Finish {$newtemplate_path}/modules/Administration/upgradeTeams.php", $path);
721
+            //upgrade teams
722
+            if(file_exists($newtemplate_path.'/modules/Administration/upgradeTeams.php')) {
723
+                logThis(" Start {$newtemplate_path}/modules/Administration/upgradeTeams.php", $path);
724
+                include($newtemplate_path.'/modules/Administration/upgradeTeams.php');
725
+                logThis(" Finish {$newtemplate_path}/modules/Administration/upgradeTeams.php", $path);
726 726
 
727
-				//update the users records to have default team
728
-				logThis('running query to populate default_team on users table',$path);
729
-				$GLOBALS['db']->query("update users set default_team = (select teams.id from teams where teams.name = concat('(',users.user_name, ')') or team.associated_user_id = users.id)");
727
+                //update the users records to have default team
728
+                logThis('running query to populate default_team on users table',$path);
729
+                $GLOBALS['db']->query("update users set default_team = (select teams.id from teams where teams.name = concat('(',users.user_name, ')') or team.associated_user_id = users.id)");
730 730
 
731
-			}
731
+            }
732 732
 
733
-			//run upgrade script for dashlets to include sales/marketing
734
-			if(function_exists('upgradeDashletsForSalesAndMarketing')){
735
-	           logThis('calling upgradeDashlets script',$path);
736
-			   upgradeDashletsForSalesAndMarketing();
737
-			}
733
+            //run upgrade script for dashlets to include sales/marketing
734
+            if(function_exists('upgradeDashletsForSalesAndMarketing')){
735
+                logThis('calling upgradeDashlets script',$path);
736
+                upgradeDashletsForSalesAndMarketing();
737
+            }
738 738
 
739
-	    }
739
+        }
740 740
 
741
-		require("sugar_version.php");
742
-		require('config.php');
743
-		global $sugar_config;
741
+        require("sugar_version.php");
742
+        require('config.php');
743
+        global $sugar_config;
744 744
 
745
-		require("{$instanceUpgradePath}/sugar_version.php");
746
-		if(!rebuildConfigFile($sugar_config, $sugar_version)) {
747
-			logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
748
-			$errors[] = 'Could not write config.php!';
749
-		}
750
-		checkConfigForPermissions();
745
+        require("{$instanceUpgradePath}/sugar_version.php");
746
+        if(!rebuildConfigFile($sugar_config, $sugar_version)) {
747
+            logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
748
+            $errors[] = 'Could not write config.php!';
749
+        }
750
+        checkConfigForPermissions();
751 751
 
752
-    	// clear out the theme cache
753
-		if(!class_exists('SugarThemeRegistry')){
754
-		    require_once($newtemplate_path . '/include/SugarTheme/SugarTheme.php');
755
-		}
756
-		SugarThemeRegistry::buildRegistry();
757
-		SugarThemeRegistry::clearAllCaches();
752
+        // clear out the theme cache
753
+        if(!class_exists('SugarThemeRegistry')){
754
+            require_once($newtemplate_path . '/include/SugarTheme/SugarTheme.php');
755
+        }
756
+        SugarThemeRegistry::buildRegistry();
757
+        SugarThemeRegistry::clearAllCaches();
758 758
 
759
-		// re-minify the JS source files
760
-		$_REQUEST['root_directory'] = getcwd();
761
-		$_REQUEST['js_rebuild_concat'] = 'rebuild';
762
-		require_once($newtemplate_path . '/jssource/minify.php');
759
+        // re-minify the JS source files
760
+        $_REQUEST['root_directory'] = getcwd();
761
+        $_REQUEST['js_rebuild_concat'] = 'rebuild';
762
+        require_once($newtemplate_path . '/jssource/minify.php');
763 763
 
764
-		//as last step, rebuild the language files and rebuild relationships
765
-		/*
764
+        //as last step, rebuild the language files and rebuild relationships
765
+        /*
766 766
 		if(file_exists($newtemplate_path.'/modules/Administration/RebuildJSLang.php')) {
767 767
 			logThis("begin rebuilding js language files. via ".$newtemplate_path.'/modules/Administration/RebuildJSLang.php', $path);
768 768
 			include($newtemplate_path.'/modules/Administration/RebuildJSLang.php');
@@ -779,52 +779,52 @@  discard block
 block discarded – undo
779 779
 if(isset($_SESSION['current_db_version']) && isset($_SESSION['target_db_version'])){
780 780
     if (version_compare($_SESSION['current_db_version'], $_SESSION['target_db_version'], '='))
781 781
     {
782
-	    $_REQUEST['upgradeWizard'] = true;
783
-	    ob_start();
784
-		include('include/Smarty/internals/core.write_file.php');
785
-		ob_end_clean();
786
-	 	$db =& DBManagerFactory::getInstance();
787
-		if($ce_to_pro_ent){
788
-	        //Also set license information
789
-	        $admin = new Administration();
790
-			$category = 'license';
791
-			$value = 0;
792
-			$admin->saveSetting($category, 'users', $value);
793
-			$key = array('num_lic_oc','key','expire_date');
794
-			$value = '';
795
-			foreach($key as $k){
796
-				$admin->saveSetting($category, $k, $value);
797
-			}
798
-		}
799
-	}
782
+        $_REQUEST['upgradeWizard'] = true;
783
+        ob_start();
784
+        include('include/Smarty/internals/core.write_file.php');
785
+        ob_end_clean();
786
+            $db =& DBManagerFactory::getInstance();
787
+        if($ce_to_pro_ent){
788
+            //Also set license information
789
+            $admin = new Administration();
790
+            $category = 'license';
791
+            $value = 0;
792
+            $admin->saveSetting($category, 'users', $value);
793
+            $key = array('num_lic_oc','key','expire_date');
794
+            $value = '';
795
+            foreach($key as $k){
796
+                $admin->saveSetting($category, $k, $value);
797
+            }
798
+        }
799
+    }
800 800
 }
801 801
 
802 802
 set_upgrade_progress('end','done','end','done');
803 803
 
804 804
 if(file_exists($newtemplate_path . '/modules/Configurator/Configurator.php')){
805
-	set_upgrade_progress('configurator','in_progress');
806
-	require_once($newtemplate_path . '/include/utils/array_utils.php');
807
-	if(!class_exists('Configurator')){
808
-		require_once($newtemplate_path . '/modules/Configurator/Configurator.php');
809
-	}
810
-	$Configurator = new Configurator();
811
-	if(class_exists('Configurator')){
812
-		$Configurator->parseLoggerSettings();
813
-	}
814
-	set_upgrade_progress('configurator','done');
805
+    set_upgrade_progress('configurator','in_progress');
806
+    require_once($newtemplate_path . '/include/utils/array_utils.php');
807
+    if(!class_exists('Configurator')){
808
+        require_once($newtemplate_path . '/modules/Configurator/Configurator.php');
809
+    }
810
+    $Configurator = new Configurator();
811
+    if(class_exists('Configurator')){
812
+        $Configurator->parseLoggerSettings();
813
+    }
814
+    set_upgrade_progress('configurator','done');
815 815
 }
816 816
 
817 817
 //unset the logger previously instantiated
818 818
 if(file_exists($newtemplate_path . '/include/SugarLogger/LoggerManager.php')){
819
-	set_upgrade_progress('logger','in_progress');
820
-	if(!class_exists('LoggerManager')){
819
+    set_upgrade_progress('logger','in_progress');
820
+    if(!class_exists('LoggerManager')){
821 821
 
822
-	}
823
-	if(class_exists('LoggerManager')){
824
-		unset($GLOBALS['log']);
825
-		$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
826
-	}
827
-	set_upgrade_progress('logger','done');
822
+    }
823
+    if(class_exists('LoggerManager')){
824
+        unset($GLOBALS['log']);
825
+        $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
826
+    }
827
+    set_upgrade_progress('logger','done');
828 828
 }
829 829
 
830 830
 ///////////////////////////////////////////////////////////////////////////////
@@ -833,22 +833,22 @@  discard block
 block discarded – undo
833 833
 ob_end_clean();
834 834
 
835 835
 if(count($errors) > 0) {
836
-	foreach($errors as $error) {
837
-		logThis("****** SilentUpgrade ERROR: {$error}", $path);
838
-	}
839
-	echo "FAILED\n";
836
+    foreach($errors as $error) {
837
+        logThis("****** SilentUpgrade ERROR: {$error}", $path);
838
+    }
839
+    echo "FAILED\n";
840 840
 } else {
841
-	logThis("***** SilentUpgrade completed successfully.", $path);
842
-	echo "********************************************************************\n";
843
-	echo "*************************** SUCCESS*********************************\n";
844
-	echo "********************************************************************\n";
845
-	echo "******** If your pre-upgrade Leads data is not showing  ************\n";
846
-	echo "******** Or you see errors in detailview subpanels  ****************\n";
847
-	echo "************* In order to resolve them  ****************************\n";
848
-	echo "******** Log into application as Administrator  ********************\n";
849
-	echo "******** Go to Admin panel  ****************************************\n";
850
-	echo "******** Run Repair -> Rebuild Relationships  **********************\n";
851
-	echo "********************************************************************\n";
841
+    logThis("***** SilentUpgrade completed successfully.", $path);
842
+    echo "********************************************************************\n";
843
+    echo "*************************** SUCCESS*********************************\n";
844
+    echo "********************************************************************\n";
845
+    echo "******** If your pre-upgrade Leads data is not showing  ************\n";
846
+    echo "******** Or you see errors in detailview subpanels  ****************\n";
847
+    echo "************* In order to resolve them  ****************************\n";
848
+    echo "******** Log into application as Administrator  ********************\n";
849
+    echo "******** Go to Admin panel  ****************************************\n";
850
+    echo "******** Run Repair -> Rebuild Relationships  **********************\n";
851
+    echo "********************************************************************\n";
852 852
 }
853 853
 
854 854
 
Please login to merge, or discard this patch.